Parcourir la source

sca: fix private hold handling

- private hold call-info was being ignored in hold reINVITEs, causing
  inaccurate "active" notifications to go to subscribers.
Andrew Mortensen il y a 12 ans
Parent
commit
81b5473f5a
2 fichiers modifiés avec 9 ajouts et 1 suppressions
  1. 3 0
      modules/sca/sca_appearance.h
  2. 6 1
      modules/sca/sca_call_info.c

+ 3 - 0
modules/sca/sca_appearance.h

@@ -38,6 +38,9 @@ enum {
     SCA_APPEARANCE_STATE_HELD_PRIVATE,
     SCA_APPEARANCE_STATE_UNKNOWN = 0xff,
 }; 
+#define sca_appearance_is_held( app1 ) \
+	((app1) && ((app1)->state == SCA_APPEARANCE_STATE_HELD || \
+		   (app1)->state == SCA_APPEARANCE_STATE_HELD_PRIVATE))
 
 enum {
     SCA_APPEARANCE_FLAG_DEFAULT = 0,

+ 6 - 1
modules/sca/sca_call_info.c

@@ -982,6 +982,11 @@ sca_call_info_invite_request_handler( sip_msg_t *msg, sca_call_info *call_info,
 
     if ( sca_call_is_held( msg )) {
 	state = SCA_APPEARANCE_STATE_HELD;
+	if ( call_info->state == SCA_APPEARANCE_STATE_HELD_PRIVATE ) {
+	    state = SCA_APPEARANCE_STATE_HELD_PRIVATE;
+	} else {
+	    state = SCA_APPEARANCE_STATE_HELD;
+	}
     } else if ( !SCA_STR_EMPTY( &to->tag_value )) {
 	/* this is a reINVITE from an SCA line that put the call on hold */
 	state = SCA_APPEARANCE_STATE_ACTIVE;
@@ -1237,7 +1242,7 @@ sca_call_info_invite_reply_200_handler( sip_msg_t *msg,
 	goto done;
     }
 
-    if ( app->state != SCA_APPEARANCE_STATE_HELD ) {
+    if ( !sca_appearance_is_held( app )) {
 	state = SCA_APPEARANCE_STATE_ACTIVE;
     }
     /* if a Call-Info header is present, app-index goes to Contact */