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) {
nua_handle_destroy(nh);
break;
case SUB_STATE_FAILED:
+ gw_sub_ptr->expires = now;
+ gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds;
+ gw_sub_ptr->state = SUB_STATE_FAIL_WAIT;
+ break;
+ case SUB_STATE_FAIL_WAIT:
+ if (!gw_sub_ptr->retry || now >= gw_sub_ptr->retry) {
+ gw_sub_ptr->state = SUB_STATE_UNSUBED;
+ }
+ break;
case SUB_STATE_TRYING:
if (gw_sub_ptr->retry && now >= gw_sub_ptr->retry) {
gw_sub_ptr->state = SUB_STATE_UNSUBED;