Add or remove prefix

Add or remove prefix SearchSearch
Author Message
walter Betances
New member
Username: Wbetances

Post Number: 35
Registered: 04-2005
Posted on Tuesday, July 11, 2006 - 01:04 am:   

Is it possible to add or remove a prefix to all messages sent and received form a specific SMS user.

I have a SMS user that is sending me sms but the sender address that is international is coming without the prefix 011. For me all international numbers should come with prefix 011. So I need to add 011 in front of all sender address before I send to SMSC.

Also the other way around. When the massage comes from the SMSC to be delivered, the SMSC send all destinations address with prefix 011, but I need to eliminate 011 before I send to this SMS user.

How can I do this with Nowsms?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 6177
Registered: 10-2002
Posted on Tuesday, July 11, 2006 - 06:37 pm:   

What type of SMSC connection?

Is this UCP/EMI by any chance? (The reason I ask, is because most SMSC connections use "+" as an international prefix, but that is not common in the UCP/EMI environment, so there is a configuration setting for translating international numbers to include a prefix. See the description of the InternationalPrefix= setting in the following thread: http://support.nowsms.com/discus/messages/1/5972.html)

Aside from that, there are no options for number transformation. (But we might be able to add a similar option for other types of SMSC connections if necessary.)

-bn
walter Betances
New member
Username: Wbetances

Post Number: 36
Registered: 04-2005
Posted on Wednesday, July 12, 2006 - 03:33 am:   

My connection is SMPP. The SMSC sends the destination address as +011XXXXXXXXXXX for international. I use a 2way command ( http://XXX.XXX.XXX.XXX:XXXX/?PhoneNumber=@@RECIP@@&Sender=@@SENDER@@&Text=@@FULLSMS@@)to process this message and then this messages goes thru a SMS User to be delivered.

The SMS User only wants me to send +XXXXXXXXXXX.
So I need to eliminate the 011 prefix. Is it possible to do this thru the 2 way command?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 6186
Registered: 10-2002
Posted on Wednesday, July 12, 2006 - 05:31 pm:   

Hi Walter,

Ok ... I understand the issue a bit better now.

You'd need your own 2-way scripting to deal with this.

Right now you have a 2-way script that is submitting the message back to NowSMS. You would want to change this to call a script (running on another web server) instead.

That script would parse the parameters, look for "+011" at the start of the recipient address, and create a new variable containing the modified recipient address. It would then return a redirect response with the modified URL to resubmit the message to NowSMS.

The 2way-redirect.php script in the following thread (http://support.nowsms.com/discus/messages/1/3991.html) would be a decent starting point ...

In fact, it's an easy enough script to write in PHP ... here's an example:

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

if (isset($_REQUEST['PhoneNumber'])) {
if (isset($_REQUEST['Sender'])) {
$newRecip = $_REQUEST['PhoneNumber'];
if (!strncmp ($newRecip, "+011", 4)) {
$newRecip = substr ($newRecip, 4);
}
header ("Location: http://127.0.0.1:8800/?user=username&password=password&PhoneNumber=" . urlencode($newRecip) . "&Sender=" . urlencode($_REQUEST['Sender']) . "&Text=" . urlencode($_REQUEST['Text']));
}
else {
echo "ERROR : 'Sender' parameter missing\r\n";
}
}
else {
echo "ERROR : 'PhoneNumber' (destination recipient) parameter missing!\r\n";
}

?>

This script accepts the PhoneNumber, Sender and Text parameters. It modifies the PhoneNumber parameter to remove "+011" if that is present at the start. It then issues a redirect response back to NowSMS with the modified parameters.

text/plain2way-editparms.php
2wayedit.php (0.7 k)