فهرست منبع

modules/sca: AoR should not be treated as SCA if there are no subscribers.
(cherry picked from commit a8fb905e8bf27093dcf86866ae946431ed441a41)

Andrew Mortensen 12 سال پیش
والد
کامیت
c9551e55a8
3فایلهای تغییر یافته به همراه21 افزوده شده و 0 حذف شده
  1. 18 0
      modules/sca/sca_appearance.c
  2. 1 0
      modules/sca/sca_appearance.h
  3. 2 0
      modules/sca/sca_call_info.c

+ 18 - 0
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 )

+ 1 - 0
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 );

+ 2 - 0
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 );
 	    }
 	}
     }