From aa0bea3d5c44b767308baad9b946d95596146eba Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 19 Mar 2008 17:56:27 +0000 Subject: [PATCH] deal with MODENDP-99 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7934 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/curl/lib/config.h.in | 10 +++++----- libs/libresample/configure.in | 2 ++ libs/xmlrpc-c/xmlrpc_amconfig.h.in | 2 +- src/mod/endpoints/mod_iax/mod_iax.c | 15 +++++++++++++++ src/switch_ivr_bridge.c | 2 +- src/switch_rtp.c | 7 ++++--- 6 files changed, 28 insertions(+), 10 deletions(-) diff --git a/libs/curl/lib/config.h.in b/libs/curl/lib/config.h.in index 4bc60b0df1..8602189707 100644 --- a/libs/curl/lib/config.h.in +++ b/libs/curl/lib/config.h.in @@ -621,16 +621,16 @@ /* Define to the function return type for send. */ #undef SEND_TYPE_RETV -/* The size of `curl_off_t', as computed by sizeof. */ +/* The size of a `curl_off_t', as computed by sizeof. */ #undef SIZEOF_CURL_OFF_T -/* The size of `long', as computed by sizeof. */ +/* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of `size_t', as computed by sizeof. */ +/* The size of a `size_t', as computed by sizeof. */ #undef SIZEOF_SIZE_T -/* The size of `time_t', as computed by sizeof. */ +/* The size of a `time_t', as computed by sizeof. */ #undef SIZEOF_TIME_T /* Define to 1 if you have the ANSI C header files. */ @@ -685,7 +685,7 @@ /* type to use in place of in_addr_t if not defined */ #undef in_addr_t -/* Define to `unsigned int' if does not define. */ +/* Define to `unsigned' if does not define. */ #undef size_t /* type to use in place of socklen_t if not defined */ diff --git a/libs/libresample/configure.in b/libs/libresample/configure.in index 5427188b45..66e8e1eb16 100644 --- a/libs/libresample/configure.in +++ b/libs/libresample/configure.in @@ -45,6 +45,8 @@ fi AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"]) +echo host $host +echo ax_cv_c_compiler_vendor ${ax_cv_c_compiler_vendor} case "$host" in *-solaris2*) if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then diff --git a/libs/xmlrpc-c/xmlrpc_amconfig.h.in b/libs/xmlrpc-c/xmlrpc_amconfig.h.in index b73edb35a9..99479b65af 100644 --- a/libs/xmlrpc-c/xmlrpc_amconfig.h.in +++ b/libs/xmlrpc-c/xmlrpc_amconfig.h.in @@ -81,5 +81,5 @@ /* Version number of package */ #undef VERSION -/* Define to `unsigned int' if does not define. */ +/* Define to `unsigned' if does not define. */ #undef size_t diff --git a/src/mod/endpoints/mod_iax/mod_iax.c b/src/mod/endpoints/mod_iax/mod_iax.c index 8c6e2b61d3..396948f788 100644 --- a/src/mod/endpoints/mod_iax/mod_iax.c +++ b/src/mod/endpoints/mod_iax/mod_iax.c @@ -87,6 +87,8 @@ struct private_object { switch_codec_t write_codec; switch_frame_t read_frame; unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_frame_t cng_frame; + unsigned char cng_databuf[10]; switch_core_session_t *session; struct iax_session *iax_session; switch_caller_profile_t *caller_profile; @@ -441,6 +443,10 @@ static void tech_init(private_t * tech_pvt, switch_core_session_t *session) { tech_pvt->read_frame.data = tech_pvt->databuf; tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf); + tech_pvt->cng_frame.data = tech_pvt->cng_databuf; + tech_pvt->cng_frame.buflen = sizeof(tech_pvt->cng_databuf); + switch_set_flag((&tech_pvt->cng_frame), SFF_CNG); + tech_pvt->cng_frame.datalen = 2; switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); switch_core_session_set_private(session, tech_pvt); @@ -604,6 +610,12 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch return SWITCH_STATUS_FALSE; } + if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_DTMF)) { + switch_clear_flag_locked(tech_pvt, TFLAG_DTMF); + *frame = &tech_pvt->cng_frame; + return SWITCH_STATUS_SUCCESS; + } + if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) { switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); if (!tech_pvt->read_frame.datalen) { @@ -1107,7 +1119,10 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime) if (globals.debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%c DTMF %s\n", dtmf.digit, switch_channel_get_name(channel)); } + switch_mutex_lock(tech_pvt->flag_mutex); switch_channel_queue_dtmf(channel, &dtmf); + switch_set_flag(tech_pvt, TFLAG_DTMF); + switch_mutex_unlock(tech_pvt->flag_mutex); } break; diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 9ad7b9d926..fcb2ac8e1d 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -178,7 +178,7 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj) switch_dtmf_t dtmf = { 0, 0 }; if (switch_channel_dequeue_dtmf(chan_a, &dtmf) == SWITCH_STATUS_SUCCESS) { int send_dtmf = 1; - + if (input_callback) { switch_status_t cb_status = input_callback(session_a, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, user_data, 0); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 8643ca07f2..d29a681bd7 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1098,7 +1098,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ { switch_size_t bytes = 0; switch_status_t status; - uint8_t check = 1; + uint8_t check = 0; stfu_frame_t *jb_frame; int ret = -1; @@ -1125,6 +1125,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK)) { switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK); + do_2833(rtp_session); bytes = 0; do_cng = 1; goto cng; @@ -1154,8 +1155,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } else if (bytes) { check++; } - - if (check) { + + if (check || bytes) { do_2833(rtp_session); }