Merge branch 'master' into v1.4.beta

Conflicts:
	configure.in
This commit is contained in:
Ken Rice
2013-06-26 15:11:15 -05:00
12 changed files with 44 additions and 46 deletions
+1 -1
View File
@@ -1 +1 @@
Tue Jun 25 09:28:40 CDT 2013
Wed Jun 26 12:43:51 EDT 2013
@@ -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;
}
}
@@ -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;
+2 -6
View File
@@ -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);
}
+1 -1
View File
@@ -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);
-1
View File
@@ -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,
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
* Emmanuel Schmidbauer <e.schmidbauer@gmail.com>
*
*
* 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);
+1
View File
@@ -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,
+10 -10
View File
@@ -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);
+3 -1
View File
@@ -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);
+5 -5
View File
@@ -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__;
+2 -2
View File
@@ -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));
}