]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't segfault on notify message with no contact
authorMichael Jerris <mike@jerris.com>
Sun, 3 Jan 2010 21:10:34 +0000 (21:10 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 3 Jan 2010 21:10:34 +0000 (21:10 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16130 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c

index 8d6ae41e8f6b8cb126ed17a5ed16d1e02f26bdb9..a5facf24bef9ade75e0b880b31547dcef032f2d1 100644 (file)
@@ -143,9 +143,12 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
        if (s_event != NULL) {
                switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event-package", sip->sip_event->o_type);
                switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event-id", sip->sip_event->o_id);
+               
+               if (sip->sip_contact && sip->sip_contact->m_url) {
+                       switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s@%s", 
+                                                                       sip->sip_contact->m_url->url_user, sip->sip_contact->m_url->url_host);
+               }
 
-               switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s@%s", 
-                                                               sip->sip_contact->m_url->url_user, sip->sip_contact->m_url->url_host);
                switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", 
                                                                sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host);
                switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from-tag", sip->sip_from->a_tag);