FS-3166 --resolve

This commit is contained in:
Anthony Minessale
2011-04-22 16:43:29 -05:00
parent c22aac0eac
commit 73279f01bf
41 changed files with 125 additions and 258 deletions
+4 -10
View File
@@ -766,7 +766,6 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw
{
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_channel_t *channel = switch_core_session_get_channel(session);
int payload = 0;
switch_assert(tech_pvt != NULL);
@@ -810,8 +809,6 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw
return status;
}
payload = tech_pvt->video_read_frame.payload;
if (tech_pvt->video_read_frame.datalen > 0) {
break;
}
@@ -867,7 +864,6 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
{
private_object_t *tech_pvt = switch_core_session_get_private(session);
switch_channel_t *channel = switch_core_session_get_channel(session);
int payload = 0;
uint32_t sanity = 1000;
switch_rtcp_frame_t rtcp_frame;
@@ -979,8 +975,6 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
return SWITCH_STATUS_SUCCESS;
}
payload = tech_pvt->read_frame.payload;
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
switch_dtmf_t dtmf = { 0 };
switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf);
@@ -1859,13 +1853,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
const char *name = msg->string_array_arg[0], *number = msg->string_array_arg[1];
char *arg = NULL;
char *argv[2] = { 0 };
int argc;
//int argc;
if (zstr(name) && !zstr(msg->string_arg)) {
arg = strdup(msg->string_arg);
switch_assert(arg);
argc = switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0])));
switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0])));
name = argv[0];
number = argv[1];
@@ -4910,7 +4904,7 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor
switch_console_callback_match_t *my_matches = NULL;
switch_status_t status = SWITCH_STATUS_FALSE;
char *dup = NULL;
int argc;
//int argc;
char *argv[4] = { 0 };
if (zstr(line)) {
@@ -4918,7 +4912,7 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor
}
dup = strdup(line);
argc = switch_split(dup, ' ', argv);
switch_split(dup, ' ', argv);
if (zstr(argv[2]) || !strcmp(argv[2], " ")) {
goto end;
+1 -11
View File
@@ -210,17 +210,14 @@ void _usage(int exitcode, switch_stream_handle_t *stream)
switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream)
{
int exitcode = 0;
int o_sctp = 1, o_tls_sctp = 1, o_verbatim = 1;
int family = 0, multiple = 0;
char const *dnsserver = NULL;
char const *string;
url_t *uri = NULL;
char const *host;
char const *port;
char *transport = NULL, tport[32];
int argc;
char *argv_[25] = { 0 };
char *mycmd = NULL;
char **argv;
@@ -239,7 +236,7 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
mycmd = strdup(cmd);
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv_) / sizeof(argv_[0])) - 1);
switch_separate_string(mycmd, ' ', argv, (sizeof(argv_) / sizeof(argv_[0])) - 1);
argv = argv_;
@@ -321,10 +318,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
if (!family)
dig->ip4 = 1, dig->ip6 = 2;
if (argv[1] && argv[1][0] == '@')
dnsserver = argv++[1] + 1;
if (!argv[1])
{usage(2);}
@@ -360,7 +353,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
if (!uri || (uri->url_type != url_sip && uri->url_type != url_sips)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: invalid uri\n", string);
exitcode = 1;
continue;
}
@@ -387,7 +379,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
if (!host_is_domain(host)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: invalid host\n", string);
exitcode = 1;
continue;
}
@@ -402,7 +393,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
continue /* resolved a/aaaa */;
stream->write_function(stream, "-ERR: %s: not found\n", string);
exitcode = 1;
}
if (xml) {
+6 -6
View File
@@ -1457,7 +1457,7 @@ switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile)
void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj)
{
sofia_profile_t *profile = (sofia_profile_t *) obj;
switch_memory_pool_t *pool;
//switch_memory_pool_t *pool;
sip_alias_node_t *node;
switch_event_t *s_event;
int use_100rel = !sofia_test_pflag(profile, PFLAG_DISABLE_100REL);
@@ -1717,7 +1717,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
su_home_unref(profile->home);
su_root_destroy(profile->s_root);
pool = profile->pool;
//pool = profile->pool;
sofia_glue_del_profile(profile);
switch_core_hash_destroy(&profile->chat_hash);
@@ -5581,7 +5581,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
{
/* Incoming refer */
sip_from_t const *from;
sip_to_t const *to;
//sip_to_t const *to;
sip_refer_to_t const *refer_to;
private_object_t *tech_pvt = switch_core_session_get_private(session);
char *etmp = NULL, *exten = NULL;
@@ -5604,7 +5604,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
}
from = sip->sip_from;
to = sip->sip_to;
//to = sip->sip_to;
home = su_home_new(sizeof(*home));
switch_assert(home != NULL);
@@ -6374,7 +6374,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
const char *displayname = NULL;
const char *destination_number = NULL;
const char *from_user = NULL, *from_host = NULL;
const char *referred_by_user = NULL, *referred_by_host = NULL;
const char *referred_by_user = NULL;//, *referred_by_host = NULL;
const char *context = NULL;
const char *dialplan = NULL;
char network_ip[80];
@@ -6905,7 +6905,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
if (sip->sip_referred_by) {
referred_by_user = sip->sip_referred_by->b_url->url_user;
referred_by_host = sip->sip_referred_by->b_url->url_host;
//referred_by_host = sip->sip_referred_by->b_url->url_host;
channel_name = url_set_chanvars(session, sip->sip_referred_by->b_url, sip_referred_by);
check_decode(referred_by_user, session);
+8 -22
View File
@@ -2662,9 +2662,7 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
return SWITCH_STATUS_FALSE;
} else {
int ms;
tech_pvt->video_read_frame.rate = tech_pvt->video_rm_rate;
ms = tech_pvt->video_write_codec.implementation->microseconds_per_packet / 1000;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set VIDEO Codec %s %s/%ld %d ms\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate, tech_pvt->video_codec_ms);
tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec;
@@ -2689,7 +2687,6 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int
switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
{
int ms;
switch_status_t status = SWITCH_STATUS_SUCCESS;
int resetting = 0;
@@ -2782,7 +2779,6 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
}
tech_pvt->read_frame.rate = tech_pvt->rm_rate;
ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000;
if (!switch_core_codec_ready(&tech_pvt->read_codec)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
@@ -2865,7 +2861,6 @@ switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, s
switch_status_t sofia_glue_add_crypto(private_object_t *tech_pvt, const char *key_str, switch_rtp_crypto_direction_t direction)
{
unsigned char key[SWITCH_RTP_MAX_CRYPTO_LEN];
int index;
switch_rtp_crypto_key_type_t type;
char *p;
@@ -2874,8 +2869,6 @@ switch_status_t sofia_glue_add_crypto(private_object_t *tech_pvt, const char *ke
goto bad;
}
index = atoi(key_str);
p = strchr(key_str, ' ');
if (p && *p && *(p + 1)) {
@@ -2922,7 +2915,6 @@ switch_status_t sofia_glue_add_crypto(private_object_t *tech_pvt, const char *ke
switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_flag_t myflags)
{
int bw, ms;
const char *err = NULL;
const char *val = NULL;
switch_rtp_flag_t flags;
@@ -2963,9 +2955,6 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
goto end;
}
bw = tech_pvt->read_impl.bits_per_second;
ms = tech_pvt->read_impl.microseconds_per_packet;
if (myflags) {
flags = myflags;
} else if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
@@ -4095,7 +4084,7 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp)
sdp_session_t *sdp;
private_object_t *tech_pvt = switch_core_session_get_private(session);
sdp_attribute_t *attr;
int ptime = 0, dptime = 0, dmaxptime = 0, maxptime = 0;
int ptime = 0, dptime = 0;
if (!(parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
return;
@@ -4116,8 +4105,6 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp)
if (!strcasecmp(attr->a_name, "ptime")) {
dptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime")) {
dmaxptime = atoi(attr->a_value);
}
}
@@ -4125,7 +4112,7 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp)
for (m = sdp->sdp_media; m; m = m->m_next) {
ptime = dptime;
maxptime = dmaxptime;
//maxptime = dmaxptime;
if (m->m_proto == sdp_proto_rtp) {
sdp_rtpmap_t *map;
@@ -4133,7 +4120,7 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp)
if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
ptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) {
maxptime = atoi(attr->a_value);
//maxptime = atoi(attr->a_value);
}
}
@@ -4803,7 +4790,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
} else if (m->m_type == sdp_media_video && m->m_port) {
sdp_rtpmap_t *map;
const char *rm_encoding;
int framerate = 0;
const switch_codec_implementation_t *mimp = NULL;
int vmatch = 0, i;
switch_channel_set_variable(tech_pvt->channel, "video_possible", "true");
@@ -4823,7 +4809,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
for (attr = m->m_attributes; attr; attr = attr->a_next) {
if (!strcasecmp(attr->a_name, "framerate") && attr->a_value) {
framerate = atoi(attr->a_value);
//framerate = atoi(attr->a_value);
}
if (!strcasecmp(attr->a_name, "rtcp") && attr->a_value) {
switch_channel_set_variable(tech_pvt->channel, "sip_remote_video_rtcp_port", attr->a_value);
@@ -6253,7 +6239,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
contact = sofia_glue_get_url_from_contact((char *) o_contact, 1);
if (!zstr(network_ip) && sofia_glue_check_nat(profile, network_ip)) {
char *ptr = NULL;
const char *transport_str = NULL;
//const char *transport_str = NULL;
id = switch_mprintf("sip:%s@%s", user, profile->extsipip);
@@ -6261,7 +6247,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) {
sofia_transport_t transport = sofia_glue_str2transport(ptr);
transport_str = sofia_glue_transport2str(transport);
//transport_str = sofia_glue_transport2str(transport);
switch (transport) {
case SOFIA_TRANSPORT_TCP:
contact_str = profile->tcp_public_contact;
@@ -6469,7 +6455,7 @@ void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str)
char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_nat_parse_t *np)
{
char *contact_str = NULL;
const char *contact_host, *contact_user;
const char *contact_host;//, *contact_user;
sip_contact_t const *contact;
char *port;
const char *display = "\"user\"";
@@ -6497,7 +6483,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sof
port = (char *) contact->m_url->url_port;
contact_host = sip->sip_contact->m_url->url_host;
contact_user = sip->sip_contact->m_url->url_user;
//contact_user = sip->sip_contact->m_url->url_user;
display = contact->m_display;
+6 -17
View File
@@ -208,10 +208,10 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
if (!zstr(remote_ip) && sofia_glue_check_nat(profile, remote_ip)) {
char *ptr = NULL;
const char *transport_str = NULL;
//const char *transport_str = NULL;
if ((ptr = sofia_glue_find_parameter(dst->contact, "transport="))) {
sofia_transport_t transport = sofia_glue_str2transport(ptr);
transport_str = sofia_glue_transport2str(transport);
//transport_str = sofia_glue_transport2str(transport);
switch (transport) {
case SOFIA_TRANSPORT_TCP:
contact_str = profile->tcp_public_contact;
@@ -2059,7 +2059,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
tagi_t tags[])
{
long exp_abs, exp_delta;
long exp_delta;
char exp_delta_str[30] = "";
sip_to_t const *to;
const char *from_user = NULL, *from_host = NULL;
@@ -2080,7 +2080,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
int sent_reply = 0;
sip_contact_t const *contact;
const char *ipv6;
const char *contact_host, *contact_user;
const char *contact_user;
sofia_nat_parse_t np = { { 0 } };
if (!sip) {
@@ -2095,7 +2095,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
return;
}
contact_host = sip->sip_contact->m_url->url_host;
//contact_host = sip->sip_contact->m_url->url_host;
contact_user = sip->sip_contact->m_url->url_user;
tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
@@ -2142,10 +2142,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
}
}
if (exp_delta) {
exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta;
} else {
exp_abs = 0;
if (!exp_delta) {
sub_state = nua_substate_terminated;
}
@@ -2773,9 +2770,7 @@ void sofia_presence_handle_sip_i_message(int status,
sip_to_t const *to = sip->sip_to;
const char *to_user = NULL;
const char *to_host = NULL;
sip_subject_t const *sip_subject = sip->sip_subject;
sip_payload_t *payload = sip->sip_payload;
const char *subject = "n/a";
char *msg = NULL;
if (sip->sip_content_type && sip->sip_content_type->c_subtype) {
@@ -2802,14 +2797,9 @@ void sofia_presence_handle_sip_i_message(int status,
msg = payload->pl_data;
}
if (sip_subject) {
subject = sip_subject->g_value;
}
if (nh) {
char hash_key[512];
private_object_t *tech_pvt;
switch_channel_t *channel;
switch_event_t *event;
char *to_addr;
char *from_addr;
@@ -2840,7 +2830,6 @@ void sofia_presence_handle_sip_i_message(int status,
}
if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT) && (tech_pvt = (private_object_t *) switch_core_hash_find(profile->chat_hash, hash_key))) {
channel = switch_core_session_get_channel(tech_pvt->session);
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url);
-5
View File
@@ -852,7 +852,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
const char *reg_host = profile->reg_db_domain;
const char *sub_host = profile->sub_domain;
char contact_str[1024] = "";
int nat_hack = 0;
uint8_t multi_reg = 0, multi_reg_contact = 0, avoid_multi_reg = 0;
uint8_t stale = 0, forbidden = 0;
auth_res_t auth_res;
@@ -863,7 +862,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
char network_ip[80];
char network_port_c[6];
char url_ip[80];
char *register_gateway = NULL;
int network_port;
const char *reg_desc = "Registered";
const char *call_id = NULL;
@@ -1094,8 +1092,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
avoid_multi_reg = 1;
}
register_gateway = switch_event_get_header(*v_event, "sip-register-gateway");
/* Allow us to force the SIP user to be something specific - needed if
* we - for example - want to be able to ensure that the username a UA can
* be contacted at is the same one that they used for authentication.
@@ -1166,7 +1162,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
reg_desc = "Registered(AUTO-NAT)";
exptime = 30;
}
nat_hack = 1;
} else {
char *p;
switch_copy_string(contact_str, v_contact_str, sizeof(contact_str));