How to setup two applications using same GSM modem?

How to setup two applications using same GSM modem? SearchSearch
Author Message
Frank Grygus
New member
Username: Fgrygus

Post Number: 7
Registered: 08-2007
Posted on Wednesday, April 08, 2009 - 04:19 am:   

Gents,

Trying to figure out how to setup a second application on the same GSM modem. My current configuration consists of a MultiTech GSM modem with receive SMS messages check and route SMS to local user selected. The local user is a unique bind that an application is making to send and receive sms. This works great!

Using the same GSM modem, how can I add a second application(different user name in the bind) where incoming SMS can be route to the appropriate application? I was looking at this from a sms command prefix or shortcode. How would I populate the 2-Way SMS entry for this? Basically both applications can send SMS without issue, but when SMS arrives at the GSM modem, how can I route back to each application? Range routing is not an option, as I don't know the sender addresses.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 673
Registered: 08-2008
Posted on Thursday, April 09, 2009 - 04:26 pm:   

Hi Frank,

The only way that you can do this is by SMS command prefix routing.

But it's more than a little confusing configuring this. I'm pretty sure that Bryce wrote something up about how to do this, but my searches aren't finding anything ... so let me try to explain.

You're going to disable the setting to route the received SMS to a local user.

Instead, you're going to use 2-way SMS commands.

These 2-way commands are going to submit the message back to NowSMS, routing it to a local user account.

Define one 2-way command for the account that only gets certain prefix messages. And then define another 2-way command for the other account with a wildcard * command prefix to catch all other messages.

Use a 2-way command that is something like this:

http://127.0.0.1:8800/?user=username&password=password&localuser=useraccount&pho nenumber=@@RECIP@@&sender=@@SENDER@@&text=@@FULLSMS@@&UDH=@@UDH@@&DCS=@@DCS@@&PI D=@@PID@@

"user=username&password=password" needs to be a valid "SMS Users" account on your system. NowSMS is going to connect to itself and resubmit the received message using these account details.

"localuser=useraccount" is the part that specifies which of your local user accounts the message should be routed into.

It's a kludge, but workable.

--
Des
NowSMS Support
Frank Grygus
New member
Username: Fgrygus

Post Number: 8
Registered: 08-2007
Posted on Tuesday, April 14, 2009 - 05:35 am:   

Des,

I like it! This is exactly what I was looking for.

So for the SMS Command Prefix, I can make it a number or alpha numeric?

Second, if I understand this correctly, the more explicit 2-way SMS command prefixes should go first; assuming the table is read top down. The wild card "*" should be last and can be the catch all to route all remaining 2-way SMS to a different localuser as default.

Excellent!
Frank Grygus
New member
Username: Fgrygus

Post Number: 9
Registered: 08-2007
Posted on Tuesday, April 14, 2009 - 05:47 am:   

Des,

Another quick question, how would you recommend to capture the true destination address? The SMS Command Prefix allows me to resubmit the incoming 2-way sms to NowSMS-GW but only the sender is truely known. The recipient number is that of the GSM-Modem(SIM). Is there a way to instruct the SMSC-GW to look at the second word in the incoming SMS for a true destination address which it can pass along to the application that is identified by localuser=localaccount?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 7767
Registered: 10-2002
Posted on Wednesday, April 15, 2009 - 01:44 pm:   

Hi Frank,

Yes, the SMS Command Prefix can be numeric or alpha numeric. The only consideration is that it can only contain English/Latin numbers and alpha characters (basically anything in iso-8859-1, including a bunch of symbols), as this one area does not handle UTF-8 properly.

The choice of command is based upon the length of the match, so "*" counts as only a 1 character match. If you have any commands that you want to match only a single character, use "X*" to make it count as 2 characters in the matching logic. (* matches any number of characters, including 0.)

-bn
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 7768
Registered: 10-2002
Posted on Wednesday, April 15, 2009 - 01:52 pm:   

Regarding the follow-up question ... no, unfortunately there is no logic for parsing more parameters from the text in the 2-way command template.

It's an interesting idea, but unfortunately, no you can't.

If you're into PHP, Des did recently post a PHP example that parses individual words from a received SMS into a separate strings here: http://support.nowsms.com/discus/messages/1/24891.html

But, that would complicate your logic considerably. You would route received messages to a PHP script running on another web server. The PHP script would perform further parsing of the received message, and it would then issue a URL redirect back to NowSMS where the new URL tells NowSMS what message to submit back to the local user account. (An example of how to do this type of redirect in a PHP script can be found here: http://support.nowsms.com/discus/messages/1/3991.html)

Admittedly, that's a lot more complicated than the simple example above. If you have a little PHP experience, it's a few hours work. If you don't, then I wouldn't really consider it as an option.

-bn