X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=sip.cpp;h=b5d96359b75c632ce091512637350eccd69f0e75;hp=ff8ed890b20807e83101ecf9e39e564fba9cb18a;hb=refs%2Fheads%2Fbackup1;hpb=e52e40a0377216293865fa6051cf3e31bd03f6fa diff --git a/sip.cpp b/sip.cpp index ff8ed89..b5d9635 100644 --- a/sip.cpp +++ b/sip.cpp @@ -2201,6 +2201,7 @@ static void sip_callback(nua_event_t event, int status, char const *phrase, nua_ if ((port->p_type & PORT_CLASS_mISDN_MASK) == PORT_CLASS_SIP) { psip = (class Psip *)port; if (psip->p_s_handle == nh) { + PDEBUG(DEBUG_SIP, "Event found for port %s\n", psip->p_name); break; } } @@ -2210,18 +2211,21 @@ static void sip_callback(nua_event_t event, int status, char const *phrase, nua_ psip = NULL; /* new handle */ - if (!psip && !inst->register_handle) { - switch (event) { - case nua_i_options: + switch (event) { + case nua_i_options: + if (!inst->register_handle) { PDEBUG(DEBUG_SIP, "New options instance\n"); inst->register_handle = nh; - break; - case nua_i_register: + } + break; + case nua_i_register: + if (!inst->register_handle) { PDEBUG(DEBUG_SIP, "New register instance\n"); inst->register_handle = nh; - break; - case nua_i_invite: - { + } + break; + case nua_i_invite: + if (!psip) { char name[64]; struct interface *interface = interface_first; @@ -2238,9 +2242,10 @@ static void sip_callback(nua_event_t event, int status, char const *phrase, nua_ FATAL("Cannot find interface %s.\n", inst->interface_name); if (!(psip = new Psip(PORT_TYPE_SIP_IN, name, NULL, interface))) FATAL("Cannot create Port instance.\n"); - break; - } - default: + } + break; + default: + if (!psip && !inst->register_handle) { PDEBUG(DEBUG_SIP, "Destroying unknown instance\n"); nua_handle_destroy(nh); return;