SMS Server Tools 3
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon. Fri Mar 14, 2025 10:47
SMSTools3 Community » Search Bottom

Page:  1

Keywords:
Mode: All keywords (AND)
clumsy: Hi yes!! installed it last week (beta4) and it works like a charm! thanks a lot!! great work! rgds
clumsy: ok. let me know if I can be of any further help (at least for testing then). btw: great sowftware!
clumsy: No worries, the hack is simple, first in smsd.c --- smsd.c.orig 2009-11-30 18:53:22.000000000 +0100 +++ smsd.c 2010-03-23 07:43:58.000000000 +0100 @@ -4847,6 +4847,8 @@ if (*answer) { char timestamp[81]; + char answer_a[256] = ""; + char tmpanswer[256] = ""; time_t now; time(&now); @@ -4861,6 +4863,21 @@ if (*answer == ' ') strcpy(answer, answer +1); + if ((p = strstr(answer, "+CUSD: 0"))) { + strncpy(tmpanswer, p+10, strlen(p)-15); + tmpanswer[strlen(p)-5] = '\0'; +#ifdef DEBUGMSG + printf("convert to text: %s\n", tmpanswer); +#endif + if (toASCII(tmpanswer, answer_a) < 0) { +// todo + } +#ifdef DEBUGMSG + printf("text converted: %s\n", answer_a); +#endif + + } + if (DEVICE.dev_rr_logfile[0]) { while (log_retry-- > 0) @@ -4868,8 +4885,8 @@ // NOTE: log files use mode 640 as a fixed value. if ((fd = open(DEVICE.dev_rr_logfile, O_APPEND|O_WRONLY|O_CREAT, 0640)) >= 0) { - snprintf(buffer, sizeof(buffer), "%s,%i, %s: CMD: %s: %s\n", - timestamp, DEVICE.dev_rr_loglevel, DEVICE.name, command, answer); + snprintf(buffer, sizeof(buffer), "%s,%i, %s: CMD: %s: %s // %s\n", + timestamp, DEVICE.dev_rr_loglevel, DEVICE.name, command, answer, answer_a); write(fd, buffer, strlen(buffer)); close(fd); break; @@ -4885,7 +4902,7 @@ } } else - writelogfile(DEVICE.dev_rr_loglevel, 0, "CMD: %s: %s", command, answer); + writelogfile(DEVICE.dev_rr_loglevel, 0, "CMD: %s: %s // %s", command, answer, answer_a); // 3.1.5: If signal quality was checked, explain it to the log: if (!strcasecmp(cmd, "AT+CSQ\r")) @@ -4897,10 +4914,10 @@ //if ((fd = open(DEVICE.dev_rr_statfile, O_APPEND | O_WRONLY | O_CREAT, 0640)) >= 0) if ((fp = fopen(DEVICE.dev_rr_statfile, "a"))) { - //snprintf(buffer, sizeof(buffer), "%s,%i, %s: CMD: %s: %s\n", timestamp, LOG_NOTICE, DEVICE.name, command, answer); + //snprintf(buffer, sizeof(buffer), "%s,%i, %s: CMD: %s: %s // %s\n", timestamp, LOG_NOTICE, DEVICE.name, command, answer, answer_a); //write(fd, buffer, strlen(buffer)); //close(fd); - fprintf(fp, "%s,%i, %s: CMD: %s: %s\n", timestamp, LOG_NOTICE, DEVICE.name, command, answer); + fprintf(fp, "%s,%i, %s: CMD: %s: %s // %s\n", timestamp, LOG_NOTICE, DEVICE.name, command, answer, answer_a); fclose(fp); } else and pduconv.c (found somewhere in the net): unsigned char send[160]; //////////////////////////////////////////////////////////////////////////////// void toPDU(char *asci, char *temp) { unsigned short pos=0, get=1, count=0,h=0,len=0; len=strlen(asci); if(15>=len>= 8 ) len--; else len=len-(len/8 ); while (pos!=len) { switch (count) { case 0: get=1; break; case 1: get=3; break; case 2: get=7; break; case 3: get=15; break; case 4: get=31; break; case 5: get=63; break; case 6: get=127; break; } temp[pos]=( asci[pos+h]>>count) | (( asci[pos+(h+1)]& get)<<(7-count)); pos++; count++; if (count>6) count=0, h++; } } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// void toASCII(char *asci, char temp[]) { unsigned short pos=0, get1=127, get2=128, count=0,h=0,len=0, alpha=0,mem0=0,mem1=0; unsigned short convert[160]; len=strlen(asci); while(*asci) { alpha=*asci; switch (alpha ) { case 48: alpha=0; break; case 49: alpha=1; break; case 50: alpha=2; break; case 51: alpha=3; break; case 52: alpha=4; break; case 53: alpha=5; break; case 54: alpha=6; break; case 55: alpha=7; break; case 56: alpha=8; break; case 57: alpha=9; break; case 65: alpha=10; break; case 66: alpha=11; break; case 67: alpha=12; break; case 68: alpha=13; break; case 69: alpha=14; break; case 70: alpha=15; break; } convert[pos]=alpha; pos++; *asci++; } pos=0; while (pos!=len) { convert[pos]=(convert[pos+pos]*16)+ convert[pos+pos+1]; pos++; } pos=0; count=0; while (pos!=(len/2+h)) { switch (count) { case 0: get1=127; get2=128; break; case 1: get1=63; get2=128; break; case 2: get1=31; get2=192; break; case 3: get1=15; get2=224; break; case 4: get1=7; get2=240; break; case 5: get1=3; get2=248; break; case 6: get1=1; get2=252; break; } temp[pos]=((convert[pos-h]& get1)<<(count)) | ((convert[pos-h-1]& get2) >>(7-(count-1))); pos++; count++; if(count==7) { temp[pos]=convert[pos-h-1]>>1; convert[pos-h-1]=0; pos++; count=0; h++; } } } //////////////////////////////////////////////////////////////////////////////// pduconv.c needs to be added in the makefile and compiled in... I'm sorry for the coding style, but that's all I'm able to ;)
clumsy: It seems that my modem (HUAWEI 1762) is only able to use the +CUSD command in PDU mode (eg. to check balance: AT+CUSD=1,"AAD80C3602",15 instead of AT+CUSD=1,"*130#",15.. also the answer is in PDU format. I wrote a quick hack to decode the PDU with a simple C-Routine I found somewhere (if anyone interested).. However, any chance of a "standard" PDU encoding and decoding for +CUSD messages within the original smsools anytime soon? regards STefan PS: original and changed loglines: 2010-03-22 16:07:16,5, GSM1: CMD: AT+CUSD=1,"AAD80C3602",15: OK +CUSD: 0,"49B41C242DCFE9E73A1D1D1697DDA0F49C0E1A228DA0188E85BB01",15 2010-03-22 16:07:16,5, GSM1: CMD: AT+CUSD=1,"AAD80C3602",15: OK +CUSD: 0,"49B41C242DCFE9E73A1D1D1697DDA0F49C0E1A228DA0188E85BB01",15 // Ihr Restguthaben ist CHF 18,87

Page:  1

SMSTools3 Community » Search Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.