FS-3386 Try this revision please

This commit is contained in:
Anthony Minessale
2011-07-14 00:17:05 -05:00
parent d2f76ca482
commit 2932c1fa17
7 changed files with 83 additions and 76 deletions
+7 -12
View File
@@ -54,8 +54,9 @@ static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach)
NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
if (attach) {
if (!gateway_ptr->sofia_private) {
gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
switch_assert(gateway_ptr->sofia_private);
if (!(gateway_ptr->sofia_private = su_alloc(gateway_ptr->nh->nh_home, sizeof(*gateway_ptr->sofia_private)))) {
abort();
}
}
memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
@@ -186,9 +187,10 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name);
gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
switch_assert(gateway_ptr->sofia_private);
if (!(gateway_ptr->sofia_private = su_alloc(gateway_ptr->sub_nh->nh_home, sizeof(*gateway_ptr->sofia_private)))) {
abort();
}
memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
gateway_ptr->sofia_private->gateway = gateway_ptr;
@@ -290,7 +292,6 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
if (gateway_ptr->ping && !gateway_ptr->pinging && (now >= gateway_ptr->ping && (ostate == REG_STATE_NOREG || ostate == REG_STATE_REGED)) &&
!gateway_ptr->deleted) {
nua_handle_t *nh = nua_handle(profile->nua, NULL, NUTAG_URL(gateway_ptr->register_url), TAG_END());
sofia_private_t *pvt;
register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy);
@@ -301,13 +302,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
switch_safe_free(register_host);
pvt = malloc(sizeof(*pvt));
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);
nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
gateway_ptr->pinging = 1;
nua_options(nh,