[asterisk-commits] trunk r20707 - /trunk/res/res_features.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Apr 16 15:46:02 MST 2006
Author: rizzo
Date: Sun Apr 16 17:46:00 2006
New Revision: 20707
URL: http://svn.digium.com/view/asterisk?rev=20707&view=rev
Log:
more usages of stream_and_wait
Modified:
trunk/res/res_features.c
Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?rev=20707&r1=20706&r2=20707&view=diff
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Sun Apr 16 17:46:00 2006
@@ -239,8 +239,6 @@
pthread_setschedparam(thread, SCHED_RR, &sched);
}
-
-
static int adsi_announce_park(struct ast_channel *chan, int parkingnum)
{
int res;
@@ -463,12 +461,10 @@
if (!ast_strlen_zero(courtesytone)) {
if (ast_autoservice_start(callee_chan))
return -1;
- if (!ast_streamfile(caller_chan, courtesytone, caller_chan->language)) {
- if (ast_waitstream(caller_chan, "") < 0) {
- ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
- ast_autoservice_stop(callee_chan);
- return -1;
- }
+ if (stream_and_wait(caller_chan, courtesytone, caller_chan->language, "")) {
+ ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
+ ast_autoservice_stop(callee_chan);
+ return -1;
}
if (ast_autoservice_stop(callee_chan))
return -1;
@@ -672,10 +668,8 @@
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) {
+ if (stream_and_wait(transferer, "beeperr", transferer->language, ""))
return -1;
- }
} else {
cid_num = transferer->cid.cid_num;
cid_name = transferer->cid.cid_name;
@@ -700,11 +694,8 @@
ast_frfree(f);
f = NULL;
}
- if (!ast_strlen_zero(xfersound) && !ast_streamfile(transferer, xfersound, transferer->language)) {
- if (ast_waitstream(transferer, "") < 0) {
- ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
- }
- }
+ if (stream_and_wait(transferer, xfersound, transferer->language, ""))
+ ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
finishup(transferee);
transferer->_softhangup = 0;
return FEATURE_RETURN_SUCCESS;
@@ -760,10 +751,8 @@
tobj->peer = newchan;
tobj->bconfig = *config;
- if (!ast_strlen_zero(xfersound) && !ast_streamfile(newchan, xfersound, newchan->language) &&
- ast_waitstream(newchan, "") < 0) {
+ if (stream_and_wait(newchan, xfersound, newchan->language, ""))
ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
- }
ast_bridge_call_thread_launch(tobj);
} else {
ast_hangup(xferchan);
@@ -774,21 +763,16 @@
} else {
finishup(transferee);
/* 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)) {
- res = ast_streamfile(transferer, xferfailsound, transferer->language);
- if (!res && (ast_waitstream(transferer, "") < 0)) {
- return -1;
- }
- }
+ if (outstate != AST_CONTROL_UNHOLD && outstate != AST_CONTROL_BUSY &&
+ stream_and_wait(transferer, xferfailsound, transferer->language, ""))
+ return -1;
return FEATURE_RETURN_SUCCESS;
}
} else {
ast_log(LOG_WARNING, "Extension %s does not exist in context %s\n",xferto,transferer_real_context);
finishup(transferee);
- res = ast_streamfile(transferer, "beeperr", transferer->language);
- if (!res && (ast_waitstream(transferer, "") < 0)) {
+ if (stream_and_wait(transferer, "beeperr", transferer->language, ""))
return -1;
- }
}
}
finishup(transferee);
More information about the asterisk-commits
mailing list