]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_spandsp added stopfax APP
authorChris Rienzo <chris@rienzo.com>
Wed, 8 Jan 2014 09:20:42 +0000 (04:20 -0500)
committerChris Rienzo <chris@rienzo.com>
Wed, 8 Jan 2014 09:29:05 +0000 (04:29 -0500)
src/mod/applications/mod_spandsp/mod_spandsp.c
src/mod/applications/mod_spandsp/mod_spandsp.h
src/mod/applications/mod_spandsp/mod_spandsp_fax.c

index b6ff1771de8cc9ac05b0ad1c7f38dcd4bf3ed36d..08bcf5e17dc5f0eaffe19729bb963844e8409fd7 100644 (file)
@@ -64,6 +64,11 @@ SWITCH_STANDARD_APP(spanfax_rx_function)
        mod_spandsp_fax_process_fax(session, data, FUNCTION_RX);
 }
 
+SWITCH_STANDARD_APP(spanfax_stop_function)
+{
+       mod_spandsp_fax_stop_fax(session);
+}
+
 SWITCH_STANDARD_APP(dtmf_session_function)
 {
        spandsp_inband_dtmf_session(session);
@@ -740,6 +745,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init)
                                   SAF_SUPPORT_NOMEDIA | SAF_NO_LOOPBACK);
        SWITCH_ADD_APP(app_interface, "txfax", "FAX Transmit Application", "FAX Transmit Application", spanfax_tx_function, SPANFAX_TX_USAGE,
                                   SAF_SUPPORT_NOMEDIA | SAF_NO_LOOPBACK);
+       SWITCH_ADD_APP(app_interface, "stopfax", "Stop FAX Application", "Stop FAX Application", spanfax_stop_function, "", SAF_NONE);
 
        SWITCH_ADD_APP(app_interface, "spandsp_stop_dtmf", "stop inband dtmf", "Stop detecting inband dtmf.", stop_dtmf_session_function, "", SAF_NONE);
        SWITCH_ADD_APP(app_interface, "spandsp_start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_MEDIA_TAP);
index 5f5a038c4329f0eb3810ff8a0cc436e6ab151a8e..ac40fa2d9bdcd562d906b640e32200073f0aa8f8 100644 (file)
@@ -132,6 +132,7 @@ void mod_spandsp_dsp_shutdown(void);
 
 void mod_spandsp_fax_event_handler(switch_event_t *event);
 void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *data, mod_spandsp_fax_application_mode_t app_mode);
+void mod_spandsp_fax_stop_fax(switch_core_session_t *session);
 switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app, const char *data);
 
 switch_status_t spandsp_stop_inband_dtmf_session(switch_core_session_t *session);
index c76fda6637a2d1daeaa8df3628564ea9133d49a4..026917b58f38225c996f2b736a5a836d66bdeec3 100644 (file)
@@ -1347,6 +1347,14 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati
        return pvt;
 }
 
+void mod_spandsp_fax_stop_fax(switch_core_session_t *session)
+{
+       pvt_t *pvt = switch_channel_get_private(switch_core_session_get_channel(session), "_fax_pvt");
+       if (pvt) {
+               pvt->done = 1;
+       }
+}
+
 void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *data, mod_spandsp_fax_application_mode_t app_mode)
 {
        pvt_t *pvt;
@@ -1365,7 +1373,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
 
 
        pvt = pvt_init(session, app_mode);
-
+       switch_channel_set_private(channel, "_fax_pvt", pvt);
 
        buf = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
 
@@ -1478,6 +1486,8 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
                int tx = 0;
                switch_status_t status;
 
+               switch_ivr_parse_all_events(session);
+
                /*
                   if we are in T.38 mode, we should: 1- initialize the ptv->t38_state stuff, if not done
                   and then set some callbacks when reading frames.