--- app_dial.c.dist 2004-03-26 22:58:32.000000000 -0700 +++ app_dial.c 2004-03-26 23:18:29.000000000 -0700 @@ -170,12 +170,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); @@ -351,12 +345,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; } @@ -696,18 +684,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; @@ -721,6 +697,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;