Cleanups to the ordering of events in dial, don't freak out on the wrong codec
authorMark Spencer <markster@digium.com>
Wed, 7 Jul 2004 16:02:13 +0000 (16:02 +0000)
committerMark Spencer <markster@digium.com>
Wed, 7 Jul 2004 16:02:13 +0000 (16:02 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3385 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_dial.c
channels/chan_sip.c

index 4b05ad4..dfb1a3e 100755 (executable)
@@ -142,7 +142,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
        
        if (single) {
                /* Turn off hold music, etc */
-               ast_indicate(in, -1);
+               ast_deactivate_generator(in);
                /* If we are calling a single channel, make them compatible for in-band tone purpose */
                ast_channel_make_compatible(outgoing->chan, in);
        }
@@ -853,13 +853,6 @@ static int dial_exec(struct ast_channel *chan, void *data)
                        pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", peer->name);
                if (numsubst)
                        pbx_builtin_setvar_helper(chan, "DIALEDPEERNUMBER", numsubst);
-               /* Make sure channels are compatible */
-               res = ast_channel_make_compatible(chan, peer);
-               if (res < 0) {
-                       ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", chan->name, peer->name);
-                       ast_hangup(peer);
-                       return -1;
-               }
                /* JDG: sendurl */
                if( url && !ast_strlen_zero(url) && ast_channel_supports_html(peer) ) {
                        ast_log(LOG_DEBUG, "app_dial: sendurl=%s.\n", url);
@@ -913,6 +906,15 @@ static int dial_exec(struct ast_channel *chan, void *data)
                                sentringing = 0;
                                ast_indicate(chan, -1);
                        }
+                       /* Be sure no generators are left on it */
+                       ast_deactivate_generator(chan);
+                       /* Make sure channels are compatible */
+                       res = ast_channel_make_compatible(chan, peer);
+                       if (res < 0) {
+                               ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", chan->name, peer->name);
+                               ast_hangup(peer);
+                               return -1;
+                       }
                        res = ast_bridge_call(chan,peer,&config);
                } else 
                        res = -1;
index 2cd5b6f..b3dff70 100755 (executable)
@@ -1799,7 +1799,7 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
                if (!(frame->subclass & ast->nativeformats)) {
                        ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
                                frame->subclass, ast->nativeformats, ast->readformat, ast->writeformat);
-                       return -1;
+                       return 0;
                }
                if (p) {
                        ast_mutex_lock(&p->lock);
@@ -7864,7 +7864,7 @@ static struct sip_peer *build_peer(char *name, struct ast_variable *v)
                                peer->promiscredir = ast_true(v->value);
                        else if (!strcasecmp(v->name, "fromuser"))
                                strncpy(peer->fromuser, v->value, sizeof(peer->fromuser)-1);
-                       else if (!strcasecmp(v->name, "dtmfmode")) {
+            else if (!strcasecmp(v->name, "dtmfmode")) {
                                if (!strcasecmp(v->value, "inband"))
                                        peer->dtmfmode=SIP_DTMF_INBAND;
                                else if (!strcasecmp(v->value, "rfc2833"))