https://launchpad.net/ucplib

EMI - UCP interface specification v4.6 with ucplib

Setup

First we need to import the UcpMsg form the library >>> from ucplib import UcpMsg

General examples

The SMT sends a message to the SMSC with text “hello” in the GSM 7-bit alphabet. Note that “hello” in ASCII has the same encoding.

‘49/00078/O/51/0031612345678/55555/////////////////3//68656C6C6F/////////////0D’

Specific types

Type 01 messages

Operation

Alphanumeric message ‘Short Message’ to receiver 01234567890 from sender 09876543210

>>> msg = UcpMsg( o_r=“O”, ot=01, adc=“01234567890”, oadc=“09876543210”, mt=3, amsg=u“Short Message”) >>> print msg 00/00070/O/01/01234567890/09876543210//3/53686F7274204D657373616765/D9

Now let’s try to parse the message and see if wo obtain the same result

>>> print UcpMsg(‘x0200/00070/O/01/01234567890/09876543210//3/53686F7274204D657373616765/D9x03’) 00/00070/O/01/01234567890/09876543210//3/53686F7274204D657373616765/D9

Now we create a numeric message ‘716436383334’

>>> print UcpMsg(o_r=“O”, ot=01, adc=“0888444”, mt=2, nmsg=“716436383334”) 00/00041/O/01/0888444///2/716436383334/C5

>>> print UcpMsg(‘x0200/00041/O/01/0888444///2/716436383334/C5x03’) 00/00041/O/01/0888444///2/716436383334/C5

Response

Positive Result

>>> print UcpMsg(o_r=“R”, ot=01, trn=6, ack=“A”, sm=“01234567890:090196103258”) 06/00043/R/01/A/01234567890:090196103258/4E

>>> print UcpMsg(‘x0206/00043/R/01/A/01234567890:090196103258/4Ex03’) 06/00043/R/01/A/01234567890:090196103258/4E

Negative Result

>>> print UcpMsg(o_r=“R”, ot=01, trn=12, nack=“N”, ec=2) 12/00022/R/01/N/02//03

>>> print UcpMsg(‘x0212/00022/R/01/N/02//03x03’) 12/00022/R/01/N/02//03

Type 02 messages

Operation

Alphanumeric message ‘SMSC’ to 3 subscribers

>>> print UcpMsg(o_r=“O”, ot=02, trn=5, npl=“3”, rads=[“01111”,“02222”,“03333”], oadc=“0123456789”, mt=“3”, amsg=“SMSC”) 05/00059/O/02/3/01111/02222/03333/0123456789//3/534D5343/52

>>> print UcpMsg(‘x0205/00059/O/02/3/01111/02222/03333/0123456789//3/534D5343/52x03’) 05/00059/O/02/3/01111/02222/03333/0123456789//3/534D5343/52

Numeric message ‘563444’ to 5 subscribers

>>> print UcpMsg(o_r=“O”, ot=02, trn=17, npl=5, rads=[“01111”,“02222”,“03333”,“04444”,“05555”], oadc=“0123456789”, mt=2, nmsg=“563444”) 17/00069/O/02/5/01111/02222/03333/04444/05555/0123456789//2/563444/44

>>> print UcpMsg(‘x0217/00069/O/02/5/01111/02222/03333/04444/05555/0123456789//2/563444/44x03’) 17/00069/O/02/5/01111/02222/03333/04444/05555/0123456789//2/563444/44

Response

Positive Result

>>> print UcpMsg(o_r=“R”, ot=02, trn=82, ack=“A”, sm=“0654321:090196113940,065432:090196113940”) 82/00059/R/02/A/0654321:090196113940,0