Re: [PATH] Final diff to make esm_class configurable form config file

"Nikos Balkanas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <000501c9aac8$4e13c770$02b2a8c0@tardis>
Hi,

Assuming that it is needed, it looks safe. Just assigning a configurable 
value to prexisting logic and code.

+1

BR,
Nikos
----- Original Message ----- 
From: "Alvaro Talavera" <[email protected]>
To: <[email protected]>
Sent: Sunday, March 22, 2009 6:51 AM
Subject: [PATH] Final diff to make esm_class configurable form config file


> The config group for smsc looks like this:
>
> group = smsc
> smsc = smpp
> host = "xxxxxx"
> port = "xxxx"
> smsc-id = "xxxxx"
> throughput = 40
> denied-smsc-id = "*"
> allowed-smsc-id = "xxxxx"
> smsc-username = "xxxxxx"
> smsc-password = "xxxxxxx"
> system-type = "xxxxxxx"
> connect-allow-ip = "*.*.*.*"
> transceiver-mode = true
> reconnect-delay = 10
> max-pending-submits=5
> # validityperiod=720
> validityperiod=60
> # connection-timeout = 0
> esm_class=3 # default 0
>
> The "esm_class" define the ESM CLASS value, if not present, will  assume 
> the default value 0x00000000. I have working this perfectly..
>
> BEGIN DIFF
> ******************************************************************************
>
> diff -ruh /Users/alvaro/Desktop/gateway-1.4.3/gw/smsc/smsc_smpp.c / 
> Users/alvaro/Desktop/gateway-1.4.3-0.3/gw/smsc/smsc_smpp.c
> --- /Users/alvaro/Desktop/gateway-1.4.3/gw/smsc/smsc_smpp.c 2009-01-12 
> 13:46:50.000000000 -0300
> +++ /Users/alvaro/Desktop/gateway-1.4.3-0.3/gw/smsc/smsc_smpp.c 2009-03-18 
> 15:16:56.000000000 -0400
> @@ -165,6 +165,7 @@
>      long connection_timeout;
>      long wait_ack;
>      int wait_ack_action;
> + int esm_class_default;
>      SMSCConn *conn;
>  } SMPP;
>
> @@ -217,7 +218,7 @@
>                           Octstr *my_number, int smpp_msg_id_type,
>                           int autodetect_addr, Octstr *alt_charset, 
> Octstr *alt_addr_charset,
>                           Octstr *service_type, long  connection_timeout,
> -                         long wait_ack, int wait_ack_action)
> +                         long wait_ack, int wait_ack_action, int 
> esm_class_default)
>  {
>      SMPP *smpp;
>
> @@ -258,6 +259,7 @@
>      smpp->connection_timeout = connection_timeout;
>      smpp->wait_ack = wait_ack;
>      smpp->wait_ack_action = wait_ack_action;
> + smpp->esm_class_default = esm_class_default;
>      smpp->bind_addr_ton = 0;
>      smpp->bind_addr_npi = 0;
>
> @@ -846,9 +848,13 @@
>
>      /*
>       * set the esm_class field
> -     * default is store and forward, plus udh and rpi if requested
> -     */
> -    pdu->u.submit_sm.esm_class = 
> ESM_CLASS_SUBMIT_STORE_AND_FORWARD_MODE;
> + * Alvaro Talavera - [email protected]
> + * (original)
> + * pdu->u.submit_sm.esm_class =  ESM_CLASS_SUBMIT_STORE_AND_FORWARD_MODE;
> + */
> + +    debug("bb.sms.smpp",0,"esm_class set in: %i", smpp-
> >esm_class_default);
> + pdu->u.submit_sm.esm_class = smpp->esm_class_default;
>      if (octstr_len(msg->sms.udhdata))
>          pdu->u.submit_sm.esm_class = pdu->u.submit_sm.esm_class |
>              ESM_CLASS_SUBMIT_UDH_INDICATOR;
> @@ -2007,6 +2013,7 @@
>      Octstr *alt_charset;
>      Octstr *alt_addr_charset;
>      long connection_timeout, wait_ack, wait_ack_action;
> +    int esm_class_default;
>
>      my_number = alt_addr_charset = alt_charset = NULL;
>      transceiver_mode = 0;
> @@ -2138,6 +2145,10 @@
>
>      if (wait_ack_action > 0x03 || wait_ack_action < 0)
>          panic(0, "SMPP: Invalid wait-ack-expire directive in 
> configuration.");
> + + /* check for esm_class */
> + if (cfg_get_integer(&esm_class_default, grp,  octstr_imm("esm_class")) 
> == -1)
> +        esm_class_default = ESM_CLASS_SUBMIT_DEFAULT_SMSC_MODE;
>
>      smpp = smpp_create(conn, host, port, receive_port, system_type,
>                 username, password, address_range,
> @@ -2145,7 +2156,7 @@
>                         dest_addr_npi, enquire_link_interval,
>                         max_pending_submits, version, priority,  validity, 
> my_number,
>                         smpp_msg_id_type, autodetect_addr,  alt_charset, 
> alt_addr_charset,
> -                       service_type, connection_timeout, wait_ack, 
> wait_ack_action);
> +                       service_type, connection_timeout, wait_ack, 
> wait_ack_action, esm_class_default);
>
>      cfg_get_integer(&smpp->bind_addr_ton, grp, octstr_imm("bind-addr- 
> ton"));
>      cfg_get_integer(&smpp->bind_addr_npi, grp, octstr_imm("bind-addr- 
> npi"));
>
>
> diff -ruh /Users/alvaro/Desktop/gateway-1.4.3/gwlib/cfg.def /Users/ 
> alvaro/Desktop/gateway-1.4.3-0.3/gwlib/cfg.def
> --- /Users/alvaro/Desktop/gateway-1.4.3/gwlib/cfg.def 2009-01-12 
> 13:46:55.000000000 -0300
> +++ /Users/alvaro/Desktop/gateway-1.4.3-0.3/gwlib/cfg.def 2009-03-18 
> 11:55:31.000000000 -0400
> @@ -342,6 +342,7 @@
>      OCTSTR(flow-control)
>      OCTSTR(wait-ack)
>      OCTSTR(wait-ack-expire)
> +    OCTSTR(esm_class)
>      OCTSTR(no-sender)
>      OCTSTR(no-coding)
>      OCTSTR(window)
>
>
> ******************************************************************************
> END DIFF
>
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.