diff options
author | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-08 00:25:31 +0000 |
---|---|---|
committer | mogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-08 00:25:31 +0000 |
commit | 1af231176b52bd8d60e2acf6619c10a356454bbc (patch) | |
tree | 94d1463e7aee9517b4c3a6d5407297014a31e01e | |
parent | 03b916a8964047182426f5ac6a099ad408aca6d4 (diff) |
added small feature from bug 5682 with one typo fix.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7865 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | configs/features.conf.sample | 2 | ||||
-rw-r--r-- | res/res_features.c | 52 |
2 files changed, 46 insertions, 8 deletions
diff --git a/configs/features.conf.sample b/configs/features.conf.sample index 0805c908d..f46c7ec40 100644 --- a/configs/features.conf.sample +++ b/configs/features.conf.sample @@ -12,6 +12,8 @@ context => parkedcalls ; Which context parked calls are in ;courtesytone = beep ; Sound file to play to the parked caller ; when someone dials a parked call ; or the Touch Monitor is activated/deactivated. +;parkedplay = caller ; Who to play the courtesy tone to when picking up a parked call + ; one of: parked, caller, both (default is caller) ;xfersound = beep ; to indicate an attended transfer is complete ;xferfailsound = beeperr ; to indicate a failed transfer ;adsipark = yes ; if you want ADSI parking announcements diff --git a/res/res_features.c b/res/res_features.c index b1747996e..355d65e5b 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -94,6 +94,9 @@ static char courtesytone[256]; static char xfersound[256]; static char xferfailsound[256]; +/* Who to play the courtesy tone to */ +static int parkedplay = 0; + /* First available extension for parking */ static int parking_start; @@ -1742,19 +1745,45 @@ static int park_exec(struct ast_channel *chan, void *data) } if (peer) { - /* Play a courtesy beep in the calling channel to prefix the bridge connecting */ + /* Play a courtesy to the source(s) configured to prefix the bridge connecting */ + if (!ast_strlen_zero(courtesytone)) { - if (!ast_streamfile(chan, courtesytone, chan->language)) { - if (ast_waitstream(chan, "") < 0) { - ast_log(LOG_WARNING, "Failed to play courtesy tone!\n"); - ast_hangup(peer); - return -1; + if (parkedplay == 0) { + if (!ast_streamfile(chan, courtesytone, chan->language)) { + if (ast_waitstream(chan, "") < 0) { + ast_log(LOG_WARNING, "Failed to play courtesy tone!\n"); + ast_hangup(peer); + return -1; + } + } + ast_moh_stop(peer); + ast_indicate(peer, AST_CONTROL_UNHOLD); + } else { + ast_moh_stop(peer); + ast_indicate(peer, AST_CONTROL_UNHOLD); + if (parkedplay == 2) { + if (!ast_streamfile(chan, courtesytone, chan->language) && !ast_streamfile(peer, courtesytone, chan->language)) { + res = ast_waitstream(chan, ""); + if (res >= 0) + res = ast_waitstream(peer, ""); + if (res < 0) { + ast_log(LOG_WARNING, "Failed to play courtesy tones!\n"); + ast_hangup(peer); + return -1; + } + } + } else if (parkedplay == 1) { + if (!ast_streamfile(peer, courtesytone, chan->language)) { + if (ast_waitstream(peer, "") < 0) { + ast_log(LOG_WARNING, "Failed to play courtesy tone!\n"); + ast_hangup(peer); + return -1; + } + } } } } - ast_moh_stop(peer); - ast_indicate(peer, AST_CONTROL_UNHOLD); res = ast_channel_make_compatible(chan, peer); if (res < 0) { ast_log(LOG_WARNING, "Could not make channels %s and %s compatible for bridge\n", chan->name, peer->name); @@ -2029,6 +2058,13 @@ static int load_config(void) } } else if (!strcasecmp(var->name, "courtesytone")) { ast_copy_string(courtesytone, var->value, sizeof(courtesytone)); + } else if (!strcasecmp(var->name, "parkedplay")) { + if (!strcasecmp(var->value, "both")) + parkedplay = 2; + else if (!strcasecmp(var->value, "parked")) + parkedplay = 1; + else + parkedplay = 0; } else if (!strcasecmp(var->name, "xfersound")) { ast_copy_string(xfersound, var->value, sizeof(xfersound)); } else if (!strcasecmp(var->name, "xferfailsound")) { |