Module: sip-router Branch: admorten/sca Commit: cf5f7437ba64c5b1277a9f39947afa471fe041ee URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cf5f7437...
Author: Andrew Mortensen admorten@isc.upenn.edu Committer: Andrew Mortensen admorten@isc.upenn.edu Date: Tue Aug 20 15:54:17 2013 -0400
modules/sca: AoR should not be treated as SCA if there are no subscribers.
---
modules/sca/sca_appearance.c | 18 ++++++++++++++++++ modules/sca/sca_appearance.h | 1 + modules/sca/sca_call_info.c | 2 ++ 3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/modules/sca/sca_appearance.c b/modules/sca/sca_appearance.c index ca26735..ca50e9e 100644 --- a/modules/sca/sca_appearance.c +++ b/modules/sca/sca_appearance.c @@ -386,6 +386,24 @@ done: return( rc ); }
+ int +sca_appearance_unregister( sca_mod *scam, str *aor ) +{ + int rc = 0; + + assert( scam != NULL ); + assert( aor != NULL ); + + if ( sca_uri_is_shared_appearance( scam, aor )) { + if (( rc = sca_hash_table_kv_delete( scam->appearances, aor )) == 0 ) { + rc = 1; + LM_INFO( "unregistered SCA AoR %.*s", STR_FMT( aor )); + } + } + + return( rc ); +} + sca_appearance * sca_appearance_seize_index_unsafe( sca_mod *scam, str *aor, str *owner_uri, int app_idx, int slot_idx, int *seize_error ) diff --git a/modules/sca/sca_appearance.h b/modules/sca/sca_appearance.h index 9fa9a10..7ad3d38 100644 --- a/modules/sca/sca_appearance.h +++ b/modules/sca/sca_appearance.h @@ -155,6 +155,7 @@ sca_appearance *sca_appearance_for_tags_unsafe( sca_mod *, str *, str *, str *, str *, int );
int sca_appearance_register( sca_mod *, str * ); +int sca_appearance_unregister( sca_mod *, str * ); void sca_appearance_list_insert_appearance( sca_appearance_list *, sca_appearance * ); sca_appearance *sca_appearance_list_unlink_index( sca_appearance_list *, int ); diff --git a/modules/sca/sca_call_info.c b/modules/sca/sca_call_info.c index 5e758b8..2d36eae 100644 --- a/modules/sca/sca_call_info.c +++ b/modules/sca/sca_call_info.c @@ -1979,12 +1979,14 @@ sca_call_info_update( sip_msg_t *msg, char *p1, char *p2 ) if ( !sca_subscription_aor_has_subscribers( SCA_EVENT_TYPE_CALL_INFO, &from_aor )) { call_info.ua_shared &= ~SCA_CALL_INFO_SHARED_CALLER; + sca_appearance_unregister( sca, &from_aor ); } } else if ( SCA_CALL_INFO_IS_SHARED_CALLEE( &call_info ) && msg->first_line.type == SIP_REPLY ) { if ( !sca_subscription_aor_has_subscribers( SCA_EVENT_TYPE_CALL_INFO, &to_aor )) { call_info.ua_shared &= ~SCA_CALL_INFO_SHARED_CALLEE; + sca_appearance_unregister( sca, &to_aor ); } } }