[asterisk-commits] mmichelson: trunk r89055 - /trunk/res/res_features.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Nov 6 14:32:49 CST 2007
Author: mmichelson
Date: Tue Nov 6 14:32:49 2007
New Revision: 89055
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89055
Log:
Instead of trying to callback a local channel on a failed attended transfer, call
the device that made the transfer instead. This makes for much smoother calling back
when queues are involved.
(closes issue #11155, reported by IPetrov)
Tremendous thanks to Russell for pulling me out of my block I was having on this one
Modified:
trunk/res/res_features.c
Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?view=diff&rev=89055&r1=89054&r2=89055
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Tue Nov 6 14:32:49 2007
@@ -892,7 +892,6 @@
struct ast_channel *transferee;
const char *transferer_real_context;
char xferto[256] = "";
- char callbackto[256] = "";
int res;
int outstate=0;
struct ast_channel *newchan;
@@ -1031,25 +1030,28 @@
if (!newchan) {
unsigned int tries = 0;
-
- /* newchan wasn't created - we should callback to transferer */
- if (!ast_exists_extension(transferer, transferer_real_context, transferer->cid.cid_num, 1, transferee->cid.cid_num)) {
- ast_log(LOG_WARNING, "Extension %s does not exist in context %s - callback failed\n",transferer->cid.cid_num,transferer_real_context);
+ char *transferer_tech, *transferer_name = ast_strdupa(transferer->name);
+
+ transferer_tech = strsep(&transferer_name, "/");
+ transferer_name = strsep(&transferer_name, "-");
+
+ if (ast_strlen_zero(transferer_name) || ast_strlen_zero(transferer_tech)) {
+ ast_log(LOG_WARNING, "Transferer has invalid channel name: '%s'\n", transferer->name);
if (ast_stream_and_wait(transferee, "beeperr", ""))
return -1;
return FEATURE_RETURN_SUCCESS;
}
- snprintf(callbackto, sizeof(callbackto), "%s@%s/n", transferer->cid.cid_num, transferer_real_context); /* append context */
-
- newchan = ast_feature_request_and_dial(transferee, NULL, "Local", ast_best_codec(transferee->nativeformats),
- callbackto, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0);
+
+ ast_log(LOG_NOTICE, "We're trying to call %s/%s\n", transferer_tech, transferer_name);
+ newchan = ast_feature_request_and_dial(transferee, NULL, transferer_tech, ast_best_codec(transferee->nativeformats),
+ transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0);
while (!newchan && !atxferdropcall && tries < atxfercallbackretries) {
/* Trying to transfer again */
ast_autoservice_start(transferee);
ast_indicate(transferee, AST_CONTROL_HOLD);
newchan = ast_feature_request_and_dial(transferer, transferee, "Local", ast_best_codec(transferer->nativeformats),
- xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1);
+ xferto, atxfernoanswertimeout, &outstate, transferer->cid.cid_num, transferer->cid.cid_name, 1);
if (ast_autoservice_stop(transferee) < 0) {
if (newchan)
ast_hangup(newchan);
@@ -1060,8 +1062,8 @@
ast_debug(1, "Sleeping for %d ms before callback.\n", atxferloopdelay);
ast_safe_sleep(transferee, atxferloopdelay);
ast_debug(1, "Trying to callback...\n");
- newchan = ast_feature_request_and_dial(transferee, NULL, "Local", ast_best_codec(transferee->nativeformats),
- callbackto, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0);
+ newchan = ast_feature_request_and_dial(transferee, NULL, transferer_tech, ast_best_codec(transferee->nativeformats),
+ transferer_name, atxfernoanswertimeout, &outstate, transferee->cid.cid_num, transferee->cid.cid_name, 0);
}
tries++;
}
More information about the asterisk-commits
mailing list