Re: [PATCH] SMPP Optional Parameters

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
It's easier for me todo it myself instead of write how to do it :)

Juan Nin wrote:

> oks, can u give me any clue on how to expand it to all TLVs?
> 
> not sure if I'll be able to do it, I'm not too much of a C programmer,
> but if not much has to be touched, maybe I can do it...
> 
> thnx again!
> 
> Juan
> 
> 
> On Nov 9, 2007 12:55 PM, Alexander Malysh <[email protected]> wrote:
>> Hi again,
>>
>> in metadata you will receive only vendor specific TLVs.
>>
>> It could be expanded to all TLVs if needed.
>>
>>
>> Juan Nin wrote:
>>
>> > On Nov 9, 2007 11:54 AM, Alexander Malysh <[email protected]> wrote:
>> >> Hi,
>> >>
>> >> seems I just forgot about DLRs and data_sm :)
>> >>
>> >> Please try attached patch instead of previous one.
>> >
>> > cool!  :)
>> > I just tried it, and now it's passing it!
>> >
>> > BUT, it's not passing back all of the received optional parameters  :(
>> >
>> > it's only passing the vendor specific one
>> > there are 2 more that are coming, which are defined on the SMPP specs
>> > (receipted_message_id and message_state), that are not being passed in
>> > %D
>> >
>> > may be something yet missing?
>> > here's the definitions:
>> >
>> > # 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 its current message state
>> > group  = smpp-tlv
>> > name   = reason_id
>> > tag    = 0x2153
>> > type   = integer
>> > length = 2
>> >
>> > # Specifies the Message ID returned in the Submit_SM response packet
>> > group  = smpp-tlv
>> > name   = receipted_message_id
>> > tag    = 0x001e
>> > type   = octetstring
>> > length = 65
>> >
>> > # Specifies the most up-to-date delivery state of the SMS
>> > group  = smpp-tlv
>> > name   = message_state
>> > tag    = 0x0427
>> > type   = integer
>> > length = 1
>> >
>> > here the smsc connection logs:
>> >
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG: SMPP[om-1]: Manually forced
>> > source addr ton = 3, source add npi = 0
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG: SMPP[om-1]: Manually forced dest
>> > addr ton = 1, dest add npi = 1
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG: new group created `smpp'
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG: group=`smpp' key=`charge_type'
>> > value=`1' 2007-11-09 09:26:18 [4004] [6] DEBUG: group=`smpp'
>> > key=`charge_amount' value=`99'
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG: SMPP[om-1]: Sending PDU:
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG: SMPP PDU 0xdeee5c0 dump:
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   type_name: submit_sm
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   command_id: 4 = 0x00000004
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   command_status: 0 = 0x00000000
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   sequence_number: 5 = 0x00000005
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   service_type: NULL
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   source_addr_ton: 3 = 0x00000003
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   source_addr_npi: 0 = 0x00000000
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   source_addr: "12345"
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   dest_addr_ton: 1 = 0x00000001
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   dest_addr_npi: 1 = 0x00000001
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   destination_addr: "11234567890"
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   esm_class: 3 = 0x00000003
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   protocol_id: 0 = 0x00000000
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   priority_flag: 0 = 0x00000000
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   schedule_delivery_time: NULL
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   validity_period: NULL
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   registered_delivery: 1 =
>> > 0x00000001
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   replace_if_present_flag: 0 =
>> > 0x00000000
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   data_coding: 0 = 0x00000000
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   sm_default_msg_id: 0 =
>> > 0x00000000
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   sm_length: 30 = 0x0000001e
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   short_message:
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:    Octet string at 0xdec18e0:
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:      len:  30
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:      size: 31
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:      immutable: 0
>> > 2007-11-09 09:26:18 [4004] [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-09 09:26:18 [4004] [6] DEBUG:      data: 75 61 6e 20 4e 69 6e
>> > 20 28 53 4d 50 50 29         uan Nin (SMPP)
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:    Octet string dump ends.
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   charge_type: "1"
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG:   charge_amount: "99"
>> > 2007-11-09 09:26:18 [4004] [6] DEBUG: SMPP PDU dump ends.
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP[om-1]: Sending enquire link:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP PDU 0xdec1580 dump:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   type_name: enquire_link
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_id: 21 = 0x00000015
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_status: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   sequence_number: 6 = 0x00000006
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP PDU dump ends.
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP[om-1]: Got PDU:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP PDU 0xdec1580 dump:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   type_name: submit_sm_resp
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_id: 2147483652 =
>> > 0x80000004
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_status: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   sequence_number: 5 = 0x00000005
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   message_id:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:    Octet string at 0xdeee460:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      len:  23
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      size: 24
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      immutable: 0
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      data: 30 31 30 37 32 2d 31
>> > 31 30 39 55 2d 30 39 32 36   01072-1109U-0926
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      data: 35 2d 31 39 46 57 33
>> >                             5-19FW3
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:    Octet string dump ends.
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP PDU dump ends.
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: DLR[mysql]: Adding DLR
>> > smsc=om-1, ts=01072-1109U-09265-19FW3, src=12345, dst=11234567890,
>> > mask=31, boxc=
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: sql: INSERT INTO dlr (smsc, ts,
>> > source, destination, service, url, mask, boxc, status) VALUES ('om-1',
>> > '01072-1109U-09265-19FW3', '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-09 09:26:19 [4004] [6] DEBUG: SMSC[om-1]: creating DLR message
>> > 2007-11-09 09:26:19 [4004] [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-09 09:26:19 [4004] [6] DEBUG: SMPP[om-1]: Got PDU:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP PDU 0xdec1580 dump:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   type_name: enquire_link_resp
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_id: 2147483669 =
>> > 0x80000015
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_status: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   sequence_number: 6 = 0x00000006
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP PDU dump ends.
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: Optional parameter tag (0x0427)
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: Optional parameter length read as
>> > 1 2007-11-09 09:26:19 [4004] [6] DEBUG: Optional parameter tag (0x001e)
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: Optional parameter length read as
>> > 24 2007-11-09 09:26:19 [4004] [6] DEBUG: Optional parameter tag
>> > (0x2153) 2007-11-09 09:26:19 [4004] [6] DEBUG: Optional parameter
>> > length read as 2 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP[om-1]: Got
>> > PDU: 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP PDU 0xdec0b40 dump:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   type_name: deliver_sm
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_id: 5 = 0x00000005
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_status: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   sequence_number: 4616540 =
>> > 0x0046715c
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   service_type: NULL
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   source_addr_ton: 1 = 0x00000001
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   source_addr_npi: 1 = 0x00000001
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   source_addr: "11234567890"
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   dest_addr_ton: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   dest_addr_npi: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   destination_addr: NULL
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   esm_class: 4 = 0x00000004
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   protocol_id: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   priority_flag: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   schedule_delivery_time: NULL
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   validity_period: NULL
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   registered_delivery: 0 =
>> > 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   replace_if_present_flag: 0 =
>> > 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   data_coding: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   sm_default_msg_id: 0 =
>> > 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   sm_length: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   short_message: ""
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   message_state: 2 = 0x00000002
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   receipted_message_id:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:    Octet string at 0xdebbb90:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      len:  23
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      size: 24
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      immutable: 0
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      data: 30 31 30 37 32 2d 31
>> > 31 30 39 55 2d 30 39 32 36   01072-1109U-0926
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:      data: 35 2d 31 39 46 57 33
>> >                             5-19FW3
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:    Octet string dump ends.
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   reason_id: "4"
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP PDU dump ends.
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP[om-1] handle_pdu, got DLR
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: DLR[mysql]: Looking for DLR
>> > smsc=om-1, ts=01072-1109U-09265-19FW3, dst=11234567890, type=1
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: sql: SELECT mask, service, url,
>> > source, destination, boxc FROM dlr WHERE smsc='om-1' AND
>> > ts='01072-1109U-09265-19FW3';
>> > 2007-11-09 09:26:19 [4004] [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-09 09:26:19 [4004] [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-09 09:26:19 [4004] [6] DEBUG: removing DLR from database
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: sql: DELETE FROM dlr WHERE
>> > smsc='om-1' AND ts='01072-1109U-09265-19FW3' LIMIT 1; 2007-11-09
>> > 09:26:19
>> > [4004] [6] DEBUG: SMPP[om-1]: Sending PDU: 2007-11-09 09:26:19 [4004]
>> > [[6]
>> > DEBUG: SMPP PDU 0xdec0d00 dump:
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   type_name: deliver_sm_resp
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_id: 2147483653 =
>> > 0x80000005
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   command_status: 0 = 0x00000000
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   sequence_number: 4616540 =
>> > 0x0046715c
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG:   message_id: NULL
>> > 2007-11-09 09:26:19 [4004] [6] DEBUG: SMPP PDU dump ends.
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG: SMPP[om-1]: Sending enquire link:
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG: SMPP PDU 0xdec1520 dump:
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG:   type_name: enquire_link
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG:   command_id: 21 = 0x00000015
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG:   command_status: 0 = 0x00000000
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG:   sequence_number: 7 = 0x00000007
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG: SMPP PDU dump ends.
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG: SMPP[om-1]: Got PDU:
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG: SMPP PDU 0xdec1520 dump:
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG:   type_name: enquire_link_resp
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG:   command_id: 2147483669 =
>> > 0x80000015
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG:   command_status: 0 = 0x00000000
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG:   sequence_number: 7 = 0x00000007
>> > 2007-11-09 09:26:44 [4004] [6] DEBUG: SMPP PDU dump ends.
>> >
>> > and here smsbox.log relevant part:
>> >
>> > 007-11-09 09:26:19 [4017] [4] INFO: Starting delivery report
>> > <username> from <12345>
>> > 2007-11-09 09:26:19 [4017] [9] DEBUG: Parsing URL
>> >
>>
`http://myHost.tld/dlr.php?smsc-id=om-1&status=1&answer=&to=12345&from=11234567890&ts=2007-11-09+14:26:19&meta-data=%3Fsmpp%3Freason_id%3D4%26':
>> > 2007-11-09 09:26:19 [4017] [9] DEBUG:   Scheme: http://
>> > 2007-11-09 09:26:19 [4017] [9] DEBUG:   Host: host.myDomain.tld
>> > 2007-11-09 09:26:19 [4017] [9] DEBUG:   Port: 80
>> > 2007-11-09 09:26:19 [4017] [9] DEBUG:   Username: (null)
>> > 2007-11-09 09:26:19 [4017] [9] DEBUG:   Password: (null)
>> > 2007-11-09 09:26:19 [4017] [9] DEBUG:   Path: /dlr.php
>> > 2007-11-09 09:26:19 [4017] [9] DEBUG:   Query:
>> >
>>
smsc-id=om-1&status=1&answer=&to=12345&from=11234567890&ts=2007-11-09+14:26:19&meta-data=%3Fsmpp%3Freason_id%3D4%26
>> > 2007-11-09 09:26:19 [4017] [9] DEBUG:   Fragment: (null)
>> >
>> > thanks again!
>> >
>> > Juan
>>
>> --
>> Thanks,
>> Alex
>>
>>
>>

-- 
Thanks,
Alex
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.