@@ -112,21 +112,34 @@ def SendMessages(self):
112112 self .sendMessage (sphone , dphone , message )
113113 self .lock .release ()
114114
115- def sendMessage (self , sphone , tphone , message ):
115+ def sendMessage (self , sphone , tphone , message , op = 'tele2' ):
116116 from . import gsm
117+ cfg = dict ()
118+
119+ nonums = "" .join (filter (lambda x : not x .isdigit (), sphone ))
120+
121+ if len (nonums )> 0 :
122+ cfg ['source_addr_ton' ] = consts .SMPP_TON_ALNUM
123+ cfg ['source_addr_npi' ] = consts .SMPP_TON_UNK
124+ cfg ['dest_addr_ton' ] = consts .SMPP_TON_INTL
125+ cfg ['dest_addr_npi' ] = consts .SMPP_NPI_ISDN
126+ else :
127+ cfg ['source_addr_ton' ]= consts .SMPP_TON_NWSPEC
128+ cfg ['source_addr_npi' ] = consts .SMPP_NPI_ISDN
129+ cfg ['dest_addr_ton' ] = consts .SMPP_TON_NATNL
130+ cfg ['dest_addr_npi' ] = consts .SMPP_NPI_ISDN
117131
118132 try :
119133 parts , encoding_flag , msg_type_flag = gsm .make_parts (message )
120134
121135 for part in parts :
122136 pdu = self .send_message (
123137
124- source_addr_ton = consts . SMPP_TON_NWSPEC ,
125- source_addr_npi = consts . SMPP_NPI_ISDN ,
138+ source_addr_ton = cfg [ 'source_addr_ton' ] ,
139+ source_addr_npi = cfg [ 'source_addr_npi' ] ,
126140 source_addr = sphone , # '1591',
127-
128- dest_addr_ton = consts .SMPP_TON_NATNL ,
129- dest_addr_npi = consts .SMPP_NPI_ISDN ,
141+ dest_addr_ton = cfg ['dest_addr_ton' ],
142+ dest_addr_npi = cfg ['dest_addr_npi' ],
130143 # Make sure thease two params are byte strings, not unicode:
131144 destination_addr = tphone ,
132145 short_message = part ,
0 commit comments