提交 91f210a5 authored 作者: Chris Rienzo's avatar Chris Rienzo

mod_rayo CPA - added detector abstraction

上级 e6ec1478
...@@ -22,6 +22,59 @@ ...@@ -22,6 +22,59 @@
<param name="receivefax-file-prefix" value="/tmp/"/> <param name="receivefax-file-prefix" value="/tmp/"/>
</fax> </fax>
<!-- Call progress analysis configuration -->
<!-- Define CPA detectors. These are sources for Rayo CPA signal events -->
<!-- Detectors must fire an event that can be translated by mod_rayo into a CPA signal event -->
<cpa>
<!-- map mod_spandsp fax detector to the Rayo CPA events. Fires DETECTED_FAX_* event once and quits. -->
<detector name="mod_spandsp_fax_ced">
<start application="spandsp_start_fax_detect" data="event 'Event-Name=CUSTOM,Event-Subclass=DETECTED_FAX_CED' 500 ced"/>
<stop application="spandsp_stop_fax_detect" data=""/>
<event class="CUSTOM" subclass="DETECTED_FAX_CED">
<signal-type value="fax-ced"/>
</event>
</detector>
<detector name="mod_spandsp_fax_cng">
<start application="spandsp_start_fax_detect" data="event 'Event-Name=CUSTOM,Event-Subclass=DETECTED_FAX_CNG' 500"/>
<stop application="spandsp_stop_fax_detect" data=""/>
<event class="CUSTOM" subclass="DETECTED_FAX_CNG">
<signal-type value="fax-cng"/>
</event>
</detector>
<!-- map mod_spandsp call progress tone detector to Rayo CPA signal events. Fires DETECTED_TONE events until stopped. -->
<detector name="mod_spandsp_tone">
<start application="start_tone_detect" data="1"/>
<stop application="stop_tone_detect" data=""/>
<!-- map tone events to Rayo CPA signal type -->
<event class="CUSTOM" subclass="DETECTED_TONE" type-header="Detected-Tone">
<signal-type header-value="SIT" value="sit"/>
<signal-type header-value="BUSY_TONE" value="busy"/>
<signal-type header-value="REORDER_TONE" value="congestion"/>
<signal-type header-value="RING_TONE" value="ring"/>
</event>
</detector>
<!-- map mod_avmd detector to Rayo CPA beep event. Fires avmd::beep event once. -->
<detector name="mod_avmd">
<start application="avmd" data=""/>
<stop application="avmd" data="stop"/>
<event class="CUSTOM" subclass="avmd::beep">
<signal-type value="beep"/>
</event>
</detector>
<!-- Alternative beep detector using mod_vmd. Fires vmd::beep events until stopped. -->
<!--detector name="mod_vmd">
<start application="vmd" data=""/>
<stop application="vmd" data="stop"/>
<event class="CUSTOM" subclass="vmd::beep">
<signal-type value="beep"/>
</event>
</detector-->
</cpa>
<!-- XMPP server domain --> <!-- XMPP server domain -->
<domain name="$${rayo_domain_name}" shared-secret="ClueCon"> <domain name="$${rayo_domain_name}" shared-secret="ClueCon">
<!-- use this instead if you want secure XMPP client to server connections. Put .crt and .key file in freeswitch/certs --> <!-- use this instead if you want secure XMPP client to server connections. Put .crt and .key file in freeswitch/certs -->
......
...@@ -10,6 +10,7 @@ LOCAL_OBJS= $(IKS_LA) \ ...@@ -10,6 +10,7 @@ LOCAL_OBJS= $(IKS_LA) \
iks_helpers.o \ iks_helpers.o \
nlsml.o \ nlsml.o \
rayo_components.o \ rayo_components.o \
rayo_cpa_detector.o \
rayo_elements.o \ rayo_elements.o \
rayo_fax_components.o \ rayo_fax_components.o \
rayo_input_component.o \ rayo_input_component.o \
...@@ -23,6 +24,7 @@ LOCAL_SOURCES= \ ...@@ -23,6 +24,7 @@ LOCAL_SOURCES= \
iks_helpers.c \ iks_helpers.c \
nlsml.c \ nlsml.c \
rayo_components.c \ rayo_components.c \
rayo_cpa_detector.c \
rayo_elements.c \ rayo_elements.c \
rayo_fax_components.c \ rayo_fax_components.c \
rayo_input_component.c \ rayo_input_component.c \
......
...@@ -22,6 +22,59 @@ ...@@ -22,6 +22,59 @@
<param name="receivefax-file-prefix" value="/tmp/"/> <param name="receivefax-file-prefix" value="/tmp/"/>
</fax> </fax>
<!-- Call progress analysis configuration -->
<!-- Define CPA detectors. These are sources for Rayo CPA signal events -->
<!-- Detectors must fire an event that can be translated by mod_rayo into a CPA signal event -->
<cpa>
<!-- map mod_spandsp fax detector to the Rayo CPA events. Fires DETECTED_FAX_* event once and quits. -->
<detector name="mod_spandsp_fax_ced">
<start application="spandsp_start_fax_detect" data="event 'Event-Name=CUSTOM,Event-Subclass=DETECTED_FAX_CED' 500 ced"/>
<stop application="spandsp_stop_fax_detect" data=""/>
<event class="CUSTOM" subclass="DETECTED_FAX_CED">
<signal-type value="fax-ced"/>
</event>
</detector>
<detector name="mod_spandsp_fax_cng">
<start application="spandsp_start_fax_detect" data="event 'Event-Name=CUSTOM,Event-Subclass=DETECTED_FAX_CNG' 500"/>
<stop application="spandsp_stop_fax_detect" data=""/>
<event class="CUSTOM" subclass="DETECTED_FAX_CNG">
<signal-type value="fax-cng"/>
</event>
</detector>
<!-- map mod_spandsp call progress tone detector to Rayo CPA signal events. Fires DETECTED_TONE events until stopped. -->
<detector name="mod_spandsp_tone">
<start application="start_tone_detect" data="1"/>
<stop application="stop_tone_detect" data=""/>
<!-- map tone events to Rayo CPA signal type -->
<event class="CUSTOM" subclass="DETECTED_TONE" type-header="Detected-Tone">
<signal-type header-value="SIT" value="sit"/>
<signal-type header-value="BUSY_TONE" value="busy"/>
<signal-type header-value="REORDER_TONE" value="congestion"/>
<signal-type header-value="RING_TONE" value="ring"/>
</event>
</detector>
<!-- map mod_avmd detector to Rayo CPA beep event. Fires avmd::beep event once. -->
<detector name="mod_avmd">
<start application="avmd" data=""/>
<stop application="avmd" data="stop"/>
<event class="CUSTOM" subclass="avmd::beep">
<signal-type value="beep"/>
</event>
</detector>
<!-- Alternative beep detector using mod_vmd. Fires vmd::beep events until stopped. -->
<!--detector name="mod_vmd">
<start application="vmd" data=""/>
<stop application="vmd" data="stop"/>
<event class="CUSTOM" subclass="vmd::beep">
<signal-type value="beep"/>
</event>
</detector-->
</cpa>
<!-- XMPP server domain --> <!-- XMPP server domain -->
<domain name="$${rayo_domain_name}" shared-secret="ClueCon"> <domain name="$${rayo_domain_name}" shared-secret="ClueCon">
<!-- use this instead if you want secure XMPP client to server connections. Put .crt and .key file in freeswitch/certs --> <!-- use this instead if you want secure XMPP client to server connections. Put .crt and .key file in freeswitch/certs -->
......
/*
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2014, Grasshopper
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is Grasshopper
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Rienzo <chris.rienzo@grasshopper.com>
*
* rayo_cpa_detector.h -- Rayo call progress analysis
*
*/
#ifndef RAYO_CPA_DETECTOR_H
#define RAYO_CPA_DETECTOR_H
#include <switch.h>
#include "mod_rayo.h"
#define RAYO_CPA_BASE RAYO_BASE "cpa:"
#define RAYO_CPA_NS RAYO_CPA_BASE RAYO_VERSION
#define RAYO_CPA_BEEP_NS RAYO_CPA_BASE "beep:" RAYO_VERSION
#define RAYO_CPA_DTMF_NS RAYO_CPA_BASE "dtmf:" RAYO_VERSION
#define RAYO_CPA_SPEECH_NS RAYO_CPA_BASE "speech:" RAYO_VERSION
#define RAYO_CPA_FAX_CED_NS RAYO_CPA_BASE "fax-ced:" RAYO_VERSION
#define RAYO_CPA_FAX_CNG_NS RAYO_CPA_BASE "fax-cng:" RAYO_VERSION
#define RAYO_CPA_RING_NS RAYO_CPA_BASE "ring:" RAYO_VERSION
#define RAYO_CPA_BUSY_NS RAYO_CPA_BASE "busy:" RAYO_VERSION
#define RAYO_CPA_CONGESTION_NS RAYO_CPA_BASE "congestion:" RAYO_VERSION
#define RAYO_CPA_SIT_NS RAYO_CPA_BASE "sit:" RAYO_VERSION
#define RAYO_CPA_MODEM_NS RAYO_CPA_BASE "modem:" RAYO_VERSION
#define RAYO_CPA_OFFHOOK_NS RAYO_CPA_BASE "offhook:" RAYO_VERSION
extern switch_status_t rayo_cpa_detector_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
extern void rayo_cpa_detector_shutdown(void);
extern int rayo_cpa_detector_start(const char *call_uuid, const char *signal_ns, const char **error_detail);
extern void rayo_cpa_detector_stop(const char *call_uuid, const char *signal_ns);
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet
*/
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
* *
*/ */
#include "rayo_components.h" #include "rayo_components.h"
#include "rayo_cpa_detector.h"
#include "rayo_elements.h" #include "rayo_elements.h"
#include "srgs.h" #include "srgs.h"
#include "nlsml.h" #include "nlsml.h"
...@@ -760,7 +761,7 @@ switch_status_t rayo_input_component_load(switch_loadable_module_interface_t **m ...@@ -760,7 +761,7 @@ switch_status_t rayo_input_component_load(switch_loadable_module_interface_t **m
rayo_actor_command_handler_add(RAT_CALL_COMPONENT, "input", "set:"RAYO_INPUT_NS":start-timers", start_timers_call_input_component); rayo_actor_command_handler_add(RAT_CALL_COMPONENT, "input", "set:"RAYO_INPUT_NS":start-timers", start_timers_call_input_component);
switch_event_bind("rayo_input_component", SWITCH_EVENT_DETECTED_SPEECH, SWITCH_EVENT_SUBCLASS_ANY, on_detected_speech_event, NULL); switch_event_bind("rayo_input_component", SWITCH_EVENT_DETECTED_SPEECH, SWITCH_EVENT_SUBCLASS_ANY, on_detected_speech_event, NULL);
return SWITCH_STATUS_SUCCESS; return rayo_cpa_detector_load(module_interface, pool, config_file);
} }
/** /**
...@@ -771,6 +772,9 @@ switch_status_t rayo_input_component_shutdown(void) ...@@ -771,6 +772,9 @@ switch_status_t rayo_input_component_shutdown(void)
{ {
srgs_parser_destroy(globals.parser); srgs_parser_destroy(globals.parser);
switch_event_unbind_callback(on_detected_speech_event); switch_event_unbind_callback(on_detected_speech_event);
rayo_cpa_detector_shutdown();
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论