Re: Cannot retrieve receipted_message_id in deliver_sm using meta-datapatch

"Alejandro Guerrieri" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Sorry for the delay, but didn't have a chance to test this against a real
link before.

You're right, since Kannel captures the TLV before, it doesn't make it into
the TLV handler.

The receipted_message_id TLV is somewhat "special" since it's used
internally by kannel as well.

Please use this small patch that extends my "%w" patch and allows the
parameter also on deliver_sm and data_sm PDU's. You'll then be able to
access the parameter on the %w variable as well.

=CUT HERE=======================================================
Index: gw/smsc/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v
retrieving revision 1.101.2.5
diff -u -r1.101.2.5 smsc_smpp.c
--- gw/smsc/smsc_smpp.c 21 Oct 2008 12:50:46 -0000      1.101.2.5
+++ gw/smsc/smsc_smpp.c 27 Oct 2008 20:47:15 -0000
@@ -463,6 +464,9 @@
     msg->sms.binfo = pdu->u.deliver_sm.service_type;
     pdu->u.deliver_sm.service_type = NULL;

+    msg->sms.smsc_msg_id = pdu->u.deliver_sm.receipted_message_id;
+    pdu->u.deliver_sm.receipted_message_id = NULL;
+
     if (pdu->u.deliver_sm.esm_class & ESM_CLASS_SUBMIT_RPI)
         msg->sms.rpi = 1;

@@ -627,6 +631,9 @@
     msg->sms.binfo = pdu->u.data_sm.service_type;
     pdu->u.data_sm.service_type = NULL;

+    msg->sms.smsc_msg_id = pdu->u.data_sm.receipted_message_id;
+    pdu->u.data_sm.receipted_message_id = NULL;
+
     if (pdu->u.data_sm.esm_class & ESM_CLASS_SUBMIT_RPI)
         msg->sms.rpi = 1;

=CUT HERE=======================================================

I'll rewrite my "%w" patch and submit it later, so there's no need to apply
two patches to get it working.

Hope it helps,

Alejandro Guerrieri


On Tue, Oct 21, 2008 at 1:19 PM, Eds Encarnacion <[email protected]> wrote:

