Re: sending too fast to SMPP SMSC?

Kita Ndara <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
I don't seem to be able to apply this patch to the cvs
set, could you provide one that is based on a diff
with the current set?

Thanks.


 --- Benjamin Lee <[email protected]> wrote: >
Find attached my patch for SMPP bits and pieces.
> It is a combined patch (sorry) including:
> 
> 1.  configurable TON and NPI (modified from Alex
> Judd>
> 
> 2.  unbind when shutting down
> 
> 3.  configurable default priority for SMS messages
> 
> 4.  configurable throughput to limit (throttle)
> sending SMS rate to SMPP SMSC
> 
> 5.  Makefile.in changes, added install -d
> $(DESTDIR)$(... etc...
>     facilitating consistent builds using RPM
> non-root)
> 
> 
> (I apologise for some of the spacing differences...)
> 
> 
> On Thursday, 2002-03-21 at 08:43:56 AM, Benjamin Lee
> scribbled:
> > Well, actually nothing smart... we were sleeping
> when we received a
> > THROTTLE off packet from the SMSC but this
> behaviour isn't actually
> > specified in the protocol as far as I know; and
> such a sleep may or may not
> > help with the connection to the SMSC.
> > 
> > The throughtput is set in the .conf file with:
> > 
> > throughput = 20
> > 
> > 20 being 20 messages per second.
> > 
> > On Wednesday, 2002-03-20 at 11:26:05 PM, Kita
> Ndara scribbled:
> > > What's the principle? Do you detect certain
> types of
> > > errors and re-queue? I can do some testing on my
> end
> > > too, see if it helps more generally.
> > > 
> > > Let's see it!
> > > 
> > > Thanks.
> > > 
> > >  --- Benjamin Lee <[email protected]>
> wrote: > I
> > > finally got around to doing a throughput patch
> for
> > > > SMPP... I'll post it
> > > > shortly.
> > > > 
> > > > On Wednesday, 2002-03-20 at 10:29:26 PM, Kita
> Ndara
> > > > scribbled:
> > > > > Hi  
> > > > >  I have another issue. When I use kannel to
> > > > originate
> > > > > messages to many phone numbers, sometimes
> the SMSC
> > > > > (Comverse) returns errors and rejects some
> of the
> > > > > messages. If I slow down the rate at which
> I'm
> > > > > submitting the messages to the SMSC, then it
> works
> > > > > fine. Is there a way for kannel to kind of
> > > > > automatically back off from sending too fast
> in
> > > > such
> > > > > cases?
> > > > > 
> > > > > Thanks.
> > > > > 
> > > > > =====
> > > > > Bruce Ndara
> > > > > York Messaging
> > > > > 
> > > > >
> __________________________________________________
> > > > > Do You Yahoo!?
> > > > > Everything you'll ever need on one web page
> > > > > from News and Sport to Email and Music
> Charts
> > > > > http://uk.my.yahoo.com
> > > > 
> > > > -- 
> > > > Benjamin Lee
> > > > 
> > > > 71-75 City Rd, South Melbourne, VIC 3006
> Australia 
> > > > http://www.dotwap.com/
> > > > Phone +61 3 9698 1840  Mobile +61 414 717 573 
> Fax
> > > > +61 3 9698 1841 
> > > 
> > >
> __________________________________________________
> > > Do You Yahoo!?
> > > Everything you'll ever need on one web page
> > > from News and Sport to Email and Music Charts
> > > http://uk.my.yahoo.com
> > 
> > -- 
> > Benjamin Lee
> > 
> > 71-75 City Rd, South Melbourne, VIC 3006 Australia
>  http://www.dotwap.com/
> > Phone +61 3 9698 1840  Mobile +61 414 717 573  Fax
> +61 3 9698 1841
> 
> -- 
> Benjamin Lee
> 
> 71-75 City Rd, South Melbourne, VIC 3006 Australia 
> http://www.dotwap.com/
> Phone +61 3 9698 1840  Mobile +61 414 717 573  Fax
> +61 3 9698 1841
> > Index: Makefile.in
>
===================================================================
> RCS file: /home/cvs/gateway/Makefile.in,v
> retrieving revision 1.56
> diff -u -r1.56 Makefile.in
> --- Makefile.in	23 Jan 2002 18:33:00 -0000	1.56
> +++ Makefile.in	22 Mar 2002 04:12:46 -0000
> @@ -228,12 +228,12 @@
>  dummy:
>  
>  install: all
> -	$(INSTALL) -d $(bindir)
> +	$(INSTALL) -d $(DESTDIR)$(bindir)
>  	for prog in $(binprogs); do \
>  		$(INSTALL) $$prog \
>  		    $(DESTDIR)$(bindir)/`basename
> $$prog`$(suffix); \
>  	done
> -	$(INSTALL) -d $(sbindir)
> +	$(INSTALL) -d $(DESTDIR)$(sbindir)
>  	for prog in $(sbinprogs); do \
>  		$(INSTALL) $$prog \
>  		    $(DESTDIR)$(sbindir)/`basename
> $$prog`$(suffix); \
> Index: gw/smpp_pdu.def
>
===================================================================
> RCS file: /home/cvs/gateway/gw/smpp_pdu.def,v
> retrieving revision 1.3
> diff -u -r1.3 smpp_pdu.def
> --- gw/smpp_pdu.def	8 Nov 2001 08:41:23 -0000	1.3
> +++ gw/smpp_pdu.def	22 Mar 2002 04:12:48 -0000
> @@ -162,6 +162,10 @@
>      HEADER
>  )
>  
> +PDU(generic_nack_resp,
> +    0x80000000,
> +    HEADER
> +)
>  
>  #undef PDU
>  #undef INTEGER
> Index: gw/smsc_smpp.c
>
===================================================================
> RCS file: /home/cvs/gateway/gw/smsc_smpp.c,v
> retrieving revision 1.51
> diff -u -r1.51 smsc_smpp.c
> --- gw/smsc_smpp.c	29 Jan 2002 21:38:36 -0000	1.51
> +++ gw/smsc_smpp.c	22 Mar 2002 04:12:48 -0000
> @@ -70,6 +70,12 @@
>      Octstr *username;
>      Octstr *password;
>      Octstr *address_range;
> +    int source_addr_ton;
> +    int source_addr_npi;
> +    int dest_addr_ton;
> +    int dest_addr_npi;
> +    int throughput;     /* limit sending rate */
> +    int priority;       /* set default priority for
> messages */
>      int transmit_port;
>      int receive_port;
>      int quitting;
> @@ -80,7 +86,10 @@
>  static SMPP *smpp_create(SMSCConn *conn, Octstr
> *host, int transmit_port, 
>      	    	    	 int receive_port, Octstr
> *system_type, 
>  			 Octstr *username, Octstr *password,
> -    	    	    	 Octstr *address_range)
> +    	    	    	 Octstr *address_range, int
> source_addr_ton,
> +                         int source_addr_npi, int
> dest_addr_ton,
> +                         int dest_addr_npi,
> +                         int throughput, int
> priority)
>  {
>      SMPP *smpp;
>      
> @@ -97,6 +106,14 @@
>      smpp->username = octstr_duplicate(username);
>      smpp->password = octstr_duplicate(password);
>      smpp->address_range =
> octstr_duplicate(address_range);
> +    smpp->source_addr_ton = source_addr_ton;
> +    smpp->source_addr_npi = source_addr_npi;
> +    smpp->dest_addr_ton = dest_addr_ton;
> +    smpp->dest_addr_npi = dest_addr_npi;
> +    
> +    smpp->throughput = throughput;
> +    smpp->priority = priority;
> +    
>      smpp->transmit_port = transmit_port;
>      smpp->receive_port = receive_port;
>      smpp->quitting = 0;
> @@ -207,33 +224,45 @@
>      pdu = smpp_pdu_create(submit_sm, 
>      	    	    	 
> counter_increase(smpp->message_id_counter));
>      	    	   
> -    pdu->u.submit_sm.dest_addr_ton =
> GSM_ADDR_TON_NATIONAL; /* national */
> -    pdu->u.submit_sm.source_addr_ton =
> GSM_ADDR_TON_NATIONAL; /* national */
> -    pdu->u.submit_sm.source_addr_npi =
> GSM_ADDR_NPI_E164; /* ISDN number plan */
> -    pdu->u.submit_sm.dest_addr_npi =
> GSM_ADDR_NPI_E164; /* ISDN number plan */
> -    
>      pdu->u.submit_sm.source_addr =
> octstr_duplicate(msg->sms.sender);
>      pdu->u.submit_sm.destination_addr =
> octstr_duplicate(msg->sms.receiver);
> +
> +    /* Check for manual override of source ton and
> npi values */
> +    if(smpp->source_addr_ton > -1 &&
> smpp->source_addr_npi > -1) {
> +        pdu->u.submit_sm.source_addr_ton =
> smpp->source_addr_ton;
> +        pdu->u.submit_sm.source_addr_npi =
> smpp->source_addr_npi;
> +    } else {
> +        pdu->u.submit_sm.source_addr_ton =
> GSM_ADDR_TON_NATIONAL; /* national */
> +        pdu->u.submit_sm.source_addr_npi =
> GSM_ADDR_NPI_E164; /* ISDN number plan */
>   
> -    /* lets see if its international or
> alphanumeric sender */
> -    if(
> octstr_get_char(pdu->u.submit_sm.source_addr,0) ==
> '+') {
> -        if
> (!octstr_check_range(pdu->u.submit_sm.source_addr,
> 1, 256, gw_isdigit)) {
> -     	    pdu->u.submit_sm.source_addr_ton =
> GSM_ADDR_TON_ALPHANUMERIC; /* alphanum */
> -   	    pdu->u.submit_sm.source_addr_npi =
> GSM_ADDR_NPI_UNKNOWN;
> -    	}
> -        else {
> -	    /* numeric sender address with + in front ->
> international*/
> -	   
> octstr_delete(pdu->u.submit_sm.source_addr,0,1);
> -           pdu->u.submit_sm.source_addr_ton =
> GSM_ADDR_TON_INTERNATIONAL;
> -	}
> -    }
> -    else    {
> -	if
> (!octstr_check_range(pdu->u.submit_sm.source_addr,0,
> 256, gw_isdigit)) {
> -   	    pdu->u.submit_sm.source_addr_ton =
> GSM_ADDR_TON_ALPHANUMERIC;
> -   	    pdu->u.submit_sm.source_addr_npi =
> GSM_ADDR_NPI_UNKNOWN;
> -   	}
> +        /* lets see if its international or
> alphanumeric sender */
> +        if(
> octstr_get_char(pdu->u.submit_sm.source_addr,0) ==
> '+') {
> +            if
> (!octstr_check_range(pdu->u.submit_sm.source_addr,
> 1, 256, gw_isdigit)) {
> +     	        pdu->u.submit_sm.source_addr_ton =
> GSM_ADDR_TON_ALPHANUMERIC; /* alphanum */
> +   	        pdu->u.submit_sm.source_addr_npi =
> GSM_ADDR_NPI_UNKNOWN;
> +        	}
> +            else {
> +	        /* numeric sender address with + in front
> -> international*/
> +	       
> octstr_delete(pdu->u.submit_sm.source_addr,0,1);
> +               pdu->u.submit_sm.source_addr_ton =
> GSM_ADDR_TON_INTERNATIONAL;
> +    	    }
> +        }
> +        else    {
> +    	    if
> (!octstr_check_range(pdu->u.submit_sm.source_addr,0,
> 256, gw_isdigit)) {
> +   	        pdu->u.submit_sm.source_addr_ton =
> GSM_ADDR_TON_ALPHANUMERIC;
> +   	        pdu->u.submit_sm.source_addr_npi =
> GSM_ADDR_NPI_UNKNOWN;
> +   	    }
> +        }
> +    } 
> +
> +    /* Check for manual override of destination ton
> and npi values */
> +    if(smpp->dest_addr_ton > -1 &&
> smpp->dest_addr_npi > -1) {
> +        pdu->u.submit_sm.dest_addr_ton =
> smpp->dest_addr_ton;
> +        pdu->u.submit_sm.dest_addr_npi =
> smpp->dest_addr_npi;
> 
=== message truncated === 

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.