[Core] Disable msrp by default, only enable when listen-port or listen-ssl-port config params configured in msrp.conf

This commit is contained in:
Ciprian 2019-10-13 13:27:58 -04:00 committed by Andrey Volk
parent cec8f3b1ca
commit 696814cb26
3 changed files with 27 additions and 26 deletions

View 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"/> -->

View 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,

View 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;