Module: sip-router
Branch: master
Commit: ba5c2f973cafcb1d871337ffefb8fa95f5463eee
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ba5c2f9…
Author: Andrew Mortensen <admorten(a)isc.upenn.edu>
Committer: Andrew Mortensen <admorten(a)isc.upenn.edu>
Date: Mon Jan 27 12:01:19 2014 -0500
modules/sca: optionally update call-info state for only caller or callee.
- sca_call_info_update can now take an int argument (1=caller, 2=callee)
limiting call-info state update to only that leg's AoR.
---
modules/sca/sca.c | 2 ++
modules/sca/sca_call_info.c | 32 ++++++++++++++++++++++++++++++--
modules/sca/sca_call_info.h | 2 ++
3 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/modules/sca/sca.c b/modules/sca/sca.c
index f196c27..ee1425d 100644
--- a/modules/sca/sca.c
+++ b/modules/sca/sca.c
@@ -59,6 +59,8 @@ static cmd_export_t cmds[] = {
{ "sca_handle_subscribe", sca_handle_subscribe, 0, NULL, REQUEST_ROUTE },
{ "sca_call_info_update", sca_call_info_update, 0, NULL,
REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE },
+ { "sca_call_info_update", sca_call_info_update, 1, fixup_var_int_1,
+ REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE },
{ NULL, NULL, -1, 0, 0 },
};
diff --git a/modules/sca/sca_call_info.c b/modules/sca/sca_call_info.c
index 1e5bbfd..6fa933f 100644
--- a/modules/sca/sca_call_info.c
+++ b/modules/sca/sca_call_info.c
@@ -1885,6 +1885,7 @@ sca_call_info_update( sip_msg_t *msg, char *p1, char *p2 )
int i;
int method;
int rc = -1;
+ int update_mask = SCA_CALL_INFO_SHARED_BOTH;
method = sca_get_msg_method( msg );
@@ -1905,6 +1906,29 @@ sca_call_info_update( sip_msg_t *msg, char *p1, char *p2 )
return( -1 );
}
+ if ( p1 != NULL ) {
+ if ( get_int_fparam( &update_mask, msg, (fparam_t *)p1 ) < 0 ) {
+ LM_ERR( "sca_call_info_update: argument 1: bad value "
+ "(integer expected)" );
+ return( -1 );
+ }
+
+ switch ( update_mask ) {
+ case SCA_CALL_INFO_SHARED_NONE:
+ update_mask = SCA_CALL_INFO_SHARED_BOTH;
+ break;
+
+ case SCA_CALL_INFO_SHARED_CALLER:
+ case SCA_CALL_INFO_SHARED_CALLEE:
+ break;
+
+ default:
+ LM_ERR( "sca_call_info_update: argument 1: invalid value "
+ "(0, 1 or 2 expected)" );
+ return( -1 );
+ }
+ }
+
memset( &call_info, 0, sizeof( sca_call_info ));
call_info_hdr = sca_call_info_header_find( msg->headers );
if ( !SCA_HEADER_EMPTY( call_info_hdr )) {
@@ -1967,10 +1991,14 @@ sca_call_info_update( sip_msg_t *msg, char *p1, char *p2 )
/* early check to see if we're dealing with any SCA endpoints */
if ( sca_uri_is_shared_appearance( sca, &from_aor )) {
- call_info.ua_shared |= SCA_CALL_INFO_SHARED_CALLER;
+ if (( update_mask & SCA_CALL_INFO_SHARED_CALLER )) {
+ call_info.ua_shared |= SCA_CALL_INFO_SHARED_CALLER;
+ }
}
if ( sca_uri_is_shared_appearance( sca, &to_aor )) {
- call_info.ua_shared |= SCA_CALL_INFO_SHARED_CALLEE;
+ if (( update_mask & SCA_CALL_INFO_SHARED_CALLEE )) {
+ call_info.ua_shared |= SCA_CALL_INFO_SHARED_CALLEE;
+ }
}
if ( call_info_hdr == NULL ) {
diff --git a/modules/sca/sca_call_info.h b/modules/sca/sca_call_info.h
index 6a9f1ea..5e9dd0d 100644
--- a/modules/sca/sca_call_info.h
+++ b/modules/sca/sca_call_info.h
@@ -35,6 +35,8 @@ enum {
SCA_CALL_INFO_SHARED_CALLER = (1 << 0),
SCA_CALL_INFO_SHARED_CALLEE = (1 << 1),
};
+#define SCA_CALL_INFO_SHARED_BOTH \
+ (SCA_CALL_INFO_SHARED_CALLER | SCA_CALL_INFO_SHARED_CALLEE)
struct _sca_call_info {
str sca_uri;