Summary:ASTERISK-12133: [patch] smsq does not work in asterisk 1.6
Reporter:ph (ph)Labels:
Date Opened:2008-06-03 06:53:40Date Closed:2009-12-23 07:45:26.000-0600
Versions:Frequency of
is related toASTERISK-18165 sms sending does not work
Environment:Attachments:( 0) 20080617__bug12779.diff.txt
( 1) app_sms_options.diff.txt
Description:smsq which works well in asterisk 1.4, does not work
in the same way on 1.6 :

 -- Attempting call on mISDN/1/0809101000 for application SMS(0) (Retry
      > Channel mISDN/1-u5 was answered.
      > Launching SMS(0) on mISDN/1-u5
sms argc 1 queue <0> opts <> addr <> body <>
initial delay 300ms
   -- SMS RX 93 00 6D
   -- SMS TX 91 16 01 01 0A 81 60 70 47 90 10 00 F1 0B E8 32 9B FD 06
DD DF 72 36 19
   -- SMS RX 95 09 01 00 80 50 62 90 71 32 80 7C
   -- SMS TX 94 00
[May 26 09:37:30] NOTICE[6747]: app_sms.c:1904 sms_exec: ast_read failed
[May 26 09:37:30] NOTICE[6747]: pbx_spool.c:333 attempt_thread: Call
completed to mISDN/1/0809101000

Comments:By: Joshua C. Colp (jcolp) 2008-06-03 08:39:53

Protocol version 2 support was added to app_sms, it is possible that the addition is what is causing this issue.

By: Tilghman Lesher (tilghman) 2008-06-17 18:08:28

Actually, I think this tiny patch might fix it.  Could you please test this and report back on whether it fixes your issue?

By: ph (ph) 2008-06-23 04:58:37

Hi Corydon76,

Sorry, but the patch

*CLI>     -- Attempting call on mISDN/1/0809101000 for application SMS(0) (Retry 1)
      > Channel mISDN/1-u1 was answered.
      > Launching SMS(0) on mISDN/1-u1
sms argc 1 queue <0> opts <> addr <> body <>
initial delay 300ms
   -- SMS RX 93 00 6D
   -- SMS TX 91 16 05 00 0A 81 60 70 47 90 10 00 F1 0B E8 32 9B FD 06 DD DF 72 36 19
   -- SMS RX 95 09 01 00 80 60 32 11 85 70 80 C9
   -- SMS TX 91 16 01 01 0A 81 60 70 47 90 10 00 F1 0B E8 32 9B FD 06 DD DF 72 36 19
   -- SMS RX 95 09 01 00 80 60 32 11 85 80 80 B9
   -- SMS TX 94 00
[Jun 23 12:05:16] NOTICE[10148]: app_sms.c:1904 sms_exec: ast_read failed
[Jun 23 12:05:16] NOTICE[10148]: pbx_spool.c:333 attempt_thread: Call completed to mISDN/1/0809101000


By: ph (ph) 2008-06-30 08:24:43

More details, I used :
- asterisk trunk
- debian lenny (kernel 2.6.24)
- mISDN 1.1.8 (latest version)
- HFC Cologne card (Dial application works - But not smsq)

One student told me that it worked with
- Digium B410P card

Hope this can help ...

By: Alec Davis (alecdavis) 2008-10-12 20:09:32

Is there any work being done to get smsq to work again in 1.6.

I saw an interesting article on our local news where Appointment Texts are being used by hospitals to advise clients of an upcoming appointment, albeit at a cost of NZ$4500 per month for the service.
Reference: http://tvnz.co.nz/view/page/411416/2193539


By: Leif Madsen (lmadsen) 2009-03-02 17:50:44.000-0600

Assigning this issue to dvossel to take a look. Feel free to unassign yourself if you feel you can't make any progress here. Thanks!

By: Bernd Casimir (bmc) 2009-03-08 12:04:04

I had exactly the same problem:
SMS delivery was working in Asterisk 1.4.21 and it is broken in Asterisk

I have two kind of SMS capable devices:
Siemens Gigaset CX450 ISDN connected via HFC Cologne Card (mISDN 1_1_9.1)
Siemens Gigaset 4010 Comfort via TDM400P (dahdi-linux-

Both devices were working before and are broken now.
Therefore I am sure it is not related to the driver infrastructure (mISDN or dahdi).

If I should provide more details of the problem or test some patches you can contact me.

By: Alec Davis (alecdavis) 2009-03-08 15:44:38

We have a number of SMS capable devices we'd like to be able to send from.

Multiple Ericsson F250M and F220m connected via a TDM400P.
Multiple ITS Telecom's CGW-I ISDN connected through ISDN switch connected via TE220P.

SMS receiving (Protocol 2) is working with Ericsson F250m's. Not yet tried with ISDN connected devices.

By: David Vossel (dvossel) 2009-03-11 16:53:14

I can look at this issue if someone can set me up some remote test equipment to work with.

By: Bernd Casimir (bmc) 2009-03-15 15:02:51

Unfortunately my production system is running on SLAX (booting from a FLASH card) and I have to compile the modules on a second system but if you can add as much debug output as possible to the current app_sms.c I can compile a new module and tell you the results of my tests...

By: Alec Davis (alecdavis) 2009-03-16 15:37:40

dvossel: I can set up equipment, did you get my email offline?

By: Leif Madsen (lmadsen) 2009-03-18 08:43:51

w00t! Thanks for stepping up alecdavis!

By: David Vossel (dvossel) 2009-03-20 09:40:23

We've started looking into this issue, but honestly we have very little experience with this technology.  If someone would be willing to break down exactly what the issue is, describing how you have Asterisk setup and specifically what is failing, it would help move this issue along.   I'd be more than willing to discus this in IRC as well.  My nick is "The_Boy_Wonder".

By: Leif Madsen (lmadsen) 2009-03-20 10:34:23

Status changed to feedback as we need to hear from people so we can move this issue forward.

By: Alec Davis (alecdavis) 2009-03-21 05:10:46

uploaded app_sms_options.diff.txt which cleans up 'help' text, also grammer error in Description.

'addr and body are a deprecated...' were on the end of the 'p' option.

   p: Set the initial delay to N ms (default is '300'). addr and body
   are a deprecated format to send messages out.

Now 'core show application sms' shows from [Syntax] down;

   The name of the queue used in "/var/spool/asterisk/sms"
   a: Answer, i.e. send initial FSK packet.
   s: Act as service centre talking to a phone.
   t: Use protocol 2 (default used is protocol 1).
   p: Set the initial delay to N ms (default is '300').
   r: Set the Status Report Request (SRR) bit.
   o: The body should be coded as octets not 7-bit symbols.
   addr and body are a deprecated format to send messages out.
    see addr above.

By: Alec Davis (alecdavis) 2009-03-21 05:20:01

Sample configuration to receive sms messages, calls come into the '[cellular]' context from callerid 042111 the vodafone SMS service centre.

exten => 2345,1,Dial(DAHDI/32,20,rt)
exten => 2346,1,Dial(DAHDI/33,20,rt)

exten => s,1,NoOp(Callerid = ${CALLERID(all)})
exten => s,n,GotoIf($["${CALLERID(num)}"="042111"]?SMSMessage)

exten => s,n,Dial(DAHDI/32,20,rt)
exten => s,n,Hangup()

exten => s,n(SMSMessage),NoOp( SMS MESSAGE )
exten => s,n,SMS(sms,at)
exten => s,n,NoOp( Wont Get Here)
exten => s,n,Hangup()

exten => h,1,NoOp( Send SMS to Email)
exten => h,n,GotoIf($["${CALLERID(num)}"!="042111"]?noSMSMessage)
exten => h,n,System(/usr/lib/asterisk/sms-email)
exten => h,n(noSMSMessage),Hangup()

Although deprecated, I understood that SMS send should also work, but this is why this bug exists, SMSQ and SMS send do not work.

To test this, although I have SMS equipment, I believe, on the same Asterisk box we should be able to use SMS (send) to an SMS (receive) extension.

By: Alec Davis (alecdavis) 2009-03-31 16:48:12

Our Ericcson F250m equipment looks like it's only any good for receiving.

The programming manual I have for it, has a slight hint which I was hoping would be a worker.
The hint is to "set the 2 wire line for one of the following options, SMS protocol 1, SMS protocol 2, or DA20" but I may have been reading too much into this, the too much bit being 'sending'.

Unless the F250m supports SMS sending via FSK signalling while OnHook as CallerId units do? But I think that is getting a bit proprietary for SMSQ.

By: Leif Madsen (lmadsen) 2009-05-11 15:44:55

So do we have any ability to move this issue forward, or are we at a stand-still until someone can provide the equipment necessary to reproduce the issue? What is it that we actually need in order to move this issue to a conclusion?

By: Alec Davis (alecdavis) 2009-05-11 17:51:44

Another way of thinking of it is the same as sending a FAX, asterisk can send a fax to itself, although pointless, it can be done.

I believe a test setup should be able to be made to work without any 'sms equipment' other than asterisk using SMSQ to send an SMS text to another extension that will use SMS to receive the text.

This should then get the basic communication path ready for testing, but I'm unaware of any public PSTN service centre numbers here in NZ.

By: Bernd Casimir (bmc) 2009-05-20 14:30:20

What I don't understand:
In 1.4.x app_sms.c was written by Adrian Kennard and it was working fine.
Beginning with 1.6.x app_sms.c was modified by Filippo Grassilli:

* \author Adrian Kennard (for the original protocol 1 code)
* \author Filippo Grassilli (Hyppo) - protocol 2 support
*   Not fully tested, under development

Therefore I think you have two options:
1. Go back to the working code of Adrian Kennard
2. Contact Filippo Grassilli to help us debugging.
He marks the code "not fully tested" - therefore it should not be implemented in a production version!

If more debugging code is added I can test the result with my hardware.
Unfortunately I don't understand the code so it is very difficult for me to add the code which is necessary for debugging....

By: Bernd Casimir (bmc) 2009-05-21 14:32:29

UPDATE: Today I installed Asterisk and SMS delivery is working again!
asterisk*CLI> core show version
Asterisk built by root @ slax on a i686 running Linux on 2009-02-24 22:24:10 UTC
   -- Attempting call on mISDN/g:intern1/51 for application SMS(0|s) (Retry 1)
      > Channel mISDN/0-u449 was answered.
      > Launching SMS(0|s) on mISDN/0-u449
sms argc 1 queue <0|s> opts <> addr <> body <>
initial delay 300ms
   -- SMS RX 93 00 6D
   -- SMS TX 94 00
[May 21 13:42:25] NOTICE[13311]: app_sms.c:1904 sms_exec: ast_read failed
[May 21 13:42:25] NOTICE[13311]: pbx_spool.c:357 attempt_thread: Call completed to mISDN/g:intern1/51
asterisk*CLI> core show version
Asterisk built by root @ slax on a i686 running Linux on 2009-05-16 13:26:43 UTC
   -- Attempting call on mISDN/g:intern1/51 for application SMS(0,s) (Retry 1)
      > Channel mISDN/tmp0-u8 was answered.
      > Launching SMS(0,s) on mISDN/tmp0-u8
sms argc 2 queue <0> opts <s> addr <> body <>
initial delay 300ms
   -- SMS RX 93 00 6D
   -- SMS TX 91 13 00 04 81 03 00 00 F1 80 50 50 11 11 11 48 04 D4 F2 9C 0E
   -- SMS RX 95 02 00 00 69
   -- SMS TX 94 00
[May 21 14:41:21] NOTICE[7864]: app_sms.c:2009 sms_exec: ast_read failed
[May 21 14:41:21] NOTICE[7864]: pbx_spool.c:348 attempt_thread: Call completed to mISDN/g:intern1/51

The only strange thing is that I still get a "ast_read failed" message but at least my problem is solved now...

By: Leif Madsen (lmadsen) 2009-06-16 13:43:31

Due to the limited number of people who are able to test and report back on this issue, I'm going to close this issue as at least one reporter has mentioned the SMS delivery is now working for him in Asterisk

If you are still having issues with SMS delivery / receipt, then please open a new issue so we can track it there along with any information that you have, and please have the ability to reproduce the issue, and allow access to the box by a developer. We currently do not have the ability to reproduce these SMS issues locally.

Thanks to everyone who helped!

By: David Woodhouse (dwmw2) 2011-08-23 18:28:59.576-0500

I have opened a new issue #18331 with a patch to fix all three remaining issues with app_sms.

By: David Woodhouse (dwmw2) 2011-08-24 08:26:59.428-0500

Please test the patch attached at https://issues.asterisk.org/jira/browse/ASTERISK-18331 and confirm there that it works.