Module: sip-router Branch: admorten/sca Commit: d70b1119cf9fabf7de24ec981580f527b8f0bb79 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d70b1119...
Author: Andrew Mortensen admorten@isc.upenn.edu Committer: Andrew Mortensen admorten@isc.upenn.edu Date: Mon Jul 22 00:37:32 2013 -0400
modules/sca: Clear stale line-seize appearances via timer.
Some badly behaved/buggy UAs don't know when to say when.
---
modules/sca/sca_appearance.c | 20 +++++++++++++++----- modules/sca/sca_appearance.h | 8 +++++++- 2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/modules/sca/sca_appearance.c b/modules/sca/sca_appearance.c index 22d8413..ca26735 100644 --- a/modules/sca/sca_appearance.c +++ b/modules/sca/sca_appearance.c @@ -1283,7 +1283,7 @@ sca_appearance_purge_stale( unsigned int ticks, void *param ) struct notify_list *notify_list = NULL, *tmp_nl; int i; int unlinked; - time_t now; + time_t now, ttl;
LM_INFO( "SCA: purging stale appearances" );
@@ -1308,11 +1308,21 @@ sca_appearance_purge_stale( unsigned int ticks, void *param ) cur_app = tmp_app ) { tmp_app = &(*cur_app)->next;
- if ((*cur_app)->state != SCA_APPEARANCE_STATE_ACTIVE_PENDING ) { - continue; + switch ((*cur_app)->state ) { + case SCA_APPEARANCE_STATE_ACTIVE_PENDING: + ttl = SCA_APPEARANCE_STATE_PENDING_TTL; + break; + + case SCA_APPEARANCE_STATE_SEIZED: + ttl = SCA_APPEARANCE_STATE_SEIZED_TTL; + break; + + default: + /* XXX for now just skip other appearances */ + ttl = now + 60; + break; } - if (( now - (*cur_app)->times.mtime ) < - SCA_APPEARANCE_STATE_PENDING_TTL ) { + if (( now - (*cur_app)->times.mtime ) < ttl ) { continue; }
diff --git a/modules/sca/sca_appearance.h b/modules/sca/sca_appearance.h index 74d6b39..9fa9a10 100644 --- a/modules/sca/sca_appearance.h +++ b/modules/sca/sca_appearance.h @@ -65,7 +65,13 @@ enum { * ACK. on receipt of the caller's ACK, we promote * the SCA callee's state to active. */ -#define SCA_APPEARANCE_STATE_PENDING_TTL 30 +enum { + /* Polycoms aggressively resubscribe line-seizes, give them time */ + SCA_APPEARANCE_STATE_SEIZED_TTL = 120, + + /* enough time to allow retransmissions (~32s) */ + SCA_APPEARANCE_STATE_PENDING_TTL = 35, +};
extern const str SCA_APPEARANCE_INDEX_STR; extern const str SCA_APPEARANCE_STATE_STR;