SMPP Data Coding Setter
Problem this snippet solves:
Hello, We have some platform that does not have flexible parameters for SMPP Data Coding (DC). When sending SMS from client platform to the SMS-C, it is important that the DC of the SMS text inside the SMPP PDU Field is supported by the SMS-C and defined in such a way that the SMSC is able to interpret it. Otherwise, all SMS may be dropped by the SMS-C server.
This iRule set the DataCoding to 0x00.
- SMSC default alphabet => DC=0x00 - CharSet:GSM - Length Max: 160
- LATIN-1 => DC=0x03 - CharSet: GSM - Length Max: 160
- UCS2 => DC=0x08 - CharSet: UCS2 - Length Max:70
Please consult the smpp v3.4 specification http://opensmpp.org/specs/smppv34_gsmumts_ig_v10.pdf
Code :
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
while { [TCP::payload length] > 16 } {
#Get header
binary scan [TCP::payload] IH8IIa* length operation status sequence p
#log local0. "Request: $operation"
if { [TCP::payload length] < $length } {
TCP::collect $length
return
}
switch -glob $operation {
00000004 {
# If submit_sm
set all [TCP::payload length]
#log local0. "Request: $operation - $all"
set p [string range $p [expr [string first \x00 $p]+1] end]
binary scan $p ccA* sourTon sourNpi p
#log local0. "Request: $operation - $sourTon - $sourNpi"
set p [string range $p [expr [string first \x00 $p]+1] end]
binary scan $p ccA* destTon destNpi p
#log local0. "Request: $operation - $destTon - $destNpi"
set p [string range $p [expr [string first \x00 $p]+1] end]
binary scan $p ccccA* esm protID pFlag schedTime p
#log local0. "Request: $operation - $esm - $protID - $pFlag - $schedTime"
set p [string range $p [expr [string first \x00 $p]+1] end]
binary scan $p cccA* registDel replIfPres dataCoding p
#log local0. "Request: $operation - $registDel - $replIfPres - $dataCoding "
set lastindexDCex [string length $p]
#log local0. "Request: $operation - $lastindexDCex "
set indexDC [expr {$all - $lastindexDCex - 1}]
#log local0. "Request: $operation - $indexDC "
TCP::payload replace $indexDC 1 [binary format c 0]
}
}
TCP::release $length
TCP::notify request
}
TCP::collect
}Published Jan 16, 2018
Version 1.0JJMan
Nimbostratus
Joined March 12, 2021
JJMan
Nimbostratus
Joined March 12, 2021
No CommentsBe the first to comment