Summary:ASTERISK-12876: [patch] app_sms doesn't answer the call, currently requires Answer() before hand
Reporter:Alec Davis (alecdavis)Labels:
Date Opened:2008-10-12 15:16:55Date Closed:2008-10-16 17:33:40
Versions:Frequency of
Environment:Attachments:( 0) app_sms.bug13675.148985.diff.txt
( 1) app_sms.bug13675.diff.txt
Description:In app_sms.c sms_exec there is code that answers the channel if it's not already answered. But when sms is invoked with option 'a', the channel may not have been answered with Answer() app.

the code I believe is answering too late:
     if (chan->_state != AST_STATE_UP)

needs to be before:
       if (ast_test_flag(&flags, OPTION_ANSWER)) {
               h.framenumber = 1;           /* Proto 2 */


Dialplan code below works as expected, is backwards compatbile with existing dialplan code.

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

exten => s,n(SMSMessage),NoOp( SMS MESSAGE )
;exten => s,n,Answer()     <<<<<<<  Now not needed
exten => s,n,SMS(sms,at)
exten => s,n,NoOp( Wont Get Here)
exten => s,n,Hangup()

exten => h,1,NoOp( Send SMS toEmail)
exten => h,n,System(/usr/lib/asterisk/sms-email)
exten => h,n,Hangup()
Comments:By: Alec Davis (alecdavis) 2008-10-12 21:23:23

related: http://bugs.digium.com/view.php?id=8586
Originally as rizzo mentions SMS answers the call.

By: Alec Davis (alecdavis) 2008-10-15 02:00:38

please remove app_sms.bug13675.diff.txt as this was for trunk version 147592

When applied to 148985 it copies the required code to where it should be, but doesn't remove the old code, although it doesn't harm it.

uploaded revised app_sms.bug13675.148985.diff.txt for trunk version 148985


By: Alec Davis (alecdavis) 2008-10-15 02:23:19

Asterisk Version should be SVN not 1.6.0, please correct if possible.

By: Mark Michelson (mmichelson) 2008-10-16 17:31:13

Makes sense to me. Thanks for the patch!

By: Digium Subversion (svnbot) 2008-10-16 17:33:38

Repository: asterisk
Revision: 150257

U   trunk/apps/app_sms.c

r150257 | mmichelson | 2008-10-16 17:33:38 -0500 (Thu, 16 Oct 2008) | 9 lines

Answer the channel prior to checking for the 'a'
option in app_sms.

(closes issue ASTERISK-12876)
Reported by: alecdavis
     app_sms.bug13675.148985.diff.txt uploaded by alecdavis (license 585)