Upload
hoang-dung
View
276
Download
1
Embed Size (px)
Citation preview
8/12/2019 USSD SOLUTION1.pdf
1/27
USSD Development Document
1
Mc lc
USSD DEVELOPMENT DOCUMENT ............................................................................................................... 2
1. Kin trc. ............................................................................................................................................... 2
2. Cc khi chc chc nng.
...................................................................................................................... 22.1 USSDGW. ......................................................................................................................................... 2
2.2 USSDS. ............................................................................................................................................. 4
2.3 USSDAlert. ....................................................................................................................................... 6
2.4 USSDMT........................................................................................................................................... 6
2.5 USSDDB Proxy. ................................................................................................................................ 6
2.6. USSD Report & Config. ................................................................................................................... 6
2.7 USSDA. ............................................................................................................................................. 6
3. Nguyn tc lm vic gia USSDS v USSDA. .......................................................................................... 7
3.1. Login, Logout, Handshake. ............................................................................................................. 7
3.2. ng dng khi to Session. .......................................................................................................... 13
3.3 Mobile Phone khi to session. .................................................................................................... 20
4. USSA Aplication ................................................................................................................................... 20
4.1. Context Processing Module. ........................................................................................................ 20
4.2. Mt sbin session built-in: ................................................................................................... 24
4.3. Mt shm builtin: ................................................................................................................. 254.4. Cc php ton trong kch bn: ................................................................................................ 27
8/12/2019 USSD SOLUTION1.pdf
2/27
USSD Development Document
2
USSD DEVELOPMENT DOCUMENT
1. Kin trc.
USSDC
USSDSUSSDGW
SS7 Card Driver USSDDBProxy
Report
USSDA
USSDAlert USSDMT
MSC/VLR, HLR
2. Cc khi chc chc nng.
2.1 USSDGW.
2.1.1 Kin trc.
8/12/2019 USSD SOLUTION1.pdf
3/27
USSD Development Document
3
USSDGW
USSDS
SS7 Card Driver
Text/GSM
Encode/Decode
MAP/TCAP
Encode/Decode
MAP/TCAP
Manager
USSDS
Interface
USSDMT-GW
USSDAlert-GW
USSDAlert
USSDMT
2.1.2 M t.
USSDGW l mt thnh phn quan trng ca USSDC, n c chc nng giao tipvi card SS7 v khi USSDS ca USSDC. ng thi cng c chc nng covertcc bn tin text vbn tin GSM, ng gi thnh phn ny v gi xung card vngc li.
SN Function Block Remarks
1 USSDSInterface
Giao din giao tip vi khi USSDS.Gi/nhn bn tin n / tUSSDS.
8/12/2019 USSD SOLUTION1.pdf
4/27
USSD Development Document
4
2 Text/GSMencode/decode.
M ha dliu text (ASCII/Unicode) thnhGSM v ngc li.
3 MAP/TCAP
Encode/decoder
ng gi v bc tch cc bn tinMAP/TCAP.
(*) iu ny hon ton ph thuc vodriver ca hang cung cp card SS7. Nna ra file cu hnh la chn.
4 MAP/TCAPManager
Giao tip vi card thng qua driver cacard. Nhn/ gi bn tin MAP/TCAP t/ ncard.
Qun l session(khng phi l ussdsession).
5 USSDMT-GW Giao tip vi khi USSDMT, cho phpchnh sa, theo di cc tham s caUSSDGW runtime.
6 USSDAlert-GW
Giao tip vi USSDAlert. Gi thng tincnh bo ti USSDAlert khi c cnh bo tcc thnh phn ca USSDGW
2.2 USSDS.2.2.1. Kin trc.
8/12/2019 USSD SOLUTION1.pdf
5/27
USSD Development Document
5
USSDS
USSDA
USSDGW
Session
Manager
USSDGW
Interface
USSDA
Gateway
USSDMT-GW
USS
DAlert-GW
USSDAlert
USSDMT
USSDDBProxy
2.2.2. M t.
SN Function Block Remarks
1 USSDA
Gateway
Thc cht y l mt socket server nhn ktni tcc client ca USSDA. N c nhim
v trung chuyn d liu t USSDA nSessionManager.
8/12/2019 USSD SOLUTION1.pdf
6/27
USSD Development Document
6
2 Session
Manager.
y c coi l trung tm ca USSDS. Baogm cc chc nng sau:
1. Qun l kt ni(Login, Logout, ).2. ng gi v unpack bn tin USSD.3. Qun l timeout.4. Qun l USSD session.5. Gi / nhn bn tin USSD n / t
USSDA-GW.
6. Gi nhn bn tin n t USSDGWthng qua USSDGW-Interface.
7. nh tuyn bn tin USSD.3 USSDMT-GW Ging phn trn.4 USSDAlert-
GWGing phn trn.
2.3 USSDAlert.
- Ghi ra log file.
- Cho php client connect vo theo di hot ng, cnh bo ca khi USSDC.
2.4 USSDMT.
- Cho php xem, sa gi tr, trng thi cc tham scc module ca USSDC.
2.5 USSDDB Proxy.
- Giao tip CSDL.
- Cung cp Interface cho USSDC c, ghi dliu tDB.
2.6. USSD Report & Config.
- Portal cho php xem lch sgiao dch, cu hnh bng nh tuyn dch v, user.
2.7 USSDA.
- Module xl kch bn cc dch vUSSD.
8/12/2019 USSD SOLUTION1.pdf
7/27
USSD Development Document
7
3. Nguyn tc lm vic gia USSDS v USSDA.
3.1. Login, Logout, Handshake.
3.1.1 Work Flow.
3.1.2. Nguyn tc lm vic.
SP gi bn tin BIND cha thng tin login ti USSDS ng nhp.
Nu thnh cng, n gi bn tin SHAKE gikt ni.
Gi bn tin UNBIND ngt kt ni.
Kt ni gia USSDS v USSDA sdng TCP/IP.
3.1.3. Cu trc cc bn tin.
3.1.3.1. Bn tin BIND
Field Size(byte)
Type Description Instance
HEADER
CommandLength
4 Integer Size of the entiremessage packet
57
USSDC SP
BIND
BIND_RESP
SHAKE
SHAKE_RESP
UNBIND
UNBIND_RESP
8/12/2019 USSD SOLUTION1.pdf
8/27
USSD Development Document
8
Field Size(byte)
Type Description Instance
CommandID 4 Integer Identifier of theUssdBindmessage,0x00000065
0x00000065
CommandStatus
4 Integer Message sendingresult, failure orsuccess
Not used in theUssdBindmessage, and setto Null
0
SenderCB 4 Integer Not used in theUssdBindmessage, and setto 0xFFFFFFFF
0xFFFFFFFF
ReceiverCB 4 Integer Not used in theUssdBindmessage, and setto 0xFFFFFFFF
0xFFFFFFFF
BODY
AccountName
11 C-OctetString
Login account of aservice application
SP
Password 9 C-OctetString
Login password ofa serviceapplication
123456
SystemType 13 C-OctetString
Reserved 0
InterfaceVersion
4 Integer Version of aninterface, 0x10 at
present
0x10
8/12/2019 USSD SOLUTION1.pdf
9/27
USSD Development Document
9
3.1.3.2 Bn tin BIND_RESPField Size
(byte)Type Description Instance
HEADER
CommandLength
4 Integer Size of the entiremessage packet
31
CommandID 4 Integer Identifier of theUssdBindRespmessage,
0x00000067
0x00000067
CommandStatus
4 Integer Message sendingresult, failure orsuccess
Not used in theUssdBindRespmessage, and setto Null
0
SenderCB 4 Integer Not used in the
UssdBindRespmessage, and setto 0xFFFFFFFF
0xFFFFFF
FF
ReceiverCB 4 Integer Not used in theUssdBindRespmessage, and setto 0xFFFFFFFF
0xFFFFFFFF
BODY
AccountName
11 C-OctetString
Login account ofa serviceapplication
SP
3.1.3.3 Bn tin SHAKE
8/12/2019 USSD SOLUTION1.pdf
10/27
USSD Development Document
10
Field Size (byte) Type Description Instance
HEADER
CommandLe
ngth
4 Integer Size of the
entiremessage
packet
20
CommandID 4 Integer Identifier oftheUssdShakemessage,0x00000083
0x00000083
CommandStatus
4 Integer Messagesendingresult, failureor success
Not used intheUssdShakemessage, andset to Null
0
SenderCB 4 Integer Not used intheUssdShakemessage, andset to0xFFFFFFFF
0xFFFFFFFF
ReceiverCB 4 Integer Not used intheUssdShake
message, andset to0xFFFFFFFF
0xFFFFFFFF
3.1.3.4 Bn tin SHAKE_RESP
8/12/2019 USSD SOLUTION1.pdf
11/27
USSD Development Document
11
Field Size (byte) Type Description Instance
HEADER
CommandLen
gth
4 Integer Size of the
entire messagepacket
20
CommandID 4 Integer Identifier oftheUssdShakeRes
p message,0x00000084
0x00000084
CommandStatus
4 Integer Messagesending result,failure orsuccess
Not used in theUssdShakeRes
p message, andset to Null
0
SenderCB 4 Integer Not used in theUssdShakeRes
p message, andset to0xFFFFFFFF
0xFFFFFFFF
ReceiverCB 4 Integer Not used in theUssdShakeRes
p message, andset to0xFFFFFFFF
0xFFFFFFFF
3.1.3.5 Bn tin UNBINDField Size
(byte)Type Description Instanc
e
HEADER
8/12/2019 USSD SOLUTION1.pdf
12/27
USSD Development Document
12
Field Size(byte)
Type Description Instance
CommandLength
4 Integer Size of the entiremessage packet
20
CommandID 4 Integer Identifier of theUssdUnBindmessage,0x00000066
0x00000066
CommandStatus 4 Integer Message sendingresult, failure orsuccess
Not used in the
UssdUnBindmessage, and setto Null
0
SenderCB 4 Integer Not used in theUssdUnBindmessage, and setto 0xFFFFFFFF
0xFFFFFFFF
ReceiverCB 4 Integer Not used in theUssdUnBindmessage, and setto 0xFFFFFFFF
0xFFFFFFFF
3.1.3.6 Bn tin UNBIND_RESPField Size
(byte)Type Description Instance
HEADER
CommandLength
4 Integer Size of the entiremessage packet
20
CommandID 4 Integer Identifier of theUssdUnBindRespmessage,0x00000068
0x00000068
8/12/2019 USSD SOLUTION1.pdf
13/27
USSD Development Document
13
CommandStatus
4 Integer Message sendingresult, failure orsuccess
Not used in the
UssdUnBindRespmessage, and setto Null
0
SenderCB 4 Integer Not used in theUssdUnBindRespmessage, and setto 0xFFFFFFFF
0xFFFFFFFF
ReceiverCB 4 Integer Not used in theUssdUnBindRespmessage, and setto 0xFFFFFFFF
0xFFFFFFFF
3.2. ng dng khi to Session.
3.2.1 Work Flow:USSDC SP
BIND
BIND_RESP
BEGIN
CONTINUE(Response)
UNBIND
UNBIND_RESP
CONTINUE(Notify)
CONTINUE(Response)
END(Release)
8/12/2019 USSD SOLUTION1.pdf
14/27
USSD Development Document
14
3.2.2. Nguyn tc lm vic.
Step 1 USSDA gi BEGIN (Request) hoc BEGIN (Notify) ti USSDC.Step 2 USSDA nhn CONTINUE (Response) tMS qua USSDS.Step 3 USSDA gi CONTINUE (Request) hoc CONTINUE (Notify) ti
USSDC.
Step 4 USSDA nhn CONTINUE (Response) tMS.Step 5 Lp li bc 2 v 3.Step 6 USSDA gi END (Release) ti USSDC kt thc phin lm vic.Step 7 Ch : Trong qu trnh lm vic USSDC c thgi ABORT kt
thc phin.
3.2.3. Cu trc cc bn tin.
3.2.3.1 Bn tin BEGIN.
Field Size(type)
Type Description Instance
HEADER
CommandLength
4 Integer Size of theentire message
packet
222
CommandID 4 Integer Identifier of theUssdBeginmessage,0x0000006F
0x0000006F
CommandStatus
4 Integer Messagesending result,failure or
successNot used in theUssdBeginmessage, and setto Null
0
SenderCB 4 Integer Session control 0x010000
8/12/2019 USSD SOLUTION1.pdf
15/27
USSD Development Document
15
Field Size(type)
Type Description Instance
identifier of theoriginator
03
ReceiverCB 4 Integer Not used in theUssdBeginmessage, and setto 0xFFFFFFFF
0xFFFFFFFF
BODY
UssdVersion 1 Integer USSD sessionversion number
0x20
UssdOpType 1 Integer USSD sessionoperating type
1
MsIsdn 21 C-OctetString
Number of amobile station
8613900271024
ServiceCode 4 C-OctetString
Service code ofthe USSDsession
It is not sethere. Thisfield isdefined inUssdString.
CodeScheme 1 Integer Coding schemeof the USSDstring
0x0F
UssdString Var. max182
OcetString
Informationcharacter stringof a USSD
session
@*101@
1. StockPrice
2. StockAnalysis
3. CityLife
4. Lottery
5. Living
8/12/2019 USSD SOLUTION1.pdf
16/27
USSD Development Document
16
Field Size(type)
Type Description Instance
Handbook
6. FashionLife
7.Entertainment
8. PublicInformation
9.
WonderfulWorld
*. Exit
3.2.3.2 Bn tin CONTINUE.
Field Size(type)
Type Description Instance
HEADER
CommandLength
4 Integer Size of theentire message
packet
49
CommandID 4 Integer Identifier of theUssdContinuemessage,0x00000070
0x00000070
CommandStatus 4 Integer Messagesending result,failure orsuccess
Not used in theUssdContinue
0
8/12/2019 USSD SOLUTION1.pdf
17/27
USSD Development Document
17
Field Size(type)
Type Description Instance
message, and setto Null
SenderCB 4 Integer Session controlidentifier of theoriginator
0x01000003
ReceiverCB 4 Integer Session controlidentifier of thereceiving party
0x01000003
BODY
UssdVersion 1 Integer Same as theidentifier of theUssdBeginmessage
0x20
UssdOpType 1 Integer Operation typeof a USSDsession
3
MsIsdn 21 C-OctetString
Number of amobile stationSame as that ofthe UssdBeginmessage
8613900271024
ServiceCode 4 C-OctetString
Service code ofa USSD sessionSame as that ofthe UssdBeginmessage
It is notset here.This fieldis definedinUssdString.
CodeScheme 1 Integer Coding schemeof the USSDcharacter string
0x44
UssdString Var. max Ocet Information 3
8/12/2019 USSD SOLUTION1.pdf
18/27
USSD Development Document
18
Field Size(type)
Type Description Instance
182 String character stringof a USSD
session
3.2.3.3 Bn tin END.
Field Size(type)
Type Description Instance
HEADER
CommandLength
4 Integer Size of the entiremessage packet
48
CommandID 4 Integer Identifier of theUssdEnd message,0x00000071
0x00000071
CommandStatus
4 Integer Message sendingresult, failure orsuccess
Not used in theUssdEnd message,and set to Null
0
SenderCB 4 Integer Session controlidentifier of theoriginator
0x01000003
ReceiverCB 4 Integer Session controlidentifier of thereceiving party
0x01000003
BODY
UssdVersion 1 Integer Same as theidentifier of theUssdBeginmessage
0x20
8/12/2019 USSD SOLUTION1.pdf
19/27
USSD Development Document
19
Field Size(type)
Type Description Instance
UssdOpType 1 Integer Operation type ofa USSD session
4
MsIsdn 21 C-OctetString
Number of amobile stationSame as that ofthe UssdBeginmessage
8613900271024
ServiceCode 4 C-OctetString
Service code of aUSSD sessionSame as that of
the UssdBeginmessage
Not sethere
CodeScheme 1 Integer Coding scheme ofthe USSDcharacter string
0x0F
UssdString Var. max182
OcetString
Informationcharacter string ofa USSD session
Not sethere
3.2.3.4 Bn tin ABORT.
Field Size(type)
Type Description Instance
HEADER
CommandLength
4 Integer Size of the entiremessage packet
20
CommandID 4 Integer Identifier of theUssdAbortmessage,0x00000072
0x00000072
CommandStat 4 Integer Message sending 54
8/12/2019 USSD SOLUTION1.pdf
20/27
USSD Development Document
20
Field Size(type)
Type Description Instance
us result, failure orsuccess
Not used in theUssdAbortmessage, and setto Null
SenderCB 4 Integer Session controlidentifier of theoriginator. If thereis no sessioncontrol identifier
of the originator,set the parameterto 0xFFFFFFFF.
0x01000013
ReceiverCB 4 Integer Session controlidentifier of thereceiving party. Ifthere is no sessioncontrol identifierof the receiving
party, set theparameter to0xFFFFFFFF.
0x01000007
3.3 Mobile Phone khi to session.
Tng tnh trn.
4. USSA Aplication
4.1. Context Processing Module.
4.1.1. Flow
8/12/2019 USSD SOLUTION1.pdf
21/27
USSD Development Document
21
4.1.2. Cc khi nim.
- Context:L mt on kch bn c vit trong tp tin cu hnh. c vittheo ngn ngm tkch bn. Context bao gm tn kch bn c t trongcp ngoc vung [] v cc extensions. Tn kch bn khng cha cc khongtrng.
- Extensions:L mt dy cc k t, sm ttng tc ca ngi dng nhbm phm hoc ca tng i. Extensions bt u sau tin texten =>. Mt
Extensions c th c mt hoc nhiu priority (bc thc hin) nhm thchin p ng ca tng i i vi tng tc ca ngi dng.
- Priority:Thtthc hin cc p ng ca tng i vi yu cu ca ngidng. Lun c bt u bng 1, tip theo c thl shoc n (= next: Vtrtip theo ca on trc ).
- Function:Chc nng m ngi qun tryu cu tng i p ng yu cu
ngi dng.
- Param:Tham struyn vo Function.
- Label:Nhn nh du mt vtr trong 1 Extensions.
8/12/2019 USSD SOLUTION1.pdf
22/27
USSD Development Document
22
- Extensions_Match:L cc k hiu i din cho mt tp cc hnh ngca ngi dng.X: St0-9.Z: St1-9.
N: St2-9.s: Chui null.. : Bqua phn sau .
_: Bt u bng.h: i in cho event kt thc cuc gi.i: i din cho event sai extension.
4.1.3.Cu trc mt on kch bn:[Context]
exten => extension1, priority1 (label),function()
exten => extension2, priority1 (label),function()
.
4.1.4.Kch bn mu:Yu cu:Vit mt on kch bn cho tng i *101#. Khi ngi dng bm *101# strvmt on text menu: Bm phm 1, bit thng tin vthi tit. Bm
phm 2, bit thng tin v chng khon.. Nu bm sai phm s tr vthng tin Phm bm khng ng. Nu ngi dng khng bm phm th ktthc session.
Cu hnh nh sau:[*101#]
exten => s,1,Send(Bm phm 1, bit thng tin vthi tit. Bm phm 2,bit thng tin vchng khon.)
exten =>s,n, Hangup() ; Ngi dng khng bm phm.
exten =>1,1,Goto(101_1,s,1) ; Ngi dng bm phm 1.
8/12/2019 USSD SOLUTION1.pdf
23/27
USSD Development Document
23
exetn =>2,1,Goto(101_2,s,1) ; Ngi dng bm phm 2.
exten => i,1, Send(Phm bm khng ng) ; Event sai phm bm.
exten =>h,1,InsertDB() ; Event Hangup
4.1.5.C sdliu:
4.1.6.Giao din cc module.
8/12/2019 USSD SOLUTION1.pdf
24/27
USSD Development Document
24
- Module qun tr cu hnh:
4.2. Mt sbin session built-in:4.2.1.MSISDN.
Cch dng trong kch bn:
exten=> s,1,SET(PhoneNumber=${MSISDN})USSDA: Tng to thm mt bin c tn l PhoneNumber, gn gitrca bin MSISDN cho bin PhoneNumber.
4.2.2.SERVICECODE.Cha gi trServiceCode: 101, 102, 999.Cch dng ging nh MSISDN.
4.2.3.DATETIME.Gi trthi gian hin ti.Format: DD: MM: YYYY HH24:MI:SS.
4.2.4.SESSIONID.ID ca session hin ti.
8/12/2019 USSD SOLUTION1.pdf
25/27
USSD Development Document
25
4.2.5.CONTEXT.Context hin ti.
4.2.6.EXTEN.Extension hin ti.
4.2.7.PRIORITY.Priority hin ti.
4.2.8.SESSION.Gi trca session hin ti. (Con trtrti session). Dng truy cp
cc thnh phn ca session. C thtng ng vi SESSION_ID.
4.2.9.REASON.L do kt thc session.
Ch : Tt ccc bin u c gi tr/ ni dung l chui.
Bsung sau, cho ph hp
4.3. Mt shm builtin:4.3.1. Goto:
Goto(Priority): Nhy n vtr Priority trong cng Context, Extension.Goto(Extension,Priority): Nhy n vtr Extension,Priority trong cngContext.
Goto(Context,Extension,Priority): Nhy n vtr chnh.
4.3.2. Send:
Send(Text message)Gi n thu bao mt on text.Ch :
+ Sdng k t\n thay cho xung dng.
8/12/2019 USSD SOLUTION1.pdf
26/27
USSD Development Document
26
+ Khi gi n hm ny, tin trnh xl kch bn phi bblock, ngha lkhng thc hin lnh tip theo trong kch bn cho n khi c event xyra.
4.3.3. Hangup:Hangup(Text message).Khi gi n hm ny, ng ngha vic gi bn tin END n USSDS. Nutn ti extension h trong kch bn, event hangup c gi ngay sau khi
bn tin END c gi n USSDS. Khi thc hin ht on kch bntrong event h, mi c gii phng session.
4.3.4. Set:
Set(variable=value).To ra 1 bin variable nu cha tn ti, gn gi trvalue cho bin ny.
4.3.5. Len:
Len(variable)
Trvdi ni dung ca mt bin.Ex: exten => s,1,SET(len=Len(${MSISDN}))
4.3.6. GotoIf:
GotoIf(condition?label1[[:label2])GotoIf(condition?[context1],[extension1],[priority1]:[context2],[extension2],[priority2]).Ging goto nhng ch thc hin viiu kin c ch nh.
Nu khng ch nh context2, extension2, priority2 khi iu kin sai, schuyn xung priority k tip.
ex: exten => 206,n,GotoIf($["${MSISDN}" != "304"]?moh:dial2)
4.3.7. Wait:Wait(n): Block session in n seconds.
Cn li bsung sau
8/12/2019 USSD SOLUTION1.pdf
27/27
USSD Development Document
4.4. Cc php ton trong kch bn:-: Thc hin tr2 snguyn nu convert c 2 bin ra 2 s.+: Thc hin + 2 snguyn nu convert c 2 bin ra 2 s.*: Thc hin nhn 2 snguyn nu convert c ra s./:
>
=: Sv chui.=: Ss,1,SET(aid=${MSISDN}-${SESIONID})
8491234567-3389.Ct chui:${variable:start:len}
Ct chui variable tvtr start, c di len k t. Ch : Nu start < 0,th tnh ngc tcui v.ex:${123456789:1} - returns the string 23456789
${123456789:-4} - returns the string 6789
${123456789:0:3} - returns the string 123
${123456789:2:3} - returns the string 345
${123456789:-4:3} - returns the string 678V d:exten=> s,1,SET(len=Len(${MSISDN})
exten=> s,n(loop),GotoIf($[${len}=0]?done)exten=> s,n,SET(len= ${len}-1)
exten =>s, n,Goto(loop)
exten=> s,n(done),Send(OK)