[sr-dev] git:master: sca: reject out-of-dialog attempts to seize privately held call .

Andrew Mortensen admorten at isc.upenn.edu
Fri Mar 8 04:58:26 CET 2013


Module: sip-router
Branch: master
Commit: e565748048d7a6b6fda0a28959e092380c5bc26a
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e565748048d7a6b6fda0a28959e092380c5bc26a

Author: Andrew Mortensen <admorten at isc.upenn.edu>
Committer: Andrew Mortensen <admorten at isc.upenn.edu>
Date:   Sun Mar  3 17:00:44 2013 -0500

sca: reject out-of-dialog attempts to seize privately held call.

- per spec, reject with 403 Forbidden.

---

 modules/sca/sca_call_info.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/modules/sca/sca_call_info.c b/modules/sca/sca_call_info.c
index 1a360ca..baea8bd 100644
--- a/modules/sca/sca_call_info.c
+++ b/modules/sca/sca_call_info.c
@@ -31,6 +31,7 @@
 #include "sca_dialog.h"
 #include "sca_event.h"
 #include "sca_notify.h"
+#include "sca_reply.h"
 #include "sca_subscribe.h"
 #include "sca_util.h"
 
@@ -564,6 +565,19 @@ sca_call_info_seize_held_call( sip_msg_t *msg, sca_call_info *call_info,
 	goto done;
     }
 
+    if ( app->state == SCA_APPEARANCE_STATE_HELD_PRIVATE ) {
+	/*
+	 * spec calls for "403 Forbidden" when non-owner tries to
+	 * seize a privately held call. if we get here, there's no
+	 * to-tag in the INVITE, meaning this isn't a reINVITE
+	 * from the owner to take the call off private hold.
+	 */
+	SCA_REPLY_ERROR( sca, 403, "Forbidden - private call", msg );
+
+	/* rc bubbles up to script. 0 tells script to stop processing. */
+	rc = 0;
+	goto done;
+    }
     
     LM_DBG( "sca_call_info_seize_held_call: seizing %.*s index %d, callee %.*s",
 	    STR_FMT( from_aor ), app->index, STR_FMT( &app->callee ));
@@ -975,10 +989,12 @@ sca_call_info_invite_request_handler( sip_msg_t *msg, sca_call_info *call_info,
 					    from, to, from_aor, to_aor )) {
 	rc = sca_call_info_seize_held_call( msg, call_info, from, to,
 					   from_aor, to_aor, contact_uri );
+	if ( rc <= 0 ) {
+	    goto done;
+	}
     }
     /* otherwise, this is an initial INVITE */
 
-
     dialog.id.s = dlg_buf;
     if ( sca_dialog_build_from_tags( &dialog, sizeof( dlg_buf ),
 	    &msg->callid->body, &from->tag_value, &to->tag_value ) < 0 ) {




More information about the sr-dev mailing list