>  I copied and pasted a segment of code from the dlr handling part of
> smsc_smpp.c into the pdu_to_msg function and it seems to work.  I used a
> version with Alejandro's %w patch, so the smsc_msg_id variable was already
> available from his patch.  The receipted_message_id can be retrieved using
> %w, just like in submit_sm_response.
>
>
>
> I'm still not sure why I can't seem to get the receipted_message_id tag
> using the meta-data patch.  I'll still try to find out, though.
>
>
>
> Eds.
>
>
>
>
>
>
>
>     Octstr *tmp;
>
>
>
>     /* check if msg_id is C string, decimal or hex for this SMSC */
>
>     if (smpp->smpp_msg_id_type == -1) {
>
>         /* the default, C string */
>
>         tmp = octstr_duplicate(pdu->u.deliver_sm.receipted_message_id);
>
>     } else {
>
>         if ((smpp->smpp_msg_id_type & 0x01) ||
>
>            (!octstr_check_range(pdu->u.deliver_sm.receipted_message_id, 0,
>
>                 octstr_len(pdu->u.deliver_sm.receipted_message_id),
> gw_isdigit))) {
>
>             tmp = octstr_format("%lu", strtoll(  /* hex */
>
>                 octstr_get_cstr(pdu->u.deliver_sm.receipted_message_id),
> NULL, 16));
>
>         } else {
>
>             tmp = octstr_format("%lu", strtoll(  /* decimal */
>
>                 octstr_get_cstr(pdu->u.deliver_sm.receipted_message_id),
> NULL, 10));
>
>         }
>
>     }
>
>
>
>     msg->sms.smsc_msg_id = octstr_duplicate( tmp );
>
>
>
>     octstr_destroy(tmp);
>
>
>
>
>
>
>
> -----Original Message-----
> *From:* Eds Encarnacion [mailto:[email protected]]
> *Sent:* Thursday, October 16, 2008 3:31 PM
> *To:* [email protected]
> *Subject:* Cannot retrieve receipted_message_id in deliver_sm using
> meta-datapatch
>
>
>
>
>
> Hello,
>
>
>
> I'm quite new to using Kannel to connect via SMPP.  I've recently
> implemented the meta-data patch (from Alex) and the %w patch (from
> Alejandro).  Everything works well except that I can't seem to get the
> receipted_message_id from the deliver_sm PDU using the %D meta-data option.
> The only thing that is returned by %D is ?smpp?.
>
>
>
> I'm no C/C++ expert, but I'm trying to figure out how to fix it.  I'm not
> sure if I'll be successful, though.
>
>
>
> I'll paste some parts of the kannel.conf and some of the output that I have
> below.  If anyone has time, please do let me know if I'm doing anything
> wrong.
>
>
>
> Thanks!
>
> Eds.
>
>
>
>
>
> ***** kannel.conf *****
>
>
>
> # Additional TLV Definitions
>
> group = smpp-tlv
>
> name = XXBillingType
>
> tag = 0x1400
>
> type = octetstring
>
> length = 3
>
>
>
> group = smpp-tlv
>
> name = XXMessageID
>
> tag = 0x001E
>
> type = nulterminated (also tried octetstring, but same result)
>
> length = 65
>
>
>
> # SMPP Configuration
>
> group = smsc
>
> smsc = smpp
>
> host = xx.xx.xx.xx
>
> port = xxxxx
>
> smsc-id = XXXXXX
>
> smsc-username = xxxxxxxx
>
> smsc-password = xxxxxxxx
>
> system-type =
>
> transceiver-mode = true
>
>
>
> # SEND-SMS USERS
>
> group = sendsms-user
>
> username=xxxxx
>
> password=xxxxx
>
> dlr-url =
> http://localhost/dump.php?p=%p&P=%P&i=%i&I=%I&o=%o&B=%B&u=%u&D=%D&w=%w"
>
>
>
> # SERVICES
>
> group = sms-service
>
> keyword = default
>
> max-messages = 0
>
> get-url = "
> http://localhost/dump.php?p=%p&P=%P&i=%i&I=%I&o=%o&B=%B&u=%u&a=%a&w=%w&D=%D
> "
>
>
>
>
>
> ***** dump from kannel.log *****
>
>
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG: Optional parameter tag (0x001e)
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG: Optional parameter length read as
> 19
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:
> SMPP[SMPP:xx.xx.xx.xx:xxxxx/xxxxx:xxxxx:]: Got PDU:
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG: SMPP PDU 0x92e0b38 dump:
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   type_name: deliver_sm
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   command_id: 5 = 0x00000005
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   command_status: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   sequence_number: 6613 =
> 0x000019d5
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   service_type: "Roger"
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   source_addr_ton: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   source_addr_npi: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   source_addr: "xxxxxxxxxx"
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   dest_addr_ton: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   dest_addr_npi: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   destination_addr: "xxxxx"
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   esm_class: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   protocol_id: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   priority_flag: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   schedule_delivery_time: NULL
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   validity_period: NULL
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   registered_delivery: 0 =
> 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   replace_if_present_flag: 0 =
> 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   data_coding: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   sm_default_msg_id: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   sm_length: 10 = 0x0000000a
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   short_message: "Test MO #3"
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   receipted_message_id:
> "MO-001224001905452"
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG: SMPP PDU dump ends.
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:
> SMPP[SMPP:xx.xx.xx.xx:xxxxx/xxxxx:xxxxx:]:: Sending PDU:
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG: SMPP PDU 0x92e0c40 dump:
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   type_name: deliver_sm_resp
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   command_id: 2147483653 =
> 0x80000005
>
> 2008-10-15 07:43:58 [19509] [9] DEBUG: send_msg: sending msg to box: <
> 127.0.0.1>
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   command_status: 0 = 0x00000000
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   sequence_number: 6613 =
> 0x000019d5
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG:   message_id: NULL
>
> 2008-10-15 07:43:58 [19509] [6] DEBUG: SMPP PDU dump ends.
>
>
>
>
>
>
>
>
>
>
>
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.