Re: [PATCH] SMPP Optional Parameters

"Juan Nin" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
any feedback on this?

thnx again!

Juan


On Nov 8, 2007 3:17 PM, Juan Nin <[email protected]> wrote:
> Hi Alexander!
>
> I've made some tests with your patch.
> These are the Optional SMPP parameters I've configured:
>
>
> # Specifies if message must or not be billed
> group  = smpp-tlv
> name   = charge_type
> tag    = 0x2151
> type   = integer
> length = 1
>
> # Specifies amount to be billed
> group  = smpp-tlv
> name   = charge_amount
> tag    = 0x2152
> type   = integer
> length = 2
>
> # Specifies the reason why the SMS is in it's current message state
> group  = smpp-tlv
> name   = reason_id
> tag    = 0x2153
> type   = integer
> length = 2
>
>
> I've used the first 2 ones, on MT sending, and I've been able to send
> with this Premium messages
> I used this sample code on PHP:
>
> <SNIP>
> $tlv = urlencode('?smpp?charge_type=1&charge_amount=99');
>
> $url = "http://127.0.0.1:13131/cgi-bin/sendsms?username=$send_sms_user&password=$send_sms_pass&to=$phone&from=$short_code&smsc=$smsc&dlr-mask=$dlr_mask&dlr-url=$dlr_url&text=$message";
>
> if($tlv != '')
> {
>         $url .= "&meta-data=$tlv";
> }
> </SNIP>
>
> This worked fine as you can see here:
>
> 007-11-08 09:54:01 [19112] [6] DEBUG: SMPP[om-1]: Manually forced dest
> addr ton = 1, dest add npi = 1
> 2007-11-08 09:54:01 [19112] [6] DEBUG: new group created `smpp'
> 2007-11-08 09:54:01 [19112] [6] DEBUG: group=`smpp' key=`charge_type' value=`1'
> 2007-11-08 09:54:01 [19112] [6] DEBUG: group=`smpp'
> key=`charge_amount' value=`99'
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP[om-1]: Sending PDU:
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP PDU 0x1da7c4c0 dump:
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   type_name: submit_sm
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   command_id: 4 = 0x00000004
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   command_status: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   sequence_number: 28 = 0x0000001c
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   service_type: NULL
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   source_addr_ton: 3 = 0x00000003
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   source_addr_npi: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   source_addr: "12345"
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   dest_addr_ton: 1 = 0x00000001
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   dest_addr_npi: 1 = 0x00000001
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   destination_addr: "11234567890"
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   esm_class: 3 = 0x00000003
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   protocol_id: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   priority_flag: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   schedule_delivery_time: NULL
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   validity_period: NULL
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   registered_delivery: 1 = 0x00000001
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   replace_if_present_flag: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   data_coding: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   sm_default_msg_id: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   sm_length: 30 = 0x0000001e
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   short_message:
> 2007-11-08 09:54:01 [19112] [6] DEBUG:    Octet string at 0x1da56910:
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      len:  30
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      size: 31
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      immutable: 0
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      data: 54 65 73 74 20 50 53
> 4d 53 20 66 72 6f 6d 20 4a   Test PSMS from J
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      data: 75 61 6e 20 4e 69 6e
> 20 28 53 4d 50 50 29         uan Nin (SMPP)
> 2007-11-08 09:54:01 [19112] [6] DEBUG:    Octet string dump ends.
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   charge_type: "1"
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   charge_amount: "99"
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP PDU dump ends.
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP[om-1]: Got PDU:
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP PDU 0x1da7c4c0 dump:
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   type_name: submit_sm_resp
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   command_id: 2147483652 = 0x80000004
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   command_status: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   sequence_number: 28 = 0x0000001c
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   message_id:
> 2007-11-08 09:54:01 [19112] [6] DEBUG:    Octet string at 0x1da64ea0:
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      len:  23
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      size: 24
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      immutable: 0
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      data: 30 31 30 37 48 2d 31
> 31 30 38 47 2d 30 39 35 34   0107H-1108G-0954
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      data: 44 2d 30 31 33 39 52
>                              D-0139R
> 2007-11-08 09:54:01 [19112] [6] DEBUG:    Octet string dump ends.
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP PDU dump ends.
>
>
> Now, the third optional parameter I defined (reason_id) is sent by the
> gateway when they send a DLR
> I defined my dlr-url and dlr-mask like this:
>
> $dlr_mask = '31';
> $dlr_url  = urlencode("http://myHost.tld/dlr.php?smsc-id=%i&status=%d&answer=%A&to=%P&from=%p&ts=%t&meta_data=%D");
>
>
> There I'm using the "&meta_data=%D" in the dlr-url, but despite of
> that, the data is not passed, it comes blank...
> The optional parameter is recognized, but no data is coming on %D
> Here are the logs:
>
> 2007-11-08 09:54:01 [19112] [6] DEBUG: DLR[mysql]: Adding DLR
> smsc=om-1, ts=0107H-1108G-0954D-0139R, src=12345, dst=11234567890,
> mask=31, boxc=
> 2007-11-08 09:54:01 [19112] [6] DEBUG: sql: INSERT INTO dlr (smsc, ts,
> source, destination, service, url, mask, boxc, status) VALUES ('om-1',
> '0107H-1108G-0954D-0139R', '12345', '11234567890', '3Ci',
> 'http://myHost.tld/dlr.php?smsc-id=%i&status=%d&answer=%A&to=%P&from=%p&ts=%t&meta_data=%D',
> '31', '', '0');
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMSC[om-1]: creating DLR message
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMSC[om-1]: DLR =
> http://myHost.tld/dlr.php?smsc-id=%i&status=%d&answer=%A&to=%P&from=%p&ts=%t&meta_data=%D
> 2007-11-08 09:54:01 [19112] [6] DEBUG: Optional parameter tag (0x0427)
> 2007-11-08 09:54:01 [19112] [6] DEBUG: Optional parameter length read as 1
> 2007-11-08 09:54:01 [19112] [6] DEBUG: Optional parameter tag (0x001e)
> 2007-11-08 09:54:01 [19112] [6] DEBUG: Optional parameter length read as 24
> 2007-11-08 09:54:01 [19112] [6] DEBUG: Optional parameter tag (0x2153)
> 2007-11-08 09:54:01 [19112] [6] DEBUG: Optional parameter length read as 2
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP[om-1]: Got PDU:
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP PDU 0x1da7c370 dump:
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   type_name: deliver_sm
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   command_id: 5 = 0x00000005
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   command_status: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   sequence_number: 1671777 = 0x00198261
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   service_type: NULL
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   source_addr_ton: 1 = 0x00000001
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   source_addr_npi: 1 = 0x00000001
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   source_addr: "11234567890"
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   dest_addr_ton: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   dest_addr_npi: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   destination_addr: NULL
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   esm_class: 4 = 0x00000004
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   protocol_id: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   priority_flag: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   schedule_delivery_time: NULL
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   validity_period: NULL
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   registered_delivery: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   replace_if_present_flag: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   data_coding: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   sm_default_msg_id: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   sm_length: 0 = 0x00000000
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   short_message: ""
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   message_state: 2 = 0x00000002
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   receipted_message_id:
> 2007-11-08 09:54:01 [19112] [6] DEBUG:    Octet string at 0x1da50670:
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      len:  23
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      size: 24
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      immutable: 0
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      data: 30 31 30 37 48 2d 31
> 31 30 38 47 2d 30 39 35 34   0107H-1108G-0954
> 2007-11-08 09:54:01 [19112] [6] DEBUG:      data: 44 2d 30 31 33 39 52
>                              D-0139R
> 2007-11-08 09:54:01 [19112] [6] DEBUG:    Octet string dump ends.
> 2007-11-08 09:54:01 [19112] [6] DEBUG:   reason_id: "4"
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP PDU dump ends.
> 2007-11-08 09:54:01 [19112] [6] DEBUG: SMPP[om-1] handle_pdu, got DLR
> 2007-11-08 09:54:01 [19112] [6] DEBUG: DLR[mysql]: Looking for DLR
> smsc=om-1, ts=0107H-1108G-0954D-0139R, dst=11005132582, type=1
> 2007-11-08 09:54:01 [19112] [6] DEBUG: sql: SELECT mask, service, url,
> source, destination, boxc FROM dlr WHERE smsc='om-1' AND
> ts='0107H-1108G-0954D-0139R';
> 2007-11-08 09:54:01 [19112] [6] DEBUG: Found entry, row[0]=31,
> row[1]=3Ci, row[2]=http://myHost.tld/dlr.php?smsc-id=%i&status=%d&answer=%A&to=%P&from=%p&ts=%t&meta_data=%D,
> row[3]=12345, row[4]=11234567890 row[5]=
> 2007-11-08 09:54:01 [19112] [6] DEBUG: DLR[mysql]: created DLR message
> for URL <http://myHost.tld/dlr.php?smsc-id=%i&status=%d&answer=%A&to=%P&from=%p&ts=%t&meta_data=%D>
> 2007-11-08 09:54:01 [19112] [6] DEBUG: removing DLR from database
> 2007-11-08 09:54:01 [19112] [6] DEBUG: sql: DELETE FROM dlr WHERE
> smsc='om-1' AND ts='0107H-1108G-0954D-0139R' LIMIT 1;
>
> and on smsbox.log the relevant part:
>
> 2007-11-08 09:54:01 [19126] [8] DEBUG: Octet string dump ends.
> 2007-11-08 09:54:01 [19126] [4] INFO: Starting delivery report
> <username> from <12345>
> 2007-11-08 09:54:01 [19126] [9] DEBUG: Parsing URL
> `http://myHost.tld/dlr.php?smsc-id=om-1&status=1&answer=&to=12345&from=11234567890&ts=2007-11-08+14:54:01&meta_data=':
> 2007-11-08 09:54:01 [19126] [9] DEBUG:   Scheme: http://
> 2007-11-08 09:54:01 [19126] [9] DEBUG:   Host: host.myDomain.tld
> 2007-11-08 09:54:01 [19126] [9] DEBUG:   Port: 80
> 2007-11-08 09:54:01 [19126] [9] DEBUG:   Username: (null)
> 2007-11-08 09:54:01 [19126] [9] DEBUG:   Password: (null)
> 2007-11-08 09:54:01 [19126] [9] DEBUG:   Path: /dlr.php
> 2007-11-08 09:54:01 [19126] [9] DEBUG:   Query:
> smsc-id=om-1&status=1&answer=&to=12345&from=11234567890&ts=2007-11-08+14:54:01&meta_data=
> 2007-11-08 09:54:01 [19126] [9] DEBUG:   Fragment: (null)
>
>
> any idea on why I'm receiving nothing on meta_data?
>
> Thanks in advance!
>
> Juan
>
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.