Index: apps/app_dial.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v retrieving revision 1.63 diff -u -r1.63 app_dial.c --- apps/app_dial.c 27 Apr 2004 16:42:43 -0000 1.63 +++ apps/app_dial.c 2 May 2004 00:30:12 -0000 @@ -180,12 +180,6 @@ ast_verbose( VERBOSE_PREFIX_2 "No one is available to answer at this time\n"); } *to = 0; - /* if no one available we'd better stop MOH/ringing to */ - if (moh) { - ast_moh_stop(in); - } else if (sentringing) { - ast_indicate(in, -1); - } return NULL; } winner = ast_waitfor_n(watchers, pos, to); @@ -361,12 +355,6 @@ if (!*to && (option_verbose > 2)) ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig); } - if (moh) { - ast_moh_stop(in); - } else if (sentringing) { - ast_indicate(in, -1); - } - return peer; } @@ -800,18 +788,6 @@ 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 && strlen(url) && ast_channel_supports_html(peer) ) { - ast_log(LOG_DEBUG, "app_dial: sendurl=%s.\n", url); - ast_channel_sendurl( peer, url ); - } /* /JDG */ if (announce && announcemsg) { int res2; @@ -825,6 +801,22 @@ // Ok, done. stop autoservice res2 = ast_autoservice_stop(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; + } + /* JDG: sendurl */ + if( url && strlen(url) && ast_channel_supports_html(peer) ) { + ast_log(LOG_DEBUG, "app_dial: sendurl=%s.\n", url); + ast_channel_sendurl( peer, url ); + } /* /JDG */ + + ast_moh_stop(chan); + if (calldurationlimit > 0) { time(&now); chan->whentohangup = now + calldurationlimit; @@ -854,6 +846,8 @@ if((go_on>0) && (!chan->_softhangup)) res=0; + if(!res) + ast_moh_stop(chan); return res; }