update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1109 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
4dda1b7b9a
commit
87fa936a04
|
@ -281,7 +281,7 @@ static switch_status exosip_on_init(switch_core_session *session)
|
||||||
ip = globals.extip;
|
ip = globals.extip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snprintf(from_uri, sizeof(from_uri), "<sip:%s@%s>", tech_pvt->caller_profile->caller_id_number, ip);
|
snprintf(from_uri, sizeof(from_uri), "%s <sip:%s@%s>", tech_pvt->caller_profile->caller_id_name, tech_pvt->caller_profile->caller_id_number, ip);
|
||||||
|
|
||||||
/* Setup codec negotiation stuffs */
|
/* Setup codec negotiation stuffs */
|
||||||
osip_rfc3264_init(&tech_pvt->sdp_config);
|
osip_rfc3264_init(&tech_pvt->sdp_config);
|
||||||
|
@ -1044,6 +1044,9 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||||
int num_codecs = 0;
|
int num_codecs = 0;
|
||||||
switch_port_t sdp_port;
|
switch_port_t sdp_port;
|
||||||
char *ip, *err;
|
char *ip, *err;
|
||||||
|
osip_uri_t *uri;
|
||||||
|
osip_from_t *from;
|
||||||
|
char *displayname, *username;
|
||||||
|
|
||||||
switch_core_session_add_stream(session, NULL);
|
switch_core_session_add_stream(session, NULL);
|
||||||
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
|
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
|
||||||
|
@ -1060,10 +1063,28 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||||
snprintf(name, sizeof(name), "Exosip/%s-%04x", event->request->from->url->username, rand() & 0xffff);
|
snprintf(name, sizeof(name), "Exosip/%s-%04x", event->request->from->url->username, rand() & 0xffff);
|
||||||
switch_channel_set_name(channel, name);
|
switch_channel_set_name(channel, name);
|
||||||
|
|
||||||
|
|
||||||
|
if (!(from = osip_message_get_from(event->request))) {
|
||||||
|
switch_core_session_destroy(&session);
|
||||||
|
return SWITCH_STATUS_MEMERR;
|
||||||
|
}
|
||||||
|
if (!(displayname = osip_from_get_displayname(from))) {
|
||||||
|
displayname = event->request->from->url->username;
|
||||||
|
if (!displayname) {
|
||||||
|
displayname = "n/a";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(uri = osip_from_get_url(from))) {
|
||||||
|
username = displayname;
|
||||||
|
} else {
|
||||||
|
username = osip_uri_get_username(uri);
|
||||||
|
}
|
||||||
|
|
||||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
||||||
globals.dialplan,
|
globals.dialplan,
|
||||||
event->request->from->displayname,
|
displayname,
|
||||||
event->request->from->url->username,
|
username,
|
||||||
event->request->from->url->host,
|
event->request->from->url->host,
|
||||||
NULL, NULL, event->request->req_uri->username)) != 0) {
|
NULL, NULL, event->request->req_uri->username)) != 0) {
|
||||||
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
|
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
|
||||||
|
|
|
@ -284,7 +284,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_create(switch_rtp **new_rtp_session,
|
||||||
policy.key = (uint8_t *) key;
|
policy.key = (uint8_t *) key;
|
||||||
policy.next = NULL;
|
policy.next = NULL;
|
||||||
policy.rtp.sec_serv = sec_serv_conf_and_auth;
|
policy.rtp.sec_serv = sec_serv_conf_and_auth;
|
||||||
policy.rtcp.sec_serv = sec_serv_conf_and_auth;
|
policy.rtcp.sec_serv = sec_serv_none;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read key from hexadecimal on command line into an octet string
|
* read key from hexadecimal on command line into an octet string
|
||||||
|
@ -309,24 +309,8 @@ SWITCH_DECLARE(switch_status) switch_rtp_create(switch_rtp **new_rtp_session,
|
||||||
|
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "set master key/salt to %s/", octet_string_hex_string(key, 16));
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "set master key/salt to %s/", octet_string_hex_string(key, 16));
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "%s\n", octet_string_hex_string(key+16, 14));
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "%s\n", octet_string_hex_string(key+16, 14));
|
||||||
} else {
|
|
||||||
policy.key = (uint8_t *)key;
|
|
||||||
policy.ssrc.type = ssrc_specific;
|
|
||||||
policy.ssrc.value = ssrc;
|
|
||||||
policy.rtp.cipher_type = NULL_CIPHER;
|
|
||||||
policy.rtp.cipher_key_len = 0;
|
|
||||||
policy.rtp.auth_type = NULL_AUTH;
|
|
||||||
policy.rtp.auth_key_len = 0;
|
|
||||||
policy.rtp.auth_tag_len = 0;
|
|
||||||
policy.rtp.sec_serv = sec_serv_none;
|
|
||||||
policy.rtcp.cipher_type = NULL_CIPHER;
|
|
||||||
policy.rtcp.cipher_key_len = 0;
|
|
||||||
policy.rtcp.auth_type = NULL_AUTH;
|
|
||||||
policy.rtcp.auth_key_len = 0;
|
|
||||||
policy.rtcp.auth_tag_len = 0;
|
|
||||||
policy.rtcp.sec_serv = sec_serv_none;
|
|
||||||
policy.next = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rtp_session->send_msg.header.ssrc = htonl(ssrc);
|
rtp_session->send_msg.header.ssrc = htonl(ssrc);
|
||||||
rtp_session->send_msg.header.ts = 0;
|
rtp_session->send_msg.header.ts = 0;
|
||||||
rtp_session->send_msg.header.seq = (uint16_t) rand();
|
rtp_session->send_msg.header.seq = (uint16_t) rand();
|
||||||
|
@ -352,8 +336,11 @@ SWITCH_DECLARE(switch_status) switch_rtp_create(switch_rtp **new_rtp_session,
|
||||||
rtp_session->ms_per_packet = ms_per_packet;
|
rtp_session->ms_per_packet = ms_per_packet;
|
||||||
rtp_session->packet_size = packet_size;
|
rtp_session->packet_size = packet_size;
|
||||||
rtp_session->next_read = switch_time_now() + rtp_session->ms_per_packet;
|
rtp_session->next_read = switch_time_now() + rtp_session->ms_per_packet;
|
||||||
srtp_create(&rtp_session->recv_ctx, &policy);
|
|
||||||
srtp_create(&rtp_session->send_ctx, &policy);
|
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE)) {
|
||||||
|
srtp_create(&rtp_session->recv_ctx, &policy);
|
||||||
|
srtp_create(&rtp_session->send_ctx, &policy);
|
||||||
|
}
|
||||||
|
|
||||||
*new_rtp_session = rtp_session;
|
*new_rtp_session = rtp_session;
|
||||||
|
|
||||||
|
@ -420,6 +407,12 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp **rtp_session)
|
||||||
{
|
{
|
||||||
switch_rtp_kill_socket(*rtp_session);
|
switch_rtp_kill_socket(*rtp_session);
|
||||||
switch_socket_close((*rtp_session)->sock);
|
switch_socket_close((*rtp_session)->sock);
|
||||||
|
|
||||||
|
if (switch_test_flag((*rtp_session), SWITCH_RTP_FLAG_SECURE)) {
|
||||||
|
srtp_dealloc((*rtp_session)->recv_ctx);
|
||||||
|
srtp_dealloc((*rtp_session)->send_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
*rtp_session = NULL;
|
*rtp_session = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue