提交 c4b221c7 authored 作者: Anthony Minessale's avatar Anthony Minessale

trying to get mozilla to work using sipml5, got stun/dtls/rtp flowing and its…

trying to get mozilla to work using sipml5, got stun/dtls/rtp flowing and its dead silent.  c'mon guys... why do you have to do everything differently?????
上级 05dd02d0
......@@ -1387,7 +1387,9 @@ void sdp_media_transport(sdp_media_t *m, char const *s)
else if (su_casematch(s, "RTP/SAVP"))
m->m_proto = sdp_proto_srtp, m->m_proto_name = "RTP/SAVP";
else if (su_casematch(s, "RTP/SAVPF"))
m->m_proto = sdp_proto_extended_srtp, m->m_proto_name = "RTP/SAVPF";
m->m_proto = sdp_proto_extended_srtp, m->m_proto_name = "RTP/SAVPF";
else if (su_casematch(s, "UDP/TLS/RTP/SAVPF"))
m->m_proto = sdp_proto_extended_srtp, m->m_proto_name = "UDP/TLS/RTP/SAVPF";
else if (su_casematch(s, "udptl"))
/* Lower case - be compatible with people living by T.38 examples */
m->m_proto = sdp_proto_udptl, m->m_proto_name = "udptl";
......
......@@ -3,11 +3,17 @@
#define SHA1_HASH_SIZE 20
struct globals_s globals;
#ifndef PTHREAD
#ifndef WSS_STANDALONE
void init_ssl(void)
{
SSL_library_init();
}
void deinit_ssl(void)
{
return;
}
#else
static unsigned long pthreads_thread_id(void);
static void pthreads_locking_callback(int mode, int type, const char *file, int line);
......@@ -68,23 +74,24 @@ static unsigned long pthreads_thread_id(void)
void init_ssl(void) {
SSL_library_init();
// OpenSSL_add_all_algorithms(); /* load & register cryptos */
// SSL_load_error_strings(); /* load all error messages */
//globals.ssl_method = SSLv23_server_method(); /* create server instance */
//globals.ssl_ctx = SSL_CTX_new(globals.ssl_method); /* create context */
//assert(globals.ssl_ctx);
OpenSSL_add_all_algorithms(); /* load & register cryptos */
SSL_load_error_strings(); /* load all error messages */
globals.ssl_method = TLSv1_server_method(); /* create server instance */
globals.ssl_ctx = SSL_CTX_new(globals.ssl_method); /* create context */
assert(globals.ssl_ctx);
/* set the local certificate from CertFile */
//SSL_CTX_use_certificate_file(globals.ssl_ctx, globals.cert, SSL_FILETYPE_PEM);
SSL_CTX_use_certificate_file(globals.ssl_ctx, globals.cert, SSL_FILETYPE_PEM);
/* set the private key from KeyFile */
//SSL_CTX_use_PrivateKey_file(globals.ssl_ctx, globals.key, SSL_FILETYPE_PEM);
SSL_CTX_use_PrivateKey_file(globals.ssl_ctx, globals.key, SSL_FILETYPE_PEM);
/* verify private key */
//if ( !SSL_CTX_check_private_key(globals.ssl_ctx) ) {
// abort();
//}
if ( !SSL_CTX_check_private_key(globals.ssl_ctx) ) {
abort();
}
thread_setup();
}
......@@ -215,7 +222,7 @@ int ws_handshake(wsh_t *wsh)
if (wsh->sock == ws_sock_invalid) {
return -3;
}
while((bytes = ws_raw_read(wsh, wsh->buffer + wsh->datalen, wsh->buflen - wsh->datalen)) > 0) {
wsh->datalen += bytes;
if (strstr(wsh->buffer, "\r\n\r\n") || strstr(wsh->buffer, "\n\n")) {
......@@ -272,7 +279,7 @@ int ws_handshake(wsh_t *wsh)
//printf("ERR:\n%s\n", respond);
send(wsh->sock, respond, strlen(respond), 0);
ws_raw_write(wsh, respond, strlen(respond));
ws_close(wsh, WS_NONE);
......@@ -300,7 +307,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes)
} while (r == -1 && (errno == EAGAIN || errno == EINTR) && x < 100);
//if (r<0) {
//printf("READ FAIL: %s\n", strerror(errno));
// printf("READ FAIL: %s\n", strerror(errno));
//}
return r;
......@@ -334,6 +341,10 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c
memset(wsh, 0, sizeof(*wsh));
wsh->sock = sock;
if (!ssl_ctx) {
ssl_ctx = globals.ssl_ctx;
}
if (close_sock) {
wsh->close_sock = 1;
}
......@@ -352,13 +363,16 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, size_t buflen, SSL_CTX *ssl_ctx, int c
if (wsh->secure) {
int code;
wsh->ssl = SSL_new(ssl_ctx);
assert(wsh->ssl);
SSL_set_fd(wsh->ssl, wsh->sock);
do {
code = SSL_accept(wsh->ssl);
} while (code == -1 && SSL_get_error(wsh->ssl, code) == SSL_ERROR_WANT_READ);
}
while (!wsh->down && !wsh->handshake) {
......
#ifndef _WS_H
#define _WS_H
//#define WSS_STANDALONE 1
#define MAXLEN 0x10000
#define WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
#define B64BUFFLEN 1024
......
......@@ -1297,6 +1297,7 @@ typedef enum {
CF_AUTOFLUSH_DURING_BRIDGE,
CF_RTP_NOTIMER_DURING_BRIDGE,
CF_WEBRTC,
CF_WEBRTC_MOZ,
CF_ICE,
CF_DTLS,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
......
......@@ -663,6 +663,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
if (switch_channel_test_flag(channel, CF_CONFERENCE)) {
tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;isfocus", tech_pvt->reply_contact);
}
//switch_core_media_set_local_sdp
if(sofia_test_flag(tech_pvt, TFLAG_3PCC_INVITE)) {
// SNARK: complete hack to get final ack sent when a 3pcc invite has been passed from the other leg in bypass_media mode.
......@@ -688,7 +689,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
}
if (sofia_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
return SWITCH_STATUS_SUCCESS;
printf("BALLZ %d\n", __LINE__);return SWITCH_STATUS_SUCCESS;
}
......@@ -702,7 +703,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
switch_core_media_patch_sdp(tech_pvt->session);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
printf("BALLZ %d\n", __LINE__);return SWITCH_STATUS_FALSE;
}
}
} else {
......@@ -721,7 +722,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
switch_core_media_patch_sdp(tech_pvt->session);
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
printf("BALLZ %d\n", __LINE__);return SWITCH_STATUS_FALSE;
}
}
}
......@@ -776,7 +777,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
return SWITCH_STATUS_SUCCESS;
printf("BALLZ %d\n", __LINE__);return SWITCH_STATUS_SUCCESS;
}
if ((is_proxy && !b_sdp) || sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) ||
......@@ -799,14 +800,14 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
//switch_mutex_lock(tech_pvt->sofia_mutex);
//nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
//switch_mutex_unlock(tech_pvt->sofia_mutex);
return SWITCH_STATUS_FALSE;
printf("BALLZ %d\n", __LINE__);return SWITCH_STATUS_FALSE;
}
}
}
if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return status;
printf("BALLZ %d\n", __LINE__);return status;
}
switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
......
......@@ -77,20 +77,20 @@ switch_status_t sofia_media_tech_media(private_object_t *tech_pvt, const char *r
switch_assert(r_sdp != NULL);
if (zstr(r_sdp)) {
return SWITCH_STATUS_FALSE;
printf("BALLZ %d\n", __LINE__);return SWITCH_STATUS_FALSE;
}
if ((match = sofia_media_negotiate_sdp(tech_pvt->session, r_sdp))) {
if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
printf("BALLZ %d\n", __LINE__);return SWITCH_STATUS_FALSE;
}
if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
printf("BALLZ %d\n", __LINE__);return SWITCH_STATUS_FALSE;
}
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA");
sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_channel_mark_pre_answered(tech_pvt->channel);
return SWITCH_STATUS_SUCCESS;
printf("BALLZ %d\n", __LINE__);return SWITCH_STATUS_SUCCESS;
}
......
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论