2-Way SMS Support with Short Codes Not posting to Endpoint

2-Way SMS Support with Short Codes Not posting to Endpoint SearchSearch
Author Message
Rodney Ring
New member
Username: Rring

Post Number: 1
Registered: 09-2017
Posted on Wednesday, September 20, 2017 - 04:08 pm:   

I have created a 2-way configuration where I look at the received phone number and then post to an endpoint which works correctly. When short codes are received, they do not process in the 2-way command table. I see the message come in, but no action is taking and the short codes do not trigger the end point post. Am I missing a configuration somewhere?
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 5862
Registered: 08-2008
Posted on Wednesday, September 20, 2017 - 09:26 pm:   

Hi Rodney,

What does the entry for the message show in SMSIN-yyyymmdd.log? (One reason I ask is because the received number might not match your short code...this will show you how it is set in the received message.)

Does your 2-way command definition specify a receive number or is it left blank?

The easiest way for me to troubleshoot is if you can enable the SMSDEBUG.LOG (checkbox on Serial # page)...send in more messages with debug enabled. Send me the resulting SMSDEBUG.LOG and SMSGW.INI (edit out accounts and passwords). Either post in reply here or email to nowsms@nowsms.com with Attention: Des in the email subject line. If you send via email, post a short reply here to indicate.

--
Des
NowSMS Support
Rodney Ring
New member
Username: Rring

Post Number: 2
Registered: 09-2017
Posted on Thursday, September 21, 2017 - 01:24 am:   

Hi Des,

I have captured all logs per your request and sent to the nowsms@nowsms.com email to your attention.

Thanks again for your help

Rodney
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 5865
Registered: 08-2008
Posted on Thursday, September 21, 2017 - 06:37 pm:   

Hi Rodney,

Are you sure the URL is correct?

httppost://xxxxxxxxxxx.com/api/pw_rec.php/path?phonenumber=@@recip@@&sender=@@SE NDER@@&message=@@FULLSMS@@

I can see NowSMS connecting to the server in question, and posting the details to /api/pw_rec.php/path

Are you trying to run pw_rec.php? The above URL is treating pw_rec.php as a folder name.

I'm guessing that you want:

httppost://xxxxxxxxxxx.com/api/pw_rec.php?phonenumber=@@recip@@&sender=@@SENDER@ @&message=@@FULLSMS@@

--
Des
NowSMS Support
Rodney Ring
New member
Username: Rring

Post Number: 3
Registered: 09-2017
Posted on Thursday, September 21, 2017 - 07:29 pm:   

Hi Des,

Sorry- I probably confused the original problem as an HTTP Post issue. Here is a detailed explanation of what is going on.

Upon receipt of a message( +14068781*) We have a customer that requires both an HTTP post to their endpoint along with routing the message to 2 different providers.

Provider 1 is configured as an SMSC Connection for routing normal messages.
Provider 2 is our short code vendor who is configured as an SMS user.

When we receive the message from both providers, the 2-way processor posts the messages, but the short codes route out the wrong provider. They go out the provider which has a +1* as the preferred SMSC connection which is not used for short codes.
For the provider we use for short codes, I have the following Recipient addresses to route to the user
2*,3*,4*,5*,6*,7*,8*,9*,+2*,+3*,+4*,+5*,+6*,+7*,+8*,+9*

I need the recipient number to route to
provider 1 if the sender = sender number such as +12024567899
provider 2 if the sender = a short code such as +837401 ( or route if they are received by a specific SubmitUser ?)

Thanks

Rodney
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 5867
Registered: 08-2008
Posted on Friday, September 22, 2017 - 05:42 pm:   

Hi Rodney,

OK, so the issue is more of a configuration question.

Am I correct in assuming that your 2-way command is using HTTP to resubmit the message to NowSMS?

Iff so, then the simple solution would be to include &LocalUser=ShortCodeESME in the URL, which tells NowSMS to route the message to a specific local SMS user account.

For more flexibility, you could implement accounting callbacks, which give more control over routing logic. Here's a quick example of what an accounting callback would look like for this requirement: (untested)

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

// Set default response to generic text OK
$response = "OK";

if (isset($_REQUEST['Type'])) {
if ($_REQUEST['Type'] == "SMSSend") {
if (isset($_REQUEST['Sender'])) {
$sender = $_REQUEST['Sender'];
if (strlen ($sender) <= 7) {
// Sender is a short code, override default routing
$response = "SMSCRoute=localuser:ShortCodeESME";
}
}
}
}

echo $response;

?>



--
Des
NowSMS Support
Rodney Ring
New member
Username: Rring

Post Number: 4
Registered: 09-2017
Posted on Tuesday, September 26, 2017 - 05:54 pm:   

Hi Des,

We are posting to a users endpoint upon receipt of both the shortcode and number. When the shortcode comes in it does not execute the http post or send.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 5869
Registered: 08-2008
Posted on Tuesday, September 26, 2017 - 08:15 pm:   

Hi Rodney,

I'm sorry, but I am having a difficult time understanding. Let me try again.

Please confirm that my understanding of the initial scenario is correct, or provide corrections/clarification.

Upon receipt of a message to +14068781*, you want 3 actions to occur.

1. HTTP to customer
2. SMS to provider 1 (SMSC Connection)
3. SMS to provider 2 (ESME Connection/SMS User)

Presently, such a message is routed to a 2-way command.

I am assuming that the 2-way command performs action 1. And to fulfill action 2 and 3, the 2-way command uses HTTP to resubmit 2 copies of the message to NowSMS.

Both copies of the resubmitted message get routed via provider 1.

Is my understanding correct? Any clarifications?

In my reply, I suggested 2 possible solutions:

A. When submitting the copy of the message that needs to be routed via provider 2, add &LocalUser=ShortCodeESME to the URL(where ShortCodeESME is the name of the SMS User account).
B. As a more general solution, an accounting callback could be implemented that routed all shortcodes to provider 2.

A is obviously the easiest solution.

However, a colleague of mine reminded me that there is an option C, which would route all short code messages to the ESME...without requiring any accounting callbacks.

In the SMS User account, enable accept received messages for this user, and under recipient addresses to route to this user, add ???????

? matches any of exactly one character, so it would be considered a better match for +123456 than +1*

If the + is sometimes present, sometimes not, use +??????,?????? to match both cases.

Which brings us to this:


quote:

We are posting to a users endpoint upon receipt of both the shortcode and number. When the shortcode comes in it does not execute the http post or send.




Did you implement the accounting callback?

Are you saying that now a message sent directly to the short code goes straight to the provider?

That would be true. If that is not desirable, then solution A would be preferable.


(That said, there is a config setting that makes a copy of any message that gets routed directly to an SMS user account, so that it also goes to the 2-way command processor. This would include a copy of the message that your 2-way command submits. So, if you try this setting, use caution to prevent resubmitting a message that you already resubmitted. The setting is DuplicateUserMessagesFor2Way=Yes under the [SMSGW] section.)

--
Des
NowSMS Support