Author |
Post |
|
#1 Sun Jun 20, 2010 00:07, 176 months ago.
|
Member
Registered: Jun 2009
Location: Germany
|
Operating system name and version: Windows Server 2003 + Cygwin Version of smsd: 3.1.10 Smsd installed from: sources Name and model of a modem / phone: Huawei E160 Interface: the modem has USB / but the connection uses a COM-port I tried to read the output from *100#, but i only get errors: Is there any solution??? Greets from Germany, Felix « Last edit by felix000 on Sun Jun 20, 2010 00:10, 176 months ago. »
|
|
#2 Sun Jun 20, 2010 11:43, 176 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
In this topic the first syntax was working in Germany. Have you tried if *100# works with handset?
|
|
#3 Sun Jun 20, 2010 11:59, 176 months ago.
|
Member
Registered: Jun 2009
Location: Germany
Topic owner
|
*100# works in a mobile phone with the same SIM-Card, but with the USB-Stick i can't try...
|
|
#4 Sun Jun 20, 2010 12:05, 176 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Try atd*100# in terminal.
I do not know why the CUSD does not work with your device. Do you have a manual of AT commands for it?
|
|
#5 Sun Jun 20, 2010 12:13, 176 months ago.
|
Member
Registered: Jun 2009
Location: Germany
Topic owner
|
According to this topic in huawei forum http://forum.huawei.com/jive4/thread.jspa?threadID=326991 i have to encode "*100#" in PDU-format. Do you know any online-converter? ------------ atd*100# NO CARRIER « Last edit by felix000 on Sun Jun 20, 2010 12:17, 176 months ago. »
|
|
#6 Sun Jun 20, 2010 12:26, 176 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
felix000 wrote According to this topic in huawei forum http://forum.huawei.com/jive4/thread.jspa?threadID=326991 i have to encode "*100#" in PDU-format.
Thank's for letting us know that. felix000 wrote Do you know any online-converter?
Yes I do . This PDU Converter does the job. Some other online-converters do not handle "padding characters" correctly. Also the smsd has options for encoding and decoding: -Dx decode GSM 7bit Packed string x -Ex encode string x to GSM 7bit Packed formatThose options can be used even when the smsd is running as a daemon. After the job is done, another daemon is not started. This is designed to use in the regular_run* scripts.
|
|
#7 Sun Jun 20, 2010 12:53, 176 months ago.
|
Member
Registered: Jun 2009
Location: Germany
Topic owner
|
How can i now read the balance???
|
|
#8 Sun Jun 20, 2010 13:09, 176 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Search for posts with "regular_run saldo" or "balance" in this forum. Some answers are available containing an explanation of how regular_run can be used. Check this topic too: Sample config and script for regular_run and balance of prepaid SIM using USSD. First create your USSD command using a tool. Then try it in terminal mode to see what kind of an answer you do get. If the answer is PDU encoded, you can try the modem setting ussd_convert = 2.
|
|
#9 Sun Jun 20, 2010 14:47, 176 months ago.
|
Member
Registered: Jun 2009
Location: Germany
Topic owner
|
With these settings i get an answer: but the answer is unreadable:
|
|
#10 Sun Jun 20, 2010 15:26, 176 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
It's a hexadecimal dump... Here is a support for it: in the file smsd.c, locate the following and insert lines shown bold and red: else if (is_ussd && DEVICE.ussd_convert == 2) { if (strstr(answer, "+CUSD:")) { char *p1, *p2;
if ((p1 = strchr(answer, '"'))) { p1++; if ((p2 = strchr(p1, '"'))) { snprintf(buffer, sizeof(buffer), "%.*s", (int)(p2 - p1), p1); if ((p = strdup(buffer))) { decode_7bit_packed(p, buffer, sizeof(buffer)); free(p); cut_ctrl(buffer); if (strlen(answer) < sizeof(answer) - strlen(buffer) - 4) sprintf(strchr(answer, 0), " // %s", buffer); } } } } } // 3.1.11: HEX dump: else if (is_ussd && DEVICE.ussd_convert == 4) { if (strstr(answer, "+CUSD:")) { char *p1, *p2;
if ((p1 = strchr(answer, '"'))) { p1++; if ((p2 = strchr(p1, '"'))) { snprintf(buffer, sizeof(buffer), "%.*s", (int)(p2 - p1), p1); if ((p = strdup(buffer))) { int c; int idx;
*buffer = 0; for (idx = 0; strlen(p +idx) > 1; idx += 2) { sscanf(&p[idx], "%2X", &c); sprintf(strchr(buffer, 0), "%c", (char)c); }
free(p); cut_ctrl(buffer); if (strlen(answer) < sizeof(answer) - strlen(buffer) - 4) sprintf(strchr(answer, 0), " // %s", buffer); } } } } }
if (is_ussd && DEVICE.eventhandler_ussd[0])
Save and recompile and change ussd_convert = 4 in the smsd.conf. Let me know how this works, I have not tested this code... « Last edit by keke on Sun Jun 20, 2010 18:17, 176 months ago. »
|
|
#11 Sun Jun 20, 2010 15:38, 176 months ago.
|
Member
Registered: Jun 2009
Location: Germany
Topic owner
|
wow, thanks für this special support!!!
There is a compile-error: smsd.c: In function `cmd_to_modem': smsd.c:5182: error: `str' undeclared (first use in this function)
|
|
#12 Sun Jun 20, 2010 15:46, 176 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
And because BBCode is switched on, there was another problem with a variable name "i" inside brackets... I have edited the posting, copy the block again and try...
|
|
#13 Sun Jun 20, 2010 15:48, 176 months ago.
|
Member
Registered: Jun 2009
Location: Germany
Topic owner
|
Great, it works!!!
2010-06-20 17:48:06,5, surfstick: CMD: AT+CUSD=1,"AA180C3602",15: OK +CUSD: 0,"20416B7475656C6C657320477574686162656E3A2031332E3734204555522E",0 // Aktuelles Guthaben: 13.74 EUR.
|
|
#14 Sun Jun 20, 2010 18:27, 176 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
I made on small change to the code, the value for the setting ussd_convert is now 4 with ASCII hexdump. This is because of future enhancements.
The next version will have this feature, as you surely noticed from the comment in the code. If you change that value to "4" in your code and setup, your setup will be compatible with the next version, without any confusion.
|