]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Disable msrp by default, only enable when listen-port or listen-ssl-port confi...
authorCiprian <ciprian.dosoftei@gmail.com>
Sun, 13 Oct 2019 17:27:58 +0000 (13:27 -0400)
committerAndrey Volk <andywolk@gmail.com>
Sun, 13 Oct 2019 17:27:58 +0000 (21:27 +0400)
conf/vanilla/autoload_configs/msrp.conf.xml
src/include/switch_msrp.h
src/switch_msrp.c

index 8b9e03e300f305fdebfdd67165288dfb20707176..65c2d619762a22c6ab6526c145800d42712a5bf5 100644 (file)
@@ -1,8 +1,8 @@
 <configuration name="msrp.conf" description="MSRP">
   <settings>
     <param name="listen-ip" value="$${local_ip_v4}"/>
-    <param name="listen-port" value="2855"/>
-    <param name="listen-ssl-port" value="2856"/>
+    <!-- <param name="listen-port" value="2855"/> -->
+    <!-- <param name="listen-ssl-port" value="2856"/> -->
     <!-- <param name="message-buffer-size" value="50"/> -->
     <!-- <param name="debug" value="true"/> -->
     <!-- <param name="secure-cert" value="$${certs_dir}/wss.pem"/> -->
index 0b114c02fa69668c46066f89cc77c996de404090..9ec9243664df5d993b23fd53e16f6bcf688a916a 100644 (file)
@@ -34,9 +34,6 @@
 
 #include <switch.h>
 
-#define MSRP_LISTEN_PORT 2855
-#define MSRP_SSL_LISTEN_PORT 2856
-
 enum {
        MSRP_ST_WAIT_HEADER,
        MSRP_ST_PARSE_HEADER,
index bc680d11cad2e46b1ac607851578713a00808e2e..da5e288dc0e6df470d7ffb750e1190d118dd743d 100644 (file)
@@ -36,8 +36,6 @@
 
 #define MSRP_BUFF_SIZE (SWITCH_RTP_MAX_BUF_LEN - 32)
 #define DEBUG_MSRP 0
-#define MSRP_LISTEN_PORT 2855
-#define MSRP_SSL_LISTEN_PORT 2856
 
 struct msrp_socket_s {
        switch_port_t port;
@@ -297,35 +295,41 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_init()
        memset(&globals, 0, sizeof(globals));
        set_global_ip("0.0.0.0");
        globals.pool = pool;
-       globals.msock.port = (switch_port_t)MSRP_LISTEN_PORT;
-       globals.msock_ssl.port = (switch_port_t)MSRP_SSL_LISTEN_PORT;
+       globals.msock.port = (switch_port_t)0;
+       globals.msock_ssl.port = (switch_port_t)0;
        globals.msock_ssl.secure = 1;
        globals.message_buffer_size = 50;
        globals.debug = DEBUG_MSRP;
 
        load_config();
 
-       globals.running = 1;
+       if (globals.msock.port) {
+               globals.running = 1;
 
-       status = msock_init(globals.ip, globals.msock.port, &globals.msock.sock, pool);
+               status = msock_init(globals.ip, globals.msock.port, &globals.msock.sock, pool);
 
-       if (status == SWITCH_STATUS_SUCCESS) {
-               switch_threadattr_create(&thd_attr, pool);
-               // switch_threadattr_detach_set(thd_attr, 1);
-               switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-               switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock, pool);
-               globals.msock.thread = thread;
+               if (status == SWITCH_STATUS_SUCCESS) {
+                       switch_threadattr_create(&thd_attr, pool);
+                       // switch_threadattr_detach_set(thd_attr, 1);
+                       switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+                       switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock, pool);
+                       globals.msock.thread = thread;
+               }
        }
 
-       msrp_init_ssl();
-       status = msock_init(globals.ip, globals.msock_ssl.port, &globals.msock_ssl.sock, pool);
+       if (globals.msock_ssl.port) {
+               globals.running = 1;
 
-       if (status == SWITCH_STATUS_SUCCESS) {
-               switch_threadattr_create(&thd_attr, pool);
-               // switch_threadattr_detach_set(thd_attr, 1);
-               switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-               switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock_ssl, pool);
-               globals.msock_ssl.thread = thread;
+               msrp_init_ssl();
+               status = msock_init(globals.ip, globals.msock_ssl.port, &globals.msock_ssl.sock, pool);
+
+               if (status == SWITCH_STATUS_SUCCESS) {
+                       switch_threadattr_create(&thd_attr, pool);
+                       // switch_threadattr_detach_set(thd_attr, 1);
+                       switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+                       switch_thread_create(&thread, thd_attr, msrp_listener, &globals.msock_ssl, pool);
+                       globals.msock_ssl.thread = thread;
+               }
        }
 
        return SWITCH_STATUS_SUCCESS;
@@ -411,7 +415,7 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_session_destroy(switch_msrp_session_
 switch_status_t switch_msrp_session_push_msg(switch_msrp_session_t *ms, switch_msrp_msg_t *msg)
 {
        switch_mutex_lock(ms->mutex);
-       
+
        if (ms->last_msg == NULL) {
                ms->last_msg = msg;
                ms->msrp_msg = msg;