[PATCH] ok, this is the diff for esm_class, configurable from meta-data, tested and working for me...

Alvaro Talavera <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
is only implemented for smpp, for now.. Here the diff.

Comments?




--- kannel-snapshot/gw/smsc/smsc_smpp.c	2009-01-29 08:38:28.000000000  
-0300
+++ gateway-1.4.3-0.4/gw/smsc/smsc_smpp.c	2009-03-28  
12:00:57.000000000 -0400
@@ -743,7 +743,9 @@
{
     SMPP_PDU *pdu;
     int validity;
-
+    Octstr *esm_class_default;
+	int esm_class_value;
+
     pdu = smpp_pdu_create(submit_sm,
     	    	    	  counter_increase(smpp->message_id_counter));

@@ -854,10 +856,22 @@
         pdu->u.submit_sm.protocol_id = msg->sms.pid;

     /*
-     * set the esm_class field
-     * default is store and forward, plus udh and rpi if requested
+     * set the esm_class field from meta-data, if not set, the  
default value is asummed
+     * (Original: pdu->u.submit_sm.esm_class =  
ESM_CLASS_SUBMIT_STORE_AND_FORWARD_MODE;)
+     * Alvaro Talavera ([email protected]) - www.puntopy.com
      */
-    pdu->u.submit_sm.esm_class =  
ESM_CLASS_SUBMIT_STORE_AND_FORWARD_MODE;
+
+
+	if (msg->sms.meta_data != NULL &&
+		(esm_class_default = meta_data_get_value(msg->sms.meta_data,  
"smpp", octstr_imm("esm_class"))) != NULL) {
+			esm_class_value = atoi(octstr_get_cstr(esm_class_default));
+			debug("bb.sms.smpp",0,"esm_class meta_data received, set in %i",  
esm_class_value);
+			pdu->u.submit_sm.esm_class = esm_class_value;
+	}else{
+		debug("bb.sms.smpp",0,"esm_class meta_data empty, set default.");
+		pdu->u.submit_sm.esm_class = ESM_CLASS_SUBMIT_DEFAULT_SMSC_MODE;
+	}
+	
     if (octstr_len(msg->sms.udhdata))
         pdu->u.submit_sm.esm_class = pdu->u.submit_sm.esm_class |
             ESM_CLASS_SUBMIT_UDH_INDICATOR;
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.