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 */
osip_rfc3264_init(&tech_pvt->sdp_config);
int num_codecs = 0;
switch_port_t sdp_port;
char *ip, *err;
+ osip_uri_t *uri;
+ osip_from_t *from;
+ char *displayname, *username;
switch_core_session_add_stream(session, NULL);
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
snprintf(name, sizeof(name), "Exosip/%s-%04x", event->request->from->url->username, rand() & 0xffff);
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),
globals.dialplan,
- event->request->from->displayname,
- event->request->from->url->username,
+ displayname,
+ username,
event->request->from->url->host,
NULL, NULL, event->request->req_uri->username)) != 0) {
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
policy.key = (uint8_t *) key;
policy.next = NULL;
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
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));
- } 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.ts = 0;
rtp_session->send_msg.header.seq = (uint16_t) rand();
rtp_session->ms_per_packet = ms_per_packet;
rtp_session->packet_size = packet_size;
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;
{
switch_rtp_kill_socket(*rtp_session);
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;
return;
}