static void actual_sofia_presence_mwi_event_handler(switch_event_t *event)
{
- char *account, *dup_account, *yn, *host, *user;
+ char *account, *dup_account, *yn, *host = NULL, *user;
char *sql;
sofia_profile_t *profile = NULL;
switch_stream_handle_t stream = { 0 };
dup_account = strdup(account);
- switch_assert(dup_account != NULL);
switch_split_user_domain(dup_account, &user, &host);
+ switch_assert(host != NULL);
if ((pname = switch_event_get_header(event, "sofia-profile"))) {
}
if (!profile) {
- if (!host || !(profile = sofia_glue_find_profile(host))) {
+ if (!(profile = sofia_glue_find_profile(host))) {
char *sql;
char buf[512] = "";
switch_console_callback_match_t *matches;
if (np.is_nat) {
char params[128] = "";
- if (contact->m_url->url_params) {
+ if (contact && contact->m_url->url_params) {
switch_snprintf(params, sizeof(params), ";%s", contact->m_url->url_params);
}
ipv6 = strchr(np.network_ip, ':');
if (sip->sip_via) {
transport = sofia_glue_via2transport(sip->sip_via);
- } else {
+ } else if (contact){
transport = sofia_glue_url2transport(contact->m_url);
+ } else {
+ transport = SOFIA_TRANSPORT_UNKNOWN;
}
if (transport == SOFIA_TRANSPORT_TCP) {
{
url_t *to = sip->sip_to->a_url;
url_t *from = sip->sip_from->a_url;
- switch_snprintf(hash_key, len, "%s%s%s", from->url_user, from->url_host, to->url_user);
+ switch_snprintf(hash_key, len, "%s%s%s", (from && from->url_user) ? from->url_user : "", (from && from->url_host) ? from->url_host : "", (to && to->url_user) ? to->url_user : "");
}
void sofia_presence_handle_sip_i_message(int status,