]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't let inherit_codec work when we have ep_codec_string set and the B-leg codec...
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 31 Dec 2010 17:59:33 +0000 (11:59 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 31 Dec 2010 17:59:33 +0000 (11:59 -0600)
src/switch_ivr_originate.c

index 26d8374f9a644631e854b71ef974f06f5088545e..28af589518dba053263471cae1a67dfb3ef9ab39 100644 (file)
@@ -384,8 +384,9 @@ static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_
                switch_codec_implementation_t video_impl = { 0 };
                char tmp[128] = "";
 
-
                if (switch_core_session_get_read_impl(session, &impl) == SWITCH_STATUS_SUCCESS) {
+                       const char *ep = switch_channel_get_variable(caller_channel, "ep_codec_string");
+
                        if (switch_core_session_get_video_read_impl(session, &video_impl) == SWITCH_STATUS_SUCCESS) {
                                switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui,%s",
                                                                impl.iananame, impl.samples_per_second, impl.microseconds_per_packet / 1000,
@@ -394,9 +395,15 @@ static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_
                                switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui",
                                                                impl.iananame, impl.samples_per_second, impl.microseconds_per_packet / 1000);
                        }
-                       switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp);
-                       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n",
-                                                         switch_channel_get_name(caller_channel), tmp);
+               
+                       if (ep && switch_stristr(impl.iananame, ep)) {
+                               switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp);
+                               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n",
+                                                                 switch_channel_get_name(caller_channel), tmp);
+                       } else {
+                               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Codec string %s not supported on %s, skipping inheritance\n",
+                                                                 tmp, switch_channel_get_name(caller_channel));
+                       }
                } else {
                        switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_WARNING,
                                                          "Error inheriting codec.  Channel %s has no read codec yet.\n",