mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-16 00:04:13 +00:00
FS-5987 pushing the patch now since no matter what its better than before
This commit is contained in:
1 parent
d2f8cf40bc
commit
ef730b75aa
4 files changed
+128
-70
No files matched your search
@@ -4285,6 +4285,7 @@ void sofia_presence_handle_sip_r_subscribe(int status,
|
||||
{
|
||||
sip_event_t const *o = NULL;
|
||||
sofia_gateway_subscription_t *gw_sub_ptr;
|
||||
sofia_gateway_t *gateway = NULL;
|
||||
|
||||
if (!sip) {
|
||||
return;
|
||||
@@ -4297,18 +4298,25 @@ void sofia_presence_handle_sip_r_subscribe(int status,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sofia_private || !sofia_private->gateway) {
|
||||
if (!sofia_private || zstr(sofia_private->gateway_name)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find the subscription if one exists */
|
||||
if (!(gw_sub_ptr = sofia_find_gateway_subscription(sofia_private->gateway, o->o_type))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find gateway subscription. Gateway: %s. Subscription Event: %s\n",
|
||||
sofia_private->gateway->name, o->o_type);
|
||||
|
||||
if (!(gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Find the subscription if one exists */
|
||||
if (!(gw_sub_ptr = sofia_find_gateway_subscription(gateway, o->o_type))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find gateway subscription. Gateway: %s. Subscription Event: %s\n",
|
||||
gateway->name, o->o_type);
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Update the subscription status for the subscription */
|
||||
switch (status) {
|
||||
case 200:
|
||||
@@ -4326,19 +4334,22 @@ void sofia_presence_handle_sip_r_subscribe(int status,
|
||||
default:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "status (%d) != 200, updated state to SUB_STATE_FAILED.\n", status);
|
||||
gw_sub_ptr->state = SUB_STATE_FAILED;
|
||||
gw_sub_ptr->expires = switch_epoch_time_now(NULL);
|
||||
gw_sub_ptr->retry = switch_epoch_time_now(NULL);
|
||||
|
||||
if (sofia_private) {
|
||||
if (gw_sub_ptr->nh) {
|
||||
nua_handle_bind(gw_sub_ptr->nh, NULL);
|
||||
nua_handle_destroy(gw_sub_ptr->nh);
|
||||
gw_sub_ptr->nh = NULL;
|
||||
}
|
||||
} else {
|
||||
if (!sofia_private) {
|
||||
nua_handle_destroy(nh);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
if (gateway) {
|
||||
sofia_reg_release_gateway(gateway);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user