[svn-commits] rmudgett: trunk r427519 - in /trunk: ./ apps/app_agent_pool.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Nov 6 13:26:12 CST 2014
Author: rmudgett
Date: Thu Nov 6 13:26:08 2014
New Revision: 427519
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=427519
Log:
app_agent_pool: Made agent alert interruptable by DTMF.
Made agent able to interrupt the alerting beep playback with DTMF. Any
digit can interrupt if the call does not need to be acknowledged. Only
the first digit of the acknowledgement can interrupt if the call needs to
be acknowledged. The agent interrupting the alerting playback builds on
the ASTERISK-24447 patch because it knows what digit interrupted the
playback and needs to be able to pass that digit to the DTMF hook digit
collection code.
ASTERISK-24257 #close
Reported by: Steve Pitts
Review: https://reviewboard.asterisk.org/r/4123/
........
Merged revisions 427508 from http://svn.asterisk.org/svn/asterisk/branches/12
........
Merged revisions 427512 from http://svn.asterisk.org/svn/asterisk/branches/13
Modified:
trunk/ (props changed)
trunk/apps/app_agent_pool.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.
Modified: trunk/apps/app_agent_pool.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_agent_pool.c?view=diff&rev=427519&r1=427518&r2=427519
==============================================================================
--- trunk/apps/app_agent_pool.c (original)
+++ trunk/apps/app_agent_pool.c Thu Nov 6 13:26:08 2014
@@ -1733,7 +1733,10 @@
{
const char *agent_id = payload;
const char *playfile;
- RAII_VAR(struct agent_pvt *, agent, NULL, ao2_cleanup);
+ const char *dtmf_accept;
+ struct agent_pvt *agent;
+ int digit;
+ char dtmf[2];
agent = ao2_find(agents, agent_id, OBJ_KEY);
if (!agent) {
@@ -1748,30 +1751,56 @@
ast_bridge_channel_establish_roles(bridge_channel);
ast_bridge_unlock(bridge_channel->bridge);
- /* Alert the agent. */
agent_lock(agent);
playfile = ast_strdupa(agent->cfg->beep_sound);
+
+ /* Determine which DTMF digits interrupt the alerting signal. */
+ if (ast_test_flag(agent, AGENT_FLAG_ACK_CALL)
+ ? agent->override_ack_call : agent->cfg->ack_call) {
+ dtmf_accept = ast_test_flag(agent, AGENT_FLAG_DTMF_ACCEPT)
+ ? agent->override_dtmf_accept : agent->cfg->dtmf_accept;
+
+ /* Only the first digit of the ack will stop playback. */
+ dtmf[0] = *dtmf_accept;
+ dtmf[1] = '\0';
+ dtmf_accept = dtmf;
+ } else {
+ dtmf_accept = NULL;
+ }
agent_unlock(agent);
- ast_stream_and_wait(bridge_channel->chan, playfile, AST_DIGIT_NONE);
+
+ /* Alert the agent. */
+ digit = ast_stream_and_wait(bridge_channel->chan, playfile,
+ ast_strlen_zero(dtmf_accept) ? AST_DIGIT_ANY : dtmf_accept);
+ ast_stopstream(bridge_channel->chan);
agent_lock(agent);
switch (agent->state) {
case AGENT_STATE_CALL_PRESENT:
- if (ast_test_flag(agent, AGENT_FLAG_ACK_CALL)
- ? agent->override_ack_call : agent->cfg->ack_call) {
+ if (!ast_strlen_zero(dtmf_accept)) {
agent->state = AGENT_STATE_CALL_WAIT_ACK;
agent->ack_time = ast_tvnow();
+
+ if (0 < digit) {
+ /* Playback was interrupted by a digit. */
+ agent_unlock(agent);
+ ao2_ref(agent, -1);
+ ast_bridge_channel_feature_digit(bridge_channel, digit);
+ return;
+ }
break;
}
/* Connect to caller now. */
ast_debug(1, "Agent %s: Immediately connecting to call.\n", agent->username);
agent_connect_caller(bridge_channel, agent);/* Will unlock agent. */
+ ao2_ref(agent, -1);
return;
default:
break;
}
agent_unlock(agent);
+ ao2_ref(agent, -1);
}
static int send_alert_to_agent(struct ast_bridge_channel *bridge_channel, const char *agent_id)
More information about the svn-commits
mailing list