Asterisk 1.6.2 Chan_mobile for bug: ${SMS SRC} = empty
Edit ‘chan_mobile.c’ (…/asterisk-addons-1.6.2.x/channels/chan_mobile.c)
locate the following lines:
[i]
case 1: /* find the opening quote (") /
if (buf[i] == ‘"’) {
state++;
}
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 = ‘\0’;
state++;
}
break;
Change to:
[i]
case 1: / find the opening quote (") /
if (buf[i] == ‘"’) {
state++;
}
[color=#FF0000]break;[/color]
case 2: / mark the start of the number */
if (from_number) {
from_number = &buf[i];
state++;
}
[color=#FF0000]break;[/color]
/ fall through /
case 3: / search for the end of the number (") */
if (buf[i] == ‘"’) {
buf = ‘\0’;
state++;
}
break;
Save and recompile Asterisk Addons:
su - root
cd /asterisk-addons-1.6.2.x
./configure
make
make install
Than restart Asterisk.
Example to receive an SMS and then forward it by email:
[from-pstn]
exten => sms,1,Verbose(Incoming SMS from ${SMSSRC} ${SMSTXT})
exten => sms,2,System(echo “To: myself@yahoo.com” > /tmp/smsmail)
exten => sms,3,System(echo “Subject: SMS received from ${SMSSRC}” >> /tmp/smsmail)
exten => sms,4,System(echo “${SMSTXT}” >> /tmp/smsmail)
exten => sms,5,System(sendmail -t -f ${SMSSRC}@localhost < /tmp/smsmail)
exten => sms,6,Hangup()
Maurizio
ditta.com
Linux software: “hodge-podge assortments of files, & poor instructions to make something work. Usually many steps are required to get it working & if anything goes wrong you get nothing”.