smskannel

Kannel - Getting shortcode from POST_URL


currently we uses Kannel to connect to SMSC and receive any incoming SMS.

The setup successfully direct the message to our CGI Perl script. However, the destination address (in this case it's the shortcode) is empty. We have several shortcode configured at the SMSC therefore we need to be able to know the message is sent via which shortcode.

The current configuration is as follow:

group = sms-service 
keyword =default 
accept-x-kannel-headers=true 
post-url= "http://127.0.0.1:8990/cgi-bin/test_shortcode.cgi?MSISDN=%p&MSG=%a&SC=%P" 
max-messages =1 
catch-all=yes 
concatenation = 1 
omit-empty = true 
send-sender=true

The param SC receive empty string.

A check in the SMSC log files and the shortcode is actually found as the destination_addr:

2016-04-20 14:48:56 [20307] [6] DEBUG:   dest_addr_ton: 0 = 0x00000000
2016-04-20 14:48:56 [20307] [6] DEBUG:   dest_addr_npi: 1 = 0x00000001
2016-04-20 14:48:56 [20307] [6] DEBUG:   destination_addr: "27626"

Any idea on why this is happening and how can we get the shortcode as the param?

Thank you


Solution

  • Found the issue after checking the Kannel source. Turns out Kannel will read a sequence of configuration for sending out SMS, and these setting will replace the destination number when MO is coming in. The settings i found are:

    1. my-number
    2. global-sender
    3. faked-sender

    Each level of setting will override the previous one, i.e. if all 3 are set, faked-sender will be in effect. By commenting off the above 3, we are able to get the correct shortcode value from the parameter %P in the post-url request.

    Just posting this in case it will help somebody.