I understand and support the reasons Stipe and Alex have to enforce the "no-new-fields-added" policy for particular smscs. If we start adding propietary settings for each smsc, sooner or later the code would end up being an incompatible mess.

On the other side, requiring the parameter on each and every request would mean changing the applications, which may be non-practical on some scenarios.

What about creating a generic mechanism to pass meta-data default values from the configuration files? That would allow us to keep using the meta-data method, while being able to set a default value (which could be overwritten by explicitly passing the parameter on a request) thus avoiding the need to set that parameter on each and every request if we don't need a dynamic value.

Opinions?
--
Alejandro Guerrieri
[email protected]



On 28/03/2009, at 22:49, Nikos Balkanas wrote:

Hi,

I liked it before, and I like it know. But Stipes seems to think that a more general way for all smpps through meta-data should be used. Isn't it so?

BR,
Nikos
----- Original Message -----
From: Alvaro Talavera
To: kannel_dev_mailinglist
Sent: Saturday, March 28, 2009 6:11 PM
Subject: [PATCH] ok, this is the diff for esm_class,configurable from meta-data, tested and working for me...

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;

Reply via email to