Un-Subscribing on 481 Reply
Describe the bug I recently noticed that Freeswitch continues sending NOTIFY messages even after receiving a 481 from my proxy after not being able to deliver the messages to the UA. This seems to happen when the UA disconnects from the Internet briefly and registers again before the previous subscription expires.
Below is the code I found in sofia.c that seems to handle the 481 response.
if (status == 481 && sip && !sip->sip_retry_after && sip->sip_call_id && (!sofia_private || !sofia_private->is_call)) {
char *sql;
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);
}
Assuming that the variable sofia_private->is_call evaluates to true when NOTIFY messages are sent during a call, it seems to curtail the removal of the SUBSCRIPTION even after receiving a 481 from the proxy. If there isn't a reason why it matters during an active call, should the check for an active call be removed?
To Reproduce During a call (INVITE) to an extension that is subscribed to presence, reply to the NOTIFY message with 481.
Expected behavior The subscription should be removed from Freeswitch.
Package version or git hash Version 1.10.5-release+git~20200818T185121Z~25569c1631~64bit (git 25569c1 2020-08-18 18:51:21Z 64bit)
bump