From da97fa8dd9dfbe20dcd46040eeb840afc83f6b9f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 25 Jun 2013 15:50:06 -0500 Subject: [PATCH 1/6] bump --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 891af3f4bd..3de8ac62b0 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,7 @@ AC_INIT([freeswitch], [1.5.2], bugs@freeswitch.org) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [5]) -AC_SUBST(SWITCH_VERSION_MICRO, [2b]) +AC_SUBST(SWITCH_VERSION_MICRO, [2]) AC_SUBST(SWITCH_VERSION_REVISION, []) AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, []) From a6f5efaedf201b29a653fe1390be8fde90c4bc4f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 25 Jun 2013 15:51:12 -0500 Subject: [PATCH 2/6] bump --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 3de8ac62b0..fd52b959ff 100644 --- a/configure.in +++ b/configure.in @@ -3,10 +3,10 @@ # Must change all of the below together # For a release, set revision for that tagged release as well and uncomment -AC_INIT([freeswitch], [1.5.2], bugs@freeswitch.org) +AC_INIT([freeswitch], [1.5.3b], bugs@freeswitch.org) AC_SUBST(SWITCH_VERSION_MAJOR, [1]) AC_SUBST(SWITCH_VERSION_MINOR, [5]) -AC_SUBST(SWITCH_VERSION_MICRO, [2]) +AC_SUBST(SWITCH_VERSION_MICRO, [3b]) AC_SUBST(SWITCH_VERSION_REVISION, []) AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, []) From afc18668f3d3a140ca3eed11edb0f7f6584df034 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 26 Jun 2013 12:43:54 -0400 Subject: [PATCH 3/6] tweak sip ws code to avoid double free --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/tport/tport_type_ws.c | 34 +++++++++---------- .../libsofia-sip-ua/tport/tport_ws.h | 2 +- libs/sofia-sip/libsofia-sip-ua/tport/ws.c | 8 ++--- libs/sofia-sip/libsofia-sip-ua/tport/ws.h | 2 +- 5 files changed, 21 insertions(+), 27 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 91bc2e3e8a..0440205a53 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Tue Jun 25 09:28:40 CDT 2013 +Wed Jun 26 12:43:51 EDT 2013 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c index c6846be1e1..d9ed0b6980 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c @@ -207,23 +207,14 @@ int tport_recv_stream_ws(tport_t *self) int err; msg_iovec_t iovec[msg_n_fragments] = {{ 0 }}; tport_ws_t *wstp = (tport_ws_t *)self; - wsh_t *ws = wstp->ws; - tport_ws_primary_t *wspri = (tport_ws_primary_t *)self->tp_pri; uint8_t *data; ws_opcode_t oc; if (wstp->ws_initialized < 0) { return -1; - } else if (wstp->ws_initialized == 0) { - if (ws_init(ws, self->tp_socket, 65336, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0) == -2) { - return 2; - } - wstp->ws_initialized = 1; - self->tp_pre_framed = 1; - return 1; } - N = ws_read_frame(ws, &oc, &data); + N = ws_read_frame(&wstp->ws, &oc, &data); if (N == -2) { return 2; @@ -276,7 +267,6 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg, size_t i, j, n, m, size = 0; ssize_t nerror; tport_ws_t *wstp = (tport_ws_t *)self; - wsh_t *ws = wstp->ws; enum { WSBUFSIZE = 2048 }; @@ -311,10 +301,10 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg, iov[j].siv_base = buf, iov[j].siv_len = m; } - nerror = ws_feed_buf(ws, buf, m); + nerror = ws_feed_buf(&wstp->ws, buf, m); SU_DEBUG_9(("tport_ws_writevec: vec %p %p %lu ("MOD_ZD")\n", - (void *)ws, (void *)iov[i].siv_base, (LU)iov[i].siv_len, + (void *)&wstp->ws, (void *)iov[i].siv_base, (LU)iov[i].siv_len, nerror)); if (nerror == -1) { @@ -333,7 +323,7 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg, break; } - ws_send_buf(ws, WSOC_TEXT); + ws_send_buf(&wstp->ws, WSOC_TEXT); return size; @@ -453,6 +443,15 @@ int tport_ws_init_secondary(tport_t *self, int socket, int accepted, if ( wspri->ws_secure ) wstp->ws_secure = 1; + + memset(&wstp->ws, 0, sizeof(wstp->ws)); + if (ws_init(&wstp->ws, socket, 65336, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0) < 0) { + return *return_reason = "WS_INIT", -1; + } + + wstp->ws_initialized = 1; + self->tp_pre_framed = 1; + return 0; } @@ -461,10 +460,9 @@ static void tport_ws_deinit_secondary(tport_t *self) tport_ws_t *wstp = (tport_ws_t *)self; if (wstp->ws_initialized == 1) { - wsh_t *wsh = wstp->ws; - SU_DEBUG_1(("%p destroy ws%s transport %p.\n", (void *) self, wstp->ws_secure ? "s" : "", (void *) wsh)); - ws_destroy(&wsh); - wstp->ws_initialized = 1; + SU_DEBUG_1(("%p destroy ws%s transport %p.\n", (void *) self, wstp->ws_secure ? "s" : "", (void *) &wstp->ws)); + ws_destroy(&wstp->ws); + wstp->ws_initialized = -1; } } diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h b/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h index 034b6f8fde..b4a5d42b5a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h @@ -55,7 +55,7 @@ typedef enum { typedef struct tport_ws_s { tport_t wstp_tp[1]; - wsh_t ws[1]; + wsh_t ws; char *wstp_buffer; SU_S8_T ws_initialized; unsigned ws_secure:1; diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index 938b3f6d04..46e41d133b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -402,17 +402,13 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c return 0; } -void ws_destroy(wsh_t **wshp) +void ws_destroy(wsh_t *wsh) { - wsh_t *wsh; - if (!wshp || ! *wshp) { + if (!wsh) { return; } - wsh = *wshp; - *wshp = NULL; - if (!wsh->down) { ws_close(wsh, WS_NONE); } diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h index 2182960c14..13e5c27b2b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h @@ -85,7 +85,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data); issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes); int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int close_sock); issize_t ws_close(wsh_t *wsh, int16_t reason); -void ws_destroy(wsh_t **wshp); +void ws_destroy(wsh_t *wsh); void init_ssl(void); void deinit_ssl(void); From 13dacdcde4e14a509377516966ebd5dc173a214b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 26 Jun 2013 09:17:15 -0500 Subject: [PATCH 4/6] FS-5546 --resolve oddly that is the thing I was trying to fix in the first place --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 9a02479e35..cc73563968 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -840,7 +840,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d xlen += 4 + switch_stun_attribute_padded_length(attr); } while (xlen <= packet->header.length); - if ((ice->type && ICE_GOOGLE_JINGLE) && ok) { + if ((ice->type & ICE_GOOGLE_JINGLE) && ok) { ok = !strcmp(ice->user_ice, username); } @@ -997,7 +997,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d memset(stunbuf, 0, sizeof(stunbuf)); rpacket = switch_stun_packet_build_header(SWITCH_STUN_BINDING_RESPONSE, packet->header.id, stunbuf); - if ((ice->type && ICE_GOOGLE_JINGLE)) { + if ((ice->type & ICE_GOOGLE_JINGLE)) { switch_stun_packet_attribute_add_username(rpacket, username, (uint16_t)strlen(username)); } From bf5fa172e5c00e362c0e7fa6102402b854e16c1c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 26 Jun 2013 10:47:40 -0500 Subject: [PATCH 5/6] FS-5547 --resolve --- src/include/switch_core_media.h | 1 - src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 20 ++++++++++---------- src/mod/endpoints/mod_sofia/sofia_glue.c | 4 +++- src/switch_core_media.c | 10 +++++----- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 624d3bddd0..844a1bbb76 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -73,7 +73,6 @@ typedef enum { SCMF_DISABLE_HOLD, SCMF_RENEG_ON_HOLD, SCMF_RENEG_ON_REINVITE, - SCMF_T38_PASSTHRU, SCMF_LIBERAL_DTMF, SCMF_SUPPRESS_CNG, SCMF_DISABLE_RTP_AUTOADJ, diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 49247f5c9b..90e8dad19e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -234,6 +234,7 @@ typedef enum { PFLAG_MESSAGE_QUERY_ON_REGISTER, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER, PFLAG_MANUAL_REDIRECT, + PFLAG_T38_PASSTHRU, PFLAG_AUTO_NAT, PFLAG_SIPCOMPACT, PFLAG_PRESENCE_PRIVACY, diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b14b852e16..e9f5b9fea4 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3834,9 +3834,9 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } } else if (!strcasecmp(var, "t38-passthru")) { if (switch_true(val)) { - sofia_set_media_flag(profile, SCMF_T38_PASSTHRU); + sofia_set_pflag(profile, PFLAG_T38_PASSTHRU); } else { - sofia_clear_media_flag(profile, SCMF_T38_PASSTHRU); + sofia_clear_pflag(profile, PFLAG_T38_PASSTHRU); } } else if (!strcasecmp(var, "presence-disable-early")) { if (switch_true(val)) { @@ -5306,7 +5306,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } if (switch_channel_test_flag(channel, CF_PROXY_MODE)) { - switch_media_handle_clear_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU); + switch_channel_clear_flag(tech_pvt->channel, CF_T38_PASSTHRU); has_t38 = 0; } @@ -5330,7 +5330,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status if (status > 199 && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA) || - (switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) && (has_t38 || status > 299)))) { + (switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) && (has_t38 || status > 299)))) { if (sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) { sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE); @@ -5350,7 +5350,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase); - if (status == 491 && (switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) || + if (status == 491 && (switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) || switch_channel_test_flag(channel, CF_PROXY_MODE))) { nua_respond(other_tech_pvt->nh, SIP_491_REQUEST_PENDING, TAG_END()); switch_core_session_rwunlock(other_session); @@ -5358,12 +5358,12 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } else if (status > 299) { switch_channel_set_private(channel, "t38_options", NULL); switch_channel_set_private(other_channel, "t38_options", NULL); - switch_media_handle_clear_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU); - switch_media_handle_clear_media_flag(other_tech_pvt->media_handle, SCMF_T38_PASSTHRU); + switch_channel_clear_flag(tech_pvt->channel, CF_T38_PASSTHRU); + switch_channel_clear_flag(other_tech_pvt->channel, CF_T38_PASSTHRU); switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38); switch_channel_clear_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_REQ); switch_channel_set_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_FAIL); - } else if (status == 200 && switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) { + } else if (status == 200 && switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) { switch_t38_options_t *t38_options = switch_core_media_extract_t38_options(session, sip->sip_payload->pl_data); if (!t38_options) { @@ -5384,14 +5384,14 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status msg->numeric_arg = status; msg->string_arg = switch_core_session_strdup(other_session, phrase); - if (status == 200 && switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) && has_t38) { + if (status == 200 && switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) && has_t38) { msg->pointer_arg = switch_core_session_strdup(other_session, "t38"); } else if (r_sdp) { msg->pointer_arg = switch_core_session_strdup(other_session, r_sdp); msg->pointer_arg_size = strlen(r_sdp); } - if (status == 200 && switch_media_handle_test_media_flag(tech_pvt->media_handle, SCMF_T38_PASSTHRU) && has_t38) { + if (status == 200 && switch_channel_test_flag(tech_pvt->channel, CF_T38_PASSTHRU) && has_t38) { if (switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO) && switch_core_media_ready(other_tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) { switch_channel_clear_flag(tech_pvt->channel, CF_NOTIMER_DURING_BRIDGE); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2e35ab3a5b..fccc577fa8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -133,7 +133,9 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t * switch_channel_set_flag(tech_pvt->channel, CF_RTP_NOTIMER_DURING_BRIDGE); } - + if (sofia_test_pflag(tech_pvt->profile, PFLAG_T38_PASSTHRU)) { + switch_channel_set_flag(tech_pvt->channel, CF_T38_PASSTHRU); + } switch_core_media_check_dtmf_type(session); switch_channel_set_cap(tech_pvt->channel, CC_MEDIA_ACK); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 346eddc4b2..9270b0b729 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -2494,7 +2494,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s goto done; } else { const char *var = switch_channel_get_variable(channel, "t38_passthru"); - int pass = switch_media_handle_test_media_flag(smh, SCMF_T38_PASSTHRU); + int pass = switch_channel_test_flag(smh->session->channel, CF_T38_PASSTHRU); if (switch_channel_test_app_flag_key("T38", session->channel, CF_APP_T38)) { @@ -2509,7 +2509,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s } } - if ((pass == 2 && switch_media_handle_test_media_flag(smh, SCMF_T38_PASSTHRU)) + if ((pass == 2 && switch_channel_test_flag(smh->session->channel, CF_T38_PASSTHRU)) || !switch_channel_test_flag(session->channel, CF_REINVITE) || switch_channel_test_flag(session->channel, CF_PROXY_MODE) || @@ -2572,9 +2572,9 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s switch_core_media_copy_t38_options(t38_options, other_session); - switch_media_handle_set_media_flag(smh, SCMF_T38_PASSTHRU); - switch_media_handle_set_media_flag(other_session->media_handle, SCMF_T38_PASSTHRU); - + switch_channel_set_flag(smh->session->channel, CF_T38_PASSTHRU); + switch_channel_set_flag(other_session->channel, CF_T38_PASSTHRU); + msg = switch_core_session_alloc(other_session, sizeof(*msg)); msg->message_id = SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA; msg->from = __FILE__; From c903934628841fde1bb5e38e48cc96e290c57fd9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 26 Jun 2013 10:51:44 -0500 Subject: [PATCH 6/6] FS-5550 --resolve --- src/mod/endpoints/mod_loopback/mod_loopback.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 9d3371ef3d..105b96564a 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -24,6 +24,7 @@ * Contributor(s): * * Anthony Minessale II + * Emmanuel Schmidbauer * * * mod_loopback.c -- Loopback Endpoint Module @@ -534,6 +535,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); + switch_channel_set_variable(channel, "is_loopback", "1"); tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL);