more usages of function 'finishup()'

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20705 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-04-16 22:22:53 +00:00
parent 2c7b77814c
commit db107f93e1

View File

@@ -662,13 +662,21 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
memset(xferto, 0, sizeof(xferto)); memset(xferto, 0, sizeof(xferto));
/* Transfer */ /* Transfer */
res = stream_and_wait(transferer, "pbx-transfer", transferer->language, AST_DIGIT_ANY); res = stream_and_wait(transferer, "pbx-transfer", transferer->language, AST_DIGIT_ANY);
if (res < 0) { if (res < 0) {
finishup(transferee); finishup(transferee);
return res; return res;
} else if (res > 0) /* If they've typed a digit already, handle it */ } else if (res > 0) /* If they've typed a digit already, handle it */
xferto[0] = (char) res; xferto[0] = (char) res;
if ((ast_app_dtget(transferer, transferer_real_context, xferto, sizeof(xferto), 100, transferdigittimeout))) { /* this is specific of atxfer */
res = ast_app_dtget(transferer, transferer_real_context, xferto, sizeof(xferto), 100, transferdigittimeout);
if (!res) {
ast_log(LOG_WARNING, "Did not read data.\n");
res = ast_streamfile(transferer, "beeperr", transferer->language);
if (ast_waitstream(transferer, "") < 0) {
return -1;
}
} else {
cid_num = transferer->cid.cid_num; cid_num = transferer->cid.cid_num;
cid_name = transferer->cid.cid_name; cid_name = transferer->cid.cid_name;
if (ast_exists_extension(transferer, transferer_real_context,xferto, 1, cid_num)) { if (ast_exists_extension(transferer, transferer_real_context,xferto, 1, cid_num)) {
@@ -697,9 +705,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
ast_log(LOG_WARNING, "Failed to play courtesy tone!\n"); ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
} }
} }
ast_moh_stop(transferee); finishup(transferee);
ast_autoservice_stop(transferee);
ast_indicate(transferee, AST_CONTROL_UNHOLD);
transferer->_softhangup = 0; transferer->_softhangup = 0;
return FEATURE_RETURN_SUCCESS; return FEATURE_RETURN_SUCCESS;
} }
@@ -766,9 +772,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
return -1; return -1;
} else { } else {
ast_moh_stop(transferee); finishup(transferee);
ast_autoservice_stop(transferee);
ast_indicate(transferee, AST_CONTROL_UNHOLD);
/* any reason besides user requested cancel and busy triggers the failed sound */ /* any reason besides user requested cancel and busy triggers the failed sound */
if (outstate != AST_CONTROL_UNHOLD && outstate != AST_CONTROL_BUSY && !ast_strlen_zero(xferfailsound)) { if (outstate != AST_CONTROL_UNHOLD && outstate != AST_CONTROL_BUSY && !ast_strlen_zero(xferfailsound)) {
res = ast_streamfile(transferer, xferfailsound, transferer->language); res = ast_streamfile(transferer, xferfailsound, transferer->language);
@@ -780,24 +784,14 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
} }
} else { } else {
ast_log(LOG_WARNING, "Extension %s does not exist in context %s\n",xferto,transferer_real_context); ast_log(LOG_WARNING, "Extension %s does not exist in context %s\n",xferto,transferer_real_context);
ast_moh_stop(transferee); finishup(transferee);
ast_autoservice_stop(transferee);
ast_indicate(transferee, AST_CONTROL_UNHOLD);
res = ast_streamfile(transferer, "beeperr", transferer->language); res = ast_streamfile(transferer, "beeperr", transferer->language);
if (!res && (ast_waitstream(transferer, "") < 0)) { if (!res && (ast_waitstream(transferer, "") < 0)) {
return -1; return -1;
} }
} }
} else {
ast_log(LOG_WARNING, "Did not read data.\n");
res = ast_streamfile(transferer, "beeperr", transferer->language);
if (ast_waitstream(transferer, "") < 0) {
return -1;
}
} }
ast_moh_stop(transferee); finishup(transferee);
ast_autoservice_stop(transferee);
ast_indicate(transferee, AST_CONTROL_UNHOLD);
return FEATURE_RETURN_SUCCESS; return FEATURE_RETURN_SUCCESS;
} }