[Home]

Summary:ASTERISK-16822: Channel Variable SMSSRC not set properly
Reporter:menschentier (menschentier)Labels:
Date Opened:2010-10-17 20:36:53Date Closed:2013-01-15 22:19:24.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Addons/chan_mobile
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) fixSMSSRC.patch
( 1) fixSMSSRC.patch
Description:to make it simple - did not work before - works now

function changed:

static int hfp_parse_cmgr(struct hfp_pvt *hfp, char *buf, char **from_number, char **text)
{
int i, state;
size_t s;

/* parse cmgr info in the following format:
* +CMGR: <msg status>,"+123456789",...\r\n
* <message text>
*/
state = 0;
s = strlen(buf);
for (i = 0; i < s && state != 6; i++) { //not s != 6.....
switch (state) {
case 0: /* search for start of the number section (,) */
if (buf[i] == ',') {
state++;
}
break;
case 1: /* find the opening quote (") */
if (buf[i] == '"') {
state++;
}
break; //made it break here
case 2: /* mark the start of the number */
if (from_number) {
*from_number = &buf[i];
state++;
}
/* fall through */
case 3: /* search for the end of the number (") */
if (buf[i] == '"') {
buf[i] = '\0';
state++;
}
break;
case 4: /* search for the start of the message text (\n) */
if (buf[i] == '\n') {
state++;
}
break;
case 5: /* mark the start of the message text */
if (text) {
*text = &buf[i];
state++;
}
break;
}
}

if (state != 6) {
return -1;
}

return 0;
}




****** ADDITIONAL INFORMATION ******

after spending two days to get chan_mobile working for me the last unsolved issue gave me no peace and I started looking at the code...
I'm not a big programmer and until tonight I've never done c before - so all the pointer stuff is quite confusing to me. May the original author take this, improve it and maybe include something like ${SMSDATE} and ${SMSTIME} which would be really nice to have

i tested several times - it never worked with my nokia 6230i, after bugfixing, it does - i finally get sms on my jabber account with the number displayed :)

greetings...

Comments:By: Digium Subversion (svnbot) 2010-10-18 12:11:46

Repository: asterisk-addons
Revision: 1136

U   branches/1.6.2/channels/chan_mobile.c

------------------------------------------------------------------------
r1136 | mnicholson | 2010-10-18 12:11:45 -0500 (Mon, 18 Oct 2010) | 6 lines

Fix cmgr parser.

(closes issue ASTERISK-16822)
Reported by: menschentier


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=1136

By: menschentier (menschentier) 2010-10-20 14:25:02

needs a break behind switch 1 to work - fall through only between 2 and 3
lines 2029 / 2030

tested with latest svn-trunk 292377

cheers

By: menschentier (menschentier) 2011-03-10 01:10:47.000-0600

Updated recently to asterisk 1.8.3

Incoming SMS still do not work.

My working example:
exten => sms,1,Answer()
exten => sms,2,JabberSend(asterisk,xxx@jabber.xxx.de,SMS von ${SMSSRC} erhalten)
exten => sms,3,Verbose(${SMSSRC})
exten => sms,4,JabberSend(asterisk,wolf@jabber.xxx.de,${SMSTXT})
exten => sms,5,Hangup()

willing to test anything that might work

greetings

Simon

By: Jonas Falck (jonaz) 2011-11-02 18:00:16.825-0500

Can someone please bugfix this?
SMSSRC is not working.

The solution:

Adding a break; on line 2236 in the 1st case in the switch. (branch 1.8.7.1 revision 333784)


I've tested this by changeing and then recompile and test incoming SMS.

By: Jonas Falck (jonaz) 2011-11-02 18:14:41.136-0500

Patch to add the missing break;

Seems my files are not attached. Maybe someone with patch/license can fix it?