Forum Discussion
Pavel_70776
Mar 02, 2012Nimbostratus
Balancing SMPP traffic based on recipient address
Hello,
we have an application sending SMS via SMPP and we need to balance the SMS messages based on recipient address to 2 different SMS Centres. SMS with recipient address starting 420 should go to SMSC1 and the rest of SMS's should go to SMSC2. Note that application creates one TCP session and throught this session sends multiple SMS, one SMS is in one TCP packet or more SMS can be placed in one TCP packet.
Thanks
- Michael_YatesNimbostratusHi Pavel,
- Pavel_70776NimbostratusHi,
- Nat_ThirasuttakornEmployeeHi Pavel,
- Pavel_70776NimbostratusHi Nat,
- Nat_ThirasuttakornEmployeeHi Pavel,
when CLIENT_ACCEPTED { set s_seq_idx 1 set first_bind_resp 1 set smsc1 10.10.10.1 set smsc2 10.10.10.2 TCP::collect } when CLIENT_DATA { while { [TCP::payload length] > 16 } { binary scan [TCP::payload] IH8IIa* len oper status seq p if { [TCP::payload length] < $len } { TCP::collect $len return } switch -glob $oper { 00000002 { set bind_message [TCP::payload $len] } 00000004 { submit_sm set p [string range $p [expr [string first \x00 $p]+1] end] binary scan $p cca* ston snpi p set p [string range $p [expr [string first \x00 $p]+1] end] binary scan $p ccA* dton dnpi p set dest [getfield $p \x00 1] if { $dest starts_with 420 } { use pool or node command pool [LB::server pool] member $smsc1 9000 } else { pool [LB::server pool] member $smsc2 9000 } } 8* { rewrite seq if { [info exists s_seq_map($seq)] } { set old_seq [lindex $s_seq_map($seq) 0] TCP::payload replace 12 4 [binary format I $s_seq_idx] set addr [lindex $s_seq_map($seq) 1] set port [lindex $s_seq_map($seq) 2] use pool or node command pool [LB::server pool] member $addr $port unset s_seq_map($seq) } } } TCP::release $len TCP::notify request } TCP::collect } when SERVER_CONNECTED { if { $first_bind_resp } { TCP::collect } else { TCP::collect -all TCP::respond $bind_message } } when SERVER_DATA { while { [TCP::payload length] > 16 } { binary scan [TCP::payload] IH8II len oper status seq if { [TCP::payload length] < $len } { TCP::collect $len return } switch -glob $oper { 0* { rewrite seq TCP::payload replace 12 4 [binary format I $s_seq_idx] set s_seq_map($s_seq_idx) "$seq [IP::remote_addr] [TCP::remote_port]" incr s_seq_idx } 80000002 { bind response if { $first_bind_resp } { set first_bind_resp 0 } else { TCP::payload replace 0 [TCP::payload length] "" set len 0 } } } TCP::release $len TCP::notify response } TCP::collect }
- Nat_ThirasuttakornEmployeeummm... i think this line
while { [TCP::payload length] > 16 } {
while { [TCP::payload length] >= 16 } {
- Pavel_70776NimbostratusHi Nat,
- Nat_ThirasuttakornEmployeeHi Pavel,
- Pavel_70776NimbostratusHi Nat,
- Nat_ThirasuttakornEmployeeHi Pavel,
Recent Discussions
Related Content
Â
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects