USSD on Huawei Modems (E156G)

USSD on Huawei Modems (E156G) SearchSearch
Author Message
Joseph
New member
Username: Jkaizzi

Post Number: 1
Registered: 03-2011
Posted on Thursday, March 17, 2011 - 08:34 am:   

Hi there. I recently started using NowSMS Server and I must say: Its a great tool! Being a novice user I encountered a few difficulties but managed to find solutions on your forum.

However, there's just one issue I've failed to find a solution for. Am running nowsms server with 5 modems connected to one desktop computer. The modems have sim-cards from the different providers here in my country. The application I built runs in such a way that each time a user send in an SMS to any of the modem phone numbers, it should reimburse the sender whatever costs they used to send the sms in i.e. when you send in a message, the system automatically initiates a credit share algorithm which is telecom network dependent.

Some of the networks support sharing your balance via sms i.e. Give<space>The Recipient Number<space>The Amount. Which works well for me! However, some only support balance sharing via USSD e.g. *155*The Recipient*The Ammount#. To execute USSD requests on a modem, I'd have to use custom AT Commands (AT+CUSD=?) since NowSMS Server does not support it on the interface. I know about the CommandPreInit#, CommandPostInit#,CommandPreSend# and CommandPostSend# options in the SMSGW.IN file that enable you to send custom AT commands to the modem. However, the USSD requests I want to make are not fixed, the parameters keep changing depending on the received message. Is there a way I can send AT Commands via the post back URL for sending messages? e.g. http://127.0.0.1:8800/?AT=AT+CUSD&PhoneNumber=xxxxxxxx&

Am thinking of rewriting the SMSGW.INI file on the fly with the new commands, but haven't yet gotten to it. It seems so crude and could cause problems.

Any thoughts, ideas are welcome.

Regards,

Joseph.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3021
Registered: 08-2008
Posted on Thursday, March 17, 2011 - 10:02 pm:   

Hi Joseph,

That's an interesting scenario that you describe.

We've had others ask for the ability to send custom USSD commands for the purpose of being able to check the available credit on a pre-pay SIM that is in a modem.

The problem is ... USSD is a query/response type of system.

In your case, it might be ok to just be able to queue a command for sending. But most of the time, I think people would want to see the response that comes back. (And it could get more complicated, as the response might be a menu with options, where your command wants to automatically pick one of those options.)

Basically, there don't seem to be an easy solutions for how we can implement this in a way that would work for different scenarios.

Is your situation truly a send command only scenario?

We might be able to explore implementing something simple.

Do you have any experience with formatting and using the actual AT+CUSD commands? (Since we don't have any experience, I'd be concerned with issues like how to make sure sessions are properly closed so that we know another session can be initiated, and so the modem doesn't end up in an unstable state.)

--
Des
NowSMS Support
Joseph
New member
Username: Jkaizzi

Post Number: 2
Registered: 03-2011
Posted on Thursday, March 17, 2011 - 10:14 pm:   

Thanks a lot for your timely response.

For my scenario, the USSD response returned is just text - more like a confirmation of a successful transaction. No menu's whatsoever.

It is truly a send command scenario but wouldn't mind the responses since its only plain text.

About formating the AT+CUSD commands, am fairly experienced. Below is a simple command I can use to check the credit balance on the modem simcard.

AT+CUSD=1,"AA58CD3602",15

A simple implementation would be highly appreciated.

Kind Regards,

Joseph.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3024
Registered: 08-2008
Posted on Saturday, March 19, 2011 - 12:07 am:   

Joseph,

What type of response do you get back?

Is it +CUSD: xxxxxxx and then an OK?

I am investigating getting some custom AT command functionality into a test release.

My assumption is that the commands may return some info, followed by an OK or ERROR/CMS ERROR type of response.

Unfortunately, I can't make any quick turnaround promises, but I think this is an interesting idea, and I am trying to get it into the development schedule in the next 3 weeks.

--
Des
NowSMS Support
Joseph
New member
Username: Jkaizzi

Post Number: 3
Registered: 03-2011
Posted on Saturday, March 19, 2011 - 07:15 am:   

Exactly that. Though the response is usually encoded e.g. something like would this AT+CUSD=1,"AA58CD3602",15 would return

OK
+CUSD: 0,"D9775D0E0A8FC7EFBA9B0E1287D961F7B80C4ACF41D5231624C3CD60A026D5091A86D9ECB29C5 A7797F520E97BBC06E5DF7539681866B3CBF2B90B647CCB41D9A734997D4A933A500D569BC558A0A 0F358640675A01A4C2683C1622CD09359756693CCA434A903D560B61A2EE6024D9B53D0BA9CBFBFE 5641D885A7516412BD0F84D2E83E86F50EC0603",15

Decoding it: Your balance is ....

As a quick fix, am going to try rewriting the SMSGW.INI on the fly with the required AT Commands and also deleting those that are no longer required. Think that will work?

Hope to hear from you soon.


REgards,

Joseph.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 3027
Registered: 08-2008
Posted on Monday, March 21, 2011 - 11:00 am:   

Hi Joseph,

Whether or not the INI file approach would work depends on your volume.

I'd also be concerned about timing and the possibility of some commands being sent more than once.

It would be difficult to know whether or not a command had been issued so that you could remove it. And there is an additional timing issue in that the INI file is cached in memory and changes are only checked for periodically. (I think this check interval is 5 seconds, but I am not certain.)

--
Des
NowSMS Support