From: François Date: Mon, 14 Nov 2016 10:01:41 +0000 (+0100) Subject: FS-9514 add event on mod_callcenter when max-no-answer is triggered X-Git-Tag: v1.8.0~1074^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8926317afc71f1889b95aca72e1301a19f078b2;p=thirdparty%2Ffreeswitch.git FS-9514 add event on mod_callcenter when max-no-answer is triggered --- diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 3b12c9948a..96abfa3c76 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2015,6 +2015,17 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa if (h->max_no_answer > 0 && (h->no_answer_count + 1) >= h->max_no_answer) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Agent %s reach maximum no answer of %d, setting agent status to %s\n", h->agent_name, h->max_no_answer, cc_agent_status2str(h->agent_no_answer_status)); + + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "agent-max-no-answer"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-No-Answer-Count", "%d", h->max_no_answer); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-No-Answer-Status", cc_agent_status2str(h->agent_no_answer_status)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); + switch_event_fire(&event); + } + cc_agent_update("status", cc_agent_status2str(h->agent_no_answer_status), h->agent_name); } break;