Source address auto detect for short code

Ahmed Shabana <[email protected]> Wed, 14 Oct 2015 12:20:13 +0000
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <HE1PR07MB11800AF6A4BE8947493FC515F63F0@HE1PR07MB1180.eurprd07.prod.outlook.com>
Dears at kannel devel mailing list ,


    Have a nice day ,


Some of our SMPP SMSC provider ( specially Orange ) , claim that submitting short code sender for MT SMSs must be follow below npi & ton value


I add below patch , and it working well . feel free to commit it to the trunk if you need , or keep it in the mail list as a reference for others .




Index: gw/smsc/smsc_smpp.c

===================================================================

--- gw/smsc/smsc_smpp.c (revision 5110)

+++ gw/smsc/smsc_smpp.c (working copy)

@@ -82,6 +82,8 @@

 #include "load.h"


  #define SMPP_DEFAULT_CHARSET "UTF-8"

  +#define SHORT_CODE_MAX_LEN 0x06

  +#define SHORT_CODE_MIN_LEN 0x04


   /*

     * Select these based on whether you want to dump SMPP PDUs as they are

@@ -892,8 +894,11 @@

                      } else if (charset_convert(pdu->u.submit_sm.source_addr, SMPP_DEFAULT_CHARSET, octstr_get_cstr(smpp->alt_addr_charset)) != 0)

                          error(0, "Failed to convert source_addr from charset <%s> to <%s>, will send as is.",

                                    SMPP_DEFAULT_CHARSET, octstr_get_cstr(smpp->alt_addr_charset));

-                }

-            }

+                }

+            }else if(octstr_len(pdu->u.submit_sm.source_addr) < SHORT_CODE_MAX_LEN && octstr_len(pdu->u.submit_sm.source_addr) > SHORT_CODE_MIN_LEN){

+                               pdu->u.submit_sm.source_addr_ton = GSM_ADDR_TON_ABBREVIATED ;

+                                pdu->u.submit_sm.source_addr_npi = GSM_ADDR_NPI_UNKNOWN ;

+                       }

        }

      }