]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
allow {dtmf_type=none} to work in oubound dial strings
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 26 Oct 2010 20:43:14 +0000 (15:43 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 26 Oct 2010 20:43:14 +0000 (15:43 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_glue.c

index 702875465a8864cb75db43e7cb9650554bbf2099..577887bdeb0a08df6fc4d301eb7ff46e456b45f2 100644 (file)
@@ -80,6 +80,9 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
        tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
        switch_mutex_lock(tech_pvt->sofia_mutex);
 
+
+       sofia_glue_check_dtmf_type(tech_pvt);
+
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA INIT\n", switch_channel_get_name(channel));
        if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
                sofia_glue_tech_absorb_sdp(tech_pvt);
index 3cb2ddb50fe5d7b0ecee9fa3d5edf714980df097..baff8e95e223b3492135105fef2f821ee4e953b4 100644 (file)
@@ -1029,3 +1029,4 @@ void sofia_glue_global_watchdog(switch_bool_t on);
 void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp);
 switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt);
 void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl);
+void sofia_glue_check_dtmf_type(private_object_t *tech_pvt);
index ddeb0e48f10dd00e1ebdd0e9a0879b7be686deeb..c9b384b3e823336a80e27942af3fa9435efffd1b 100644 (file)
@@ -336,6 +336,23 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen,
 
 }
 
+void sofia_glue_check_dtmf_type(private_object_t *tech_pvt) 
+{
+       const char *val;
+
+       if ((val = switch_channel_get_variable(tech_pvt->channel, "dtmf_type"))) {
+               if (!strcasecmp(val, "rfc2833")) {
+                       tech_pvt->dtmf_type = DTMF_2833;
+               } else if (!strcasecmp(val, "info")) {
+                       tech_pvt->dtmf_type = DTMF_INFO;
+               } else if (!strcasecmp(val, "none")) {
+                       tech_pvt->dtmf_type = DTMF_NONE;
+               } else {
+                       tech_pvt->dtmf_type = tech_pvt->profile->dtmf_type;
+               }
+       }
+}
+
 
 void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32_t port, const char *sr, int force)
 {
@@ -357,6 +374,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
        switch_event_t *map = NULL, *ptmap = NULL;
        const char *b_sdp = NULL;
 
+       sofia_glue_check_dtmf_type(tech_pvt);
 
        if (!tech_pvt->payload_space) {
                int i;
@@ -797,8 +815,6 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
                tech_pvt->recv_te = tech_pvt->te = profile->te;
        }
 
-       tech_pvt->dtmf_type = profile->dtmf_type;
-
        if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
                if (tech_pvt->bcng_pt) {
                        tech_pvt->cng_pt = tech_pvt->bcng_pt;
@@ -2904,16 +2920,6 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
                flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT);
        }
 
-       if ((val = switch_channel_get_variable(tech_pvt->channel, "dtmf_type"))) {
-               if (!strcasecmp(val, "rfc2833")) {
-                       tech_pvt->dtmf_type = DTMF_2833;
-               } else if (!strcasecmp(val, "info")) {
-                       tech_pvt->dtmf_type = DTMF_INFO;
-               } else {
-                       tech_pvt->dtmf_type = tech_pvt->profile->dtmf_type;
-               }
-       }
-
        if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_RFC2833)
                || ((val = switch_channel_get_variable(tech_pvt->channel, "pass_rfc2833")) && switch_true(val))) {
                sofia_set_flag(tech_pvt, TFLAG_PASS_RFC2833);