Padding Leadng Zeroes in Destination Number

Padding Leadng Zeroes in Destination Number SearchSearch
Author Message
Mathew Mathachan
New member
Username: Mathewm

Post Number: 9
Registered: 04-2011
Posted on Wednesday, June 22, 2011 - 11:01 am:   

Hi,

In the SMPP message, How do we send leading zeroes along with the destination number.

The message is submitted over HTTP in the format +911234567890

Presently in the SMPP message it is encoded as 911234567890 with the corresponding TON and NPI parameters.

However, what do we do to send the number as 00911234567890 in the SMPP message.

Thanks in advance

Mathew
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3296
Registered: 08-2008
Posted on Wednesday, June 22, 2011 - 05:13 pm:   

Hi Mathew,

That is unusual. The TON value indicates that the number is international format, so it is odd that an SMPP server would want you to use a 00 prefix instead.

There is currently no easy way to accomplish the type of number conversion that you are asking for.

We did recently make changes to the accounting callback interface that allow the accounting callback to change source and destination addresses when a message is submitted.

It's not easy, but it's not that difficult, to create an accounting callback script that looks for recipient addresses that start with +91 and changes them to start with 0091.

As an example, I created a PHP script that does just this.

I call it remap.php, and here it is:

<?php
header ("Content-Type: text/plain");

if (!strcasecmp ($_REQUEST['Type'], "SMSSend")) {
if (isset($_REQUEST['To'])) {
$to = $_REQUEST['To'];
if (!strncmp ($to, "+91", 3)) {
$to = "00" . substr($to, 1);
echo "To=" . $to . "\r\n";
}
}
}
?>

Basically, this script is installed as a NowSMS accounting callback.

It parses the "Type=" input to make sure it is an "SMSSend" callback. It then looks at the "To=" (recipient) address, and if it starts with +91, it changes the + to 00 in its response back to NowSMS.

remap.php can be installed on a separate web server, or it can be installed directly on NowSMS and run under a local copy of PHP if you follow the instructions at http://www.nowsms.com/now-sms-native-php-scripts

I tested the script by installing on a NowSMS server on my desktop. I installed PHP following the directions above.

I saved remap.php in the \ProgramData\NowSMS\PHP directory.

I then added the following statements to the [SMSGW] section of SMSGW.INI:

SMSAccountingAllowChanges=Yes
SMSAccountingURL=http://nowsmslocal/php/remap.php

Then, restarted the NowSMS service.

The accounting script was called each time a message was submitted, and if the recipient started with +91, it was changed to start with 0091.

Again ... not easy ... but not extremely difficult.

--
Des
NowSMS Support}