Vous êtes sur la page 1sur 23

GOIP SMS Interface

Follow this API, you can develop your sms server to use GoIP doing something.

.Initiali!ation
Communication of this system use clear text for transmission over UDP transport layer. Please setup the retransmission mechanism for reduces the packet loss between the SMS server and Go P. SMS Server nitiali!ation" Set the authentication D and password for G# P$ and save the list of Ds and passwords. #pen the UDP port then start listenin%. G# P Parameters" &nable 'SMS Sender( on the confi%uration pa%e$ fills your SMS server address and port$ authentication D and password )refer to above 'SMS Server nitiali!ation( for settin%*.

".#egistration and $eepalive


GoIP SMS Server

+.,e%ister and 5eepalive

4.5eepalive 6ck

Step +.,e %iste

Description G# P will send a keepalive packet to server every -.s. /ormat" re0"1count2id"1id2pass"1password2num"1%sm3num2si%nal"

r and 1%sm3si%nal2%sm3status"1%sm3status2voip3status"1voip3status2imei" 5eep 1imei2imsi"1imsi2iccid"1iccid2 alive 7ariable" 1count" counter for sendin% packets. nitiali!e to + when G# P power up and increase by + after a packet is sent out. 1id" authentication id set in confi%uration pa%e. 1password" authentication password set in confi%uration pa%e. 1%sm3num" sim card number 1%sm3si%nal" sim si%nal 1%sm3status" 8#G 9 or 8#G#U: 1voip3status" status of 7o P$ 8#G 9 or 8#G#U: 1imei" M& of GSM Module 1imsi" MS of S M Card 1iccid" CC D of S M Card 4.ke SMS server will verify the authentication id and password of the epali keepalive packet received. 6nd send keepalive ack if the id and ve password are matched with the authentication list. ack /ormat" re%"1count2status"1status2 7ariable" 1count" nte%er$ the same as ,e%ister and 5eep alive packet of Go P. 1status" nte%er$ . means ok. e.%. G# P send the keepalive with 're0"+.2id"%oipid+2pass"password+2 num"+4-;<2si%nal"4-2%sm3status"8#G 92voip3status"8#G 92( to SMS server. SMS server send the keepalive ack with 're%"+.2status".2( )if %oipid+ and password+ is valid.*

%.Send SMS +.=ulkSMS,e0uest 4.=ulkSMSConfirm>=ulkSMS,e?ect -.6uthentication,e0uest ;.6uthenticationConfirm <.Submit9umber,e0uest +


Send SMS

@.Submit9umberStatus + A.Submit9umber,e0uest 4

Send SMS

B.Submit9umberStatus 4 C D.&nd,e0uest +..&ndConfirm

Step +. =ulkSMS,e0uest

4.=ulkSMSConfirm =ulkSMS,e?ect

Description 6t the be%innin%$ SMS server will send a bulk SMS ,e0uest to G# P$ include the SMS content and len%th in utfB format. :he SMS content should be limited to -... bytes or less. /ormat" MSG 1sendid 1len%th 1ms%En 7ariable" 1sendid" nte%er$ as a server packet identifier. 9ote$ all messa%es described below should use the same 'sendid( defined here if they are belon% to a same bulk SMS session. 1len%th" nte%er in utfB format$ as the SMS content len%th 1ms%" SMS content in utfB format G# P will do the initiali!ation for the bulk SMS when =ulk SMS ,e0uest received. 9ote$ the other messa%es of this bulk SMS should be received in D.s after =ulk SMS ,e0uest received. #r$ G# P will stop the session and release. )+* Fhen the initiali!ation successful$ G# P will send a =ulk,e0uest Confirm to server and re0uest for authentication /ormat" P6SSF#,D 1sendidEn 7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest.

)4* Fhen the initiali!ation failed$ G# P will send a =ulkSMS,e?ect to server$ include the error messa%e. /ormat" &,,#, 1sendid 1errorms%En 7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. 1errorms%" Strin%$ &rror messa%e. 9ow too many re0uest for bulk SMS received at the same time is the main reason of the failure. 9ote$ G# P only support < bulk SMS session at the same time. 6nd$ server should stop the session when receive bulkSMS,e0uest ,e?ect. :hen$ try a%ain later. -.6uthentication,e0uest SMS server should send a 6uthentication,e0uest with the password to G# P.

