Author: anthm Date: Mon May 12 12:18:38 2008 New Revision: 8365 Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Log: fix sofia ping Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Mon May 12 12:18:38 2008 @@ -75,7 +75,6 @@ sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", sip->sip_call_id->i_id); switch_assert(sql != NULL); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); - nua_handle_destroy(nh); } } @@ -347,14 +346,18 @@ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Destroy handle [%s]\n", nua_event_name(event)); if (sofia_private) { nua_handle_bind(nh, NULL); - sofia_private->destroy_me = 1; } nua_handle_destroy(nh); + nh = NULL; } break; } if (sofia_private && sofia_private->destroy_me) { + if (nh) { + nua_handle_bind(nh, NULL); + } + sofia_private->destroy_me = 12; free(sofia_private); sofia_private = NULL; } @@ -1520,6 +1523,7 @@ if (sofia_private && !switch_strlen_zero(sofia_private->gateway_name)) { gateway = sofia_reg_find_gateway(sofia_private->gateway_name); + sofia_private->destroy_me = 1; } if (gateway) { Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Mon May 12 12:18:38 2008 @@ -88,7 +88,6 @@ switch_assert(pvt); memset(pvt, 0, sizeof(*pvt)); pvt->destroy_nh = 1; - pvt->destroy_me = 1; switch_copy_string(pvt->gateway_name, gateway_ptr->name, sizeof(pvt->gateway_name)); nua_handle_bind(nh, pvt);