Answer the channel prior to checking for the 'a'
authorMark Michelson <mmichelson@digium.com>
Thu, 16 Oct 2008 22:44:05 +0000 (22:44 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 16 Oct 2008 22:44:05 +0000 (22:44 +0000)
option in app_sms.

(closes issue #13675)
Reported by: alecdavis
Patches:
      app_sms.bug13675.148985.diff.txt uploaded by alecdavis (license 585)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@150257 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_sms.c

index d32491a..0a20c8b 100644 (file)
@@ -1958,6 +1958,10 @@ static int sms_exec(struct ast_channel *chan, void *data)
                res = h.err;
                goto done;
        }
+       
+       if (chan->_state != AST_STATE_UP) {             /* make sure channel is answered before any TX */
+               ast_answer(chan);
+       }
 
        if (ast_test_flag(&flags, OPTION_ANSWER)) {
                h.framenumber = 1;                  /* Proto 2 */
@@ -1972,10 +1976,6 @@ static int sms_exec(struct ast_channel *chan, void *data)
                sms_messagetx(&h);
        }
 
-       if (chan->_state != AST_STATE_UP) {
-               ast_answer(chan);
-       }
-
        res = ast_set_write_format(chan, __OUT_FMT);
        if (res >= 0) {
                res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);