]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
MODAPP-338
authorBrian West <brian@freeswitch.org>
Sun, 20 Sep 2009 20:14:41 +0000 (20:14 +0000)
committerBrian West <brian@freeswitch.org>
Sun, 20 Sep 2009 20:14:41 +0000 (20:14 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14927 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_esf/mod_esf.c

index 51a2366ffb327c85282efe795d9fce747ee238a1..431a806556e4fc7d7be8ccde6be2f34e26bfd1a0 100644 (file)
@@ -80,7 +80,7 @@ SWITCH_STANDARD_APP(bcast_function)
        const char *esf_broadcast_ip = NULL, *var;
        switch_codec_implementation_t read_impl = {0};
     switch_core_session_get_read_impl(session, &read_impl);
-
+       int mcast_ttl = 1;
 
        if (!switch_strlen_zero((char *) data)) {
                mydata = switch_core_session_strdup(session, data);
@@ -104,6 +104,13 @@ SWITCH_STANDARD_APP(bcast_function)
                if (!switch_strlen_zero(argv[2])) {
                        mcast_control_port = (switch_port_t) atoi(argv[2]);
                }
+               
+               if (!switch_strlen_zero(argv[3])) {
+                       mcast_ttl = atoi(argv[3]);
+                       if (mcast_ttl < 1 || mcast_ttl > 255) {
+                               mcast_ttl = 1;
+                       }
+               }
        }
 
        if (switch_true(switch_channel_get_variable(channel, SWITCH_BYPASS_MEDIA_VARIABLE))) {
@@ -128,6 +135,11 @@ SWITCH_STANDARD_APP(bcast_function)
                goto fail;
        }
 
+       if (switch_mcast_hops(socket, mcast_ttl) != SWITCH_STATUS_SUCCESS) {
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Mutlicast TTL set failed\n");
+               goto fail;
+       }
+
        if (switch_sockaddr_info_get(&control_packet_addr, mcast_ip, SWITCH_UNSPEC,
                                                                 mcast_control_port, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Socket Error 3\n");