Summary:ASTERISK-08349: [patch] extend app_SMS to support protocol 2 (in use in Italy, Spain, xxx)
Reporter:Filippo Grassilli (hyppo)Labels:
Date Opened:2006-12-14 07:40:04.000-0600Date Closed:2006-12-22 04:52:55.000-0600
Versions:Frequency of
Environment:Attachments:( 0) sms_over_pstn_protocol2.patch
Description:I've implemented ETSI ES 201 912 protocol 2 used in my country, Italy, and Spain as I know.
It works fine, some other users used this patch I published on my site.


Parameters for Telecom Italia:
SMSC 4211 for outgoing and 042111 for incoming
dialplan example:
exten => s,n,GotoIf($["${CALLERID(NUM)" = "04211"]?sms-in,1)
exten => sms-in,1,Answer
exten => sms-in,n,SMS(inmsg|at)         ; 't' is for protocol 2!
exten => sms-in,n,Hangup

Notice that if you want to use smsc to send, you must patch smsq.c adding 't' parameter in "Data:" parameter (line 162).
Comments:By: Serge Vecher (serge-v) 2006-12-14 09:24:42.000-0600

nice patch, thanks, hyppo. Could you please have some users of your patch confirm their results with quick (or extensive if they wish) note in this report?

By: Filippo Grassilli (hyppo) 2006-12-19 09:15:48.000-0600

Note that the patch "sms_over_pstn_protocol2.patch" applies ONLY to SVN branch 1.2 and NOT to asterisk source distribution (1.2.12 and latest 1.2.13 when writing).
To patch the asterisk app_sms.c distributed, until this patch will not be part of the official distribution, please see at http://hyppo.com/asterisk

Please report here your experience, to confirm to Digium that the functionality works correctly (and to have this patch integrated in std distro for next releases!!)

By: Serge Vecher (serge-v) 2006-12-19 12:23:02.000-0600

hyppo: also, please produce the patch against current trunk, as that will be the base patch integrated into the official tree.

By: Filippo Grassilli (hyppo) 2006-12-19 12:24:39.000-0600

To Digium People:
1) What is pid (defined as Protocol ID) in smsq? Is what I think?
Can I use that switch to patch smsq to make it use protocol 2?
2) Could you please move my comment (0056623) to the main body of my post?
Read post by serge: I could make a patch against 1.4 (trunk), but can't test asterisk 1.4.X, I saw there are not many changes from 1.2.x to 1.4.x

By: Luigi Rizzo (rizzo) 2006-12-19 15:04:23.000-0600

i will take care of this since i can test it on trunk.

By: Julian J. M. (julianjm) 2006-12-20 18:30:45.000-0600

It works for me. However, I don't really like the queue system. One doesn't know if a sms was correctly delivered (0x15) or rejected (0x13) by the sms center. In any case, the job file is deleted.

By: Michele B (mik) 2006-12-21 04:25:32.000-0600

I got some trouble to get it working in receiving, as it seems that you have to make the Answer() as soon as you call the SMS application, and CAN'T switch between contexts when you have already called the Answer().
In the example below i got it NON-WORKING:

exten => s,1,Answer()
exten => s,n,GotoIf($["${CALLERID(num)}" ="042111"]?sms-in,s,1)
exten => s,n, ....

exten => s,1,NoOp(SMS Detected. Starting Handler.)
exten => s,n,SMS(${SMS_QUEUE}|ta)
exten => s,n,Hangup()

I resolved this issue by putting an Answer() below the GotoIf() and adding another one before the SMS(). I can finally say that this app works really fine.
Well done, Filippo.

By: Luigi Rizzo (rizzo) 2006-12-21 04:35:53.000-0600

Re. the Answer() comment:
One thing to remember is that there are bounds on the delay between
messages, including the initial message from the SMS application
to the phone. For the two phones i have, these delays are
in the order of 100-200ms.

So in order for SMS to work reliably, you cannot have too much time
between Answer() (which is unnecessary as as the SMS app does
it by itself) and the call of SMS().
Also, you should use short frames and disable or keep short the
jitter buffer to avoid excessive delays.

By: Luigi Rizzo (rizzo) 2006-12-22 04:52:54.000-0600

i have merged the code in trunk, with some (mostly style) modifications.
Unfortunately i don't have suitable hardware to test the new feature,
but hopefully people will be able to try it and submit reports.