]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_rayo CPA dtmf detection added
authorChris Rienzo <chris.rienzo@grasshopper.com>
Tue, 7 Jan 2014 15:10:50 +0000 (10:10 -0500)
committerChris Rienzo <chris.rienzo@grasshopper.com>
Tue, 7 Jan 2014 15:10:50 +0000 (10:10 -0500)
conf/rayo/autoload_configs/rayo.conf.xml
src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml
src/mod/event_handlers/mod_rayo/rayo_cpa_detector.c

index 52a1a35977e368031f2cc393475cc5a664754cf1..50af0f7ecd6368427c8e21f95ec68228445295e7 100644 (file)
        <!-- 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 DTMF events to CPA -->
+               <detector name="core_dtmf_event">
+                       <event class="DTMF" value-header="DTMF-Digit" duration-header="DTMF-Duration">
+                               <signal-type value="dtmf"/>
+                       </event>
+               </detector>
+
                <!-- 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"/>
index 52a1a35977e368031f2cc393475cc5a664754cf1..50af0f7ecd6368427c8e21f95ec68228445295e7 100644 (file)
        <!-- 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 DTMF events to CPA -->
+               <detector name="core_dtmf_event">
+                       <event class="DTMF" value-header="DTMF-Digit" duration-header="DTMF-Duration">
+                               <signal-type value="dtmf"/>
+                       </event>
+               </detector>
+
                <!-- 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"/>
index 27ce9a13bea8c806abad7ac79d679b7ccca111a3..ed1d87d15299b25ae29186298878796b0a2bd02d 100644 (file)
@@ -79,8 +79,13 @@ struct rayo_cpa_detector_state {
 int rayo_cpa_detector_start(const char *call_uuid, const char *signal_ns, const char **error_detail)
 {
        struct rayo_cpa_detector *detector = switch_core_hash_find(globals.detectors, signal_ns);
+       switch_core_session_t *session;
        if (detector) {
-               switch_core_session_t *session = switch_core_session_locate(call_uuid);
+               if (zstr(detector->start_app)) {
+                       /* nothing to do */
+                       return 1;
+               }
+               session = switch_core_session_locate(call_uuid);
                if (session) {
                        struct rayo_cpa_detector_state *detector_state = switch_channel_get_private(switch_core_session_get_channel(session), detector->uuid);
                        if (detector_state) {
@@ -114,8 +119,13 @@ int rayo_cpa_detector_start(const char *call_uuid, const char *signal_ns, const
 void rayo_cpa_detector_stop(const char *call_uuid, const char *signal_ns)
 {
        struct rayo_cpa_detector *detector = switch_core_hash_find(globals.detectors, signal_ns);
+       switch_core_session_t *session;
        if (detector) {
-               switch_core_session_t *session = switch_core_session_locate(call_uuid);
+               if (zstr(detector->stop_app)) {
+                       /* nothing to do */
+                       return;
+               }
+               session = switch_core_session_locate(call_uuid);
                if (session) {
                        struct rayo_cpa_detector_state *detector_state = switch_channel_get_private(switch_core_session_get_channel(session), detector->uuid);
                        if (detector_state) {