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;
}
}
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;
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;