Module: sip-router
Branch: admorten/sca
Commit: d18a51a4ddec40e20cec2d28a1c2a42352396733
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d18a51a…
Author: Andrew Mortensen <admorten(a)isc.upenn.edu>
Committer: Andrew Mortensen <admorten(a)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 de79f38..0195b0e 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 ));
@@ -980,10 +994,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 ) {