/ormat" P6SSF#,D 1sendid 1passwordEn 7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. 1password" :he re%istration password of G# P ;.6uthenticationConfirm G# P will verify the password in 6uthentication,e?ect 6uthentication,e0uest and return the result to server. )+* Fhen authentication successful$ G# P will send a 6uthenticationConfirm to server. /ormat" S&9D 1sendidEn 7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. )4* Fhen authentication failed$ G# P will send a 6uthentication,e?ect to server and wait for the next 6uthentication,e0uest or the &nd,e0uest /ormat" &,,#, 1sendid P6SSF#,DEn 7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. <.Submit9umber,e0uest G# P need about 4G< seconds to send a SMS. So$ to avoid packet loos$ SMS server could send a Submit9umber,e0uest to G# P to %et the sendin% status of an appointed number every serial seconds until the SMS is sent successfully.6nd$ G# P only save the sendin% status of the last +. numbers in this %roup /ormat" S&9D 1sendid 1telid 1telnumEn 7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. 1telid" nte%er$ the uni0ue Submit9umber,e0uest se0uence number defined by server. 1teinum" Strin%$ telephone number @. Submit9umberStatus G# P will send a Submit9umberStatus to server when the Submit9umber,e0uest received. )+* when sendin% SMS to appointed number successful$ G# P will send a Submit9umberStatus with #5 to server. /ormat" #5 1sendid 1telidEn 7ariable"

1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. 1telid" nte%er$ uni0ue se0uence number in Submit9umber,e0uest. )4* Fhen sendin% failed$ G# P will send a Submit9umberStatus with &,,#, to server. /ormat" &,,#, 1sendid 1telid errorstatus" 1erroridEn 7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. 1telid" nte%er$ uni0ue se0uence number in Submit9umber,e0uest. 1errorid" nte%er$ error code. Usually it is e0ual to +. )-* Fhen the telid in Submit9umber,e0uest is not in the list of which save the recent +. sendin% number$ G# P will save the telid in the waitin% list and send a Submit9umberStatus with F6 :. /ormat" F6 : 1sendid 1telidEn 7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. 1telid" nte%er$ uni0ue se0uence number in Submit9umber,e0uest. A.Submit9umber,e0uest 9ote$ SMS server should send the next Submit9umber,e0uest to G# P after the Submit9umberStatus with #5 or &,,#, received Same as < B. Submit9umberStatus Same as @ D. &nd,e0eust SMS server could send a &nd,e0uest to G# P to finish the bulk SMS session. /ormat" D#9& 1sendidEn 7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. +..&nd G# P will release the bulk SMS session resource when &nd,e0uest received. 6nd return a &ndConfirm to server /ormat" D#9& 1sendidEn

7ariable" 1sendid" nte%er$ bulk SMS session identifier in =ulkSMS,e0uest. &xample" 6ssume" sendid" ++$ SMS content" hello$ Goip password"password+$ send a sms to

HB@+-B..+-B... and HB@+-B..+-B..+.

MSG ++ < helloEn P6SSF#,D ++En P6SSF#,D ++ password+En S&9D ++En S&9D ++ + HB@+-B..+-B...En #5 ++ +En S&9D ++ 4 HB@+-B..+-B..+En F6 : ++ 4En S&9D ++ 4 HB@+-B..+-B..+En #5 ++ 4En

D#9& ++ En D#9& ++ En

4. RECEIVE SMS
Goip Sms Server

Data of received SMS

Server 6C5

Step 1.Send data of receiverSM S to Server.

Description When received SMS, Goip will relay the SMS to Server. Goip will resend the data if Server no response in 3 seconds, most resend 3 times. /ormat" RECEI E!"recvid#id!"id#password!"password#srcn$m!"srcn$m#ms%! "ms% 7ariable" "recvid!int, co$nt with the c$rrent time stamp decreasin%# "id! authentication id set in confi%uration pa%e. "password! authentication password set in confi%uration pa%e. "srcn$m! So$rce mo&ile n$m&er "ms%! Content of SMS$tf' format Sms server will receive SMS and chec+ the %oip id and password, then send a )C*. Successful /ormatRECEI E "recvid ,*-n Error .ormatRECEI E "recvid ERR,R "errms% 7ariable""recvid! int, the %oip co$nt# "errms%!error mass%e

(.Server )C*

&xample" 6ssume" 6 Goip)id"%oipid+$ password"password+ *received a SMS ' /$st a test( from mo&ile 01'2133134132256. )nd it %ot a co$nt 1(57185375, then will send to SMS Server li+e this! 6RECEI E!1(57185375#id!%oipid1#pass!password1#srcn$m!

1'213313413225#ms%!/$st a test6 Sms server chec+ %oip id and password, Saved the SMS data, and reply! 6RECEI E 1(57185375 ,*6

5. Get status of GoIP and control Goip. 5.1 Server send a command to Get status of GoIP or control Goip Server sho$ld resend pac+et several times when cannot receive reply from %oip. Goip sms server 1.command

(.ret$rn

5.1.1 Get GSM number


Step Description 1.server send /ormat" command to %et9%sm9n$m "sendid "password %et GSM n$m&er 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "password! :he re%istration password of G# P# (.Goip Goip ret$rn ,* /ormat! %et9%sm9n$m "sendid "%smn$m Error /ormat! ERR,R "sendid "errms%

7ariable" "sendid!the same as server pac+et# "%smn$m!GSM n$m&er# "errms%! strin% of error messa%e e.%! server send 0%et9%sm9n$m '58871 password16 Goip send 0%et9%sm9n$m '58871 13'7713'7776

5.1. Set GSM number


Step 1.server send Description /ormat" set9%sm9n$m "sendid "%smn$m "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "%smn$m!the %sm n$m&er which want to set "password! :he re%istration password of G# P# ,* /ormat! set9%sm9n$m "sendid "%smn$m o+ Error /ormat! ERR,R "sendid "%smn$m "errms% 7ariable" "sendid!the same as server pac+et# "%smn$m! the %sm n$m&er which want to set# "errms%! strin% of error messa%e#

(.Goip ret$rn

e.%. server send 0set9%sm9n$m '5887( 13'7713'771 password16 Goip ret$rn 0set9%sm9n$m '5887( 13'7713'771 o+6

5.1.! Get e"pir# time of out call of a c$annel


Step 1.server send Description /ormat" %et9e:p9time "sendid "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +#

(.Goip ret$rn

"password! :he re%istration password of G# P# ,* /ormat! %et9e:p9time "sendid "e:ptime Error .ormat! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "e:ptime! e:piry time of o$t call of a channel ;min$te<# "errms%! strin% of error messa%e#

5.1.4 Set e"pir# time of out call of a c$annel


Step 1.server send Description /ormat" set9e:p9time "sendid "e:ptime "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "e:ptime! e:piry time ;min$te< witch want to set "password! :he re%istration password of G# P# ,* .ormat! set9e:p9time "sendid "e:ptime o+ Error .ormat! ERR,R "sendid "e:ptime "errms% 7ariable" "sendid!the same as server pac+et# "e:ptime! e:piry time of o$t call of a channel ;min$te<# "errms%! strin% of error messa%e#

(.Goip ret$rn

5.1.5 Get Remain time of out call


Step 1.server send Description /ormat" %et9remain9time "sendid "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "password! :he re%istration password of G# P# ,* .ormat! %et9remain9time "sendid "remaintime Error .ormat! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "remaintime! remain time of o$t call;min$te< "errms%! strin% of error messa%e#

(.Goip ret$rn

5.1.% Reset remain time of out call to e"pir# time


Step 1.server send Description /ormat" reset9remain9time "sendid "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "password! :he re%istration password of G# P# ,* .ormat! reset9remain9time "sendid o+ Error .ormat! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "errms%! strin% of error messa%e#

(.Goip ret$rn

5.1.& Get status of c$annel


Step 1.server send Description /ormat" %et9%sm9state "sendid "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "password! :he re%istration password of G# P# ,* .ormat! %et9%sm9state "sendid "state Error .ormat! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "state! stat$s of linestrin%;I=>E or )C?I E< "errms%! strin% of error messa%e#

(.Goip ret$rn

5.1.' (rop call


Step 1.server send Description /ormat" svr9drop9call "sendid "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +#

(.Goip ret$rn

"password! :he re%istration password of G# P# GoI@ will try to drop the c$rrent call. ,* .ormat! svr9drop9call "sendid "o+ Error .ormat! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "errms%! strin% of error messa%e#

5.1.) Reboot c$annel


Step 1.server send Description /ormat" svr9re&oot9mod$le "sendid "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "password! :he re%istration password of G# P# Goip will try to re&oot channel ,* .ormat! svr9re&oot9mod$le "sendid "o+ Error .ormat! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "errms%! strin% of error messa%e#

(.Goip ret$rn

5.1.1* Reboot GoIP


Step 1.server send Description /ormat" svr9re&oot9dev "sendid "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "password! :he re%istration password of G# P# Goip will try to re&oot ,* .ormat! svr9re&oot9dev "sendid "o+ Error .ormat! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "errms%! strin% of error messa%e#

(.Goip ret$rn

5.1.11 Set GSM call for+ard


Step 1.server send Description

/ormat" C. "sendid "password "reason "mode "n$m "ftime 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "password! :he re%istration password of G# P# "reason! type of call forward. 7! $nconditional 1! &$sy (! noreply 3! noreacha&le, 4! all 3!&$sy,noreply,noreacha&le $mode: enable or disable forward3:enable4:disable $num: forward to this number "ftime! timeo$t ;second< of noreply forward type. ,ther types set to 7. (.Goip ret$rn Goip will try to set call forward. ,* .ormat! C.,* "sendid Error .ormat! C.ERR,R "sendid 3. server .ormat! ret$rn =,AE "sendid

5.

Goip send status to server

,$en status of Goip c$an-ed or -oip in a call Goip sends state to server

Goip

Server

1.stat$s

(.Server ret$rn

5. .1 ,$en status of c$annel of -oip c$an-ed. -oip send t$e status to server.
Step Description 1.Goip /ormat" send S?)?E!"recvid#id!"%oipid#password!"password#%sm9remain9state!"state stat$s of 7ariable" channel "recvid! !int, co$nt with the c$rrent time stamp decreasin%# "%oipid! authentication id set in confi%uration pa%e. "password! authentication password set in confi%uration pa%e. "state!Strin% of stat$s ;I=E>, BCSD< (.Server Goip ret$rn to %oip. ret$rn ,* format! S?)?E "recvid ,* Error format! S?)?E "recvid "errms% 7ariable" "recvid! the same as %oip send. "errms%! error messa%e, defined of yo$. e.% %oip send to server! S?)?E!532'#id!%oip1#password!password1#%sm9remain9state!I=>E Server ret$rn ! S?)?E 532' ,*

5. . ,$en Goip in a call. -oip send status of call to server


Step Description 1.Goip send /ormat! stat$s of call REC,R=!"recvid#id!"%oipid#password!"password#dir!"dir#n$m!"n$m

to server

(.Server ret$rn

7ariable" "recvid! int, co$nt with the c$rrent time stamp decreasin%# "%oipid! authentication id set in confi%uration pa%e. "password! authentication password set in confi%uration pa%e. "dir! intmeans direction of call. 1!IAC,MIAG(!,C?G,IAG Goip ret$rn to %oip. ,* format! REC,R= "recvid ,* Error format! REC,R= "recvid "errms% 7ariable" "recvid! the same as %oip send. "errms%! error messa%e, defined of yo$

e.% %oip send to server! REC,R=!5323#id!%oip(#password!password(#dir!(#n$m!177'2 Server ret$rn ! REC,R= 5323 ,*

5. .! after eac$ call .-oip send remain time to server.


Step 1.Goip send remain tiem Description /ormat! REM)IA!"recvid#id!"%oipid#password!"password#%sm9remain9time!"time 7ariable" "recvid! int, co$nt with the c$rrent time stamp decreasin%# "%oipid! authentication id set in confi%uration pa%e. "password! authentication password set in confi%uration pa%e. "time!remain time of a channel of o$t call, min$tes (.Server ,* format! REM)IA "recvid ,* Error format! REM)IA "recvid "errms% 7ariable" "recvid! the same as %oip send. "errms%! error messa%e, defined of yo$

%. Send /SS(
It can be used for recharging SIMS ( We need to recharge sims by sending EX: (*150*54 1!4!4"#!1$ .*150*54 1!4!4"#!1$/0 ' %a&&' (or a)i* +ust send ,SScommand

Goip

Server 1.$ssd command

(.ret$rn messa%e

Step Description 1.server send If server cannot receive clientEs answer for 17 seconds, resend $ssd command once. command /ormat" Common CSS= command CSS= "sendid "password "$ssdcmd E:it CSS= command CSS=EFI? "sendid "password 7ariable" "sendid! int, co$nt of the sendin% pac+ets increase by +# "password! :he re%istration password of G# P# "$ssdcmd! CSS= command Goip received the command , send the command to provider then rent$rn the reply to server .ormat! CSS= "sendid "ms% Error formatCSS=ERR,R "sendid "errms% CSS= disconnetedCSS=EFI? "sendid 7ariable "sendid! the same as server send# "ms%! the messa%e of provider ret$rn , $tf' code "errms%! error messa%e

(.Goip ret$rn

e.%. Server send to %oip 'USSD +++ password+ <<AI.++444.4;BI+.J( :hen %oip renturn to server 'USSD +++ Kou are %oin% to transfer +.... &GP to 4.++444.4;B. :he service fee is 4L with a minimum of ..4. &GP. Press + to confirm$ or any key to cancel(

&. IMEI &.1 Get IMEI


Step 1.server send Description /ormat" %et9imei "sendid "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "password! :he re%istration password of G# P# #5 /ormat" %et9imei "sendid "imei Error format! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "imei!IMEI n$m&er "errms%! strin% of error messa%e#

(.Goip ret$rn

&. Set IMEI


Step 1.server send Description /ormat! set9imei "sendid "imei "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +# "imei! IMEI n$m&er13 di%its. "password! :he re%istration password of G# P# #5 /ormat" set9imei "sendid "imei o+ Error format! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "imei!IMEI n$m&er "errms%! strin% of error messa%e#

(.Goip ret$rn

'. 0ut call interval '.1 Get out call interval


Step 1.server send Description /ormat!

(.Goip ret$rn

%et9o$t9call9interval "sendid "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +## "password! :he re%istration password of G# P# #5 /ormat" %et9o$t9call9interval "sendid "interval Error format! ERR,R "sendid "errms% 7ariable" "sendid!the same as server pac+et# "interval! o$t call interval ;second< "errms%! strin% of error messa%e#

'. Set out call interval


Step 1.server send Description /ormat! set9o$t9call9interval "sendid "interval "password 7ariable" "sendid! inte%er, the id of server pac+et increase by +## "interval! o$t call interval ;second< "password! :he re%istration password of G# P# ,* format! set9o$t9call9interval "sendid "interval o+ Error format! ERR,R "sendid "errms% 7ariable" sendid!the same as server pac+et# "interval! o$t call interval ;second< "errms%! strin% of error messa%e#

(.Goip ret$rn

) enable1disable module ).1 enable1disable t$is module


1.server '( ! " mod$le9ctl9i "sendid "val$e "password #$%& ) "sendid!**+, server ,$-./01 id2# "val$e! 1 34 7 34! "password!5 %oip 678$9:# (.Goip Goip ;<%&=:>/?$ @A'(mod$le9ctl9i "sendid "o+ B'(ERR,R "sendid "errms% ) "sendid!#

"errms%!?0C*+D

). enable1disable all modules


1.server ! E F#$% & '( mod$le9ctl "sendid "val$e "password ) "sendid!**+, server ,$-./01 id2# "val$e! 1 34 7 34! , ( 34GHIJK.* LM 171(71(1, 34N.K NOK! NPK N QKRNSK! NTK NUKRNVK "password!5 %oip 678$9:# Goip ;<%&=:>/?$ @A'(mod$le9ctl "sendid "o+ B'(ERR,R "sendid "errms% ) "sendid!# "errms%!?0C*+D

(.Goip

1*.WX 1*.1 WXY3


1.%oip Z '( W X Y CE>>S!"recvid#id!"id#password!"password#lists!"cell9list 3 % & [ ) \ #"password!5 %oip 67 "recvid!,G,I@ ]^ 8$9:# "id!5[\_7$ %oip $ id "password!5[\_7$ %oip $: "cell9list!WXY3JWX.**+D34 E,E` LM 1(3,432,5'8,17, (.[\ Sms server ;<0C= id Y3a$ id b:?$ @A'(CE>>S "recvid ,*-n B'(CE>>S "recvid ERR,R "errms% )"recvid!# "errms%!?0C

1*. 7WX

1.server '( 7 W X % set9&ase9cell "sendid "cell9id "password & ) "sendid!**+, server ,$-./01 id2# "cell9id! WX id "password!5 %oip 678$9:# c0C'(set9&ase9cell "sendid "cell9id o+ (.Goip ?'(ERR,R "sendid "errms% ) "sendid!# "cell9id! WX id "errms%!?0C*+D

1*.! dWXY3
1.server '( d W X Y %et9cells9list "sendid "password 3%& ) "sendid!**+, server ,$-./01 id2# "password!5 %oip 678$9:# (.Goip GoI@ d%&=c ,* 0Cefg?dWXY 3$h&i=gc= GoI@ j[\ 17.1 a$h & c0C'(%et9cells9list "sendid o+ ?'(ERR,R "sendid "errms% ) "sendid!# "errms%!?0C*+D

1*.4 d ^WX
1.server '( d ^ W CCRCE>> "sendid "password X$%& ) "sendid!**+, server ,$-./01 id2# "password!5 %oip 678$9:# c0C'(CCRCE>> "sendid "c$rcellid (.Goip ?'(ERR,R "sendid "errms% ) "sendid!# "c$rcellid! ^k $WX id

"errms%!?0C*+D