From 33ce5e05e67f04278256a5cf5e8563c6062e8e61 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Wed, 5 Oct 2016 09:57:27 +0200 Subject: [PATCH] TT#2387 sca: new "server_address" parameter Change-Id: Ia64461f306e13dcfc72db0221811d6b10d8ad5f4 --- debian/patches/series | 1 + .../sca-add-server_address-parameter.patch | 87 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 debian/patches/sipwise/sca-add-server_address-parameter.patch diff --git a/debian/patches/series b/debian/patches/series index a8564a91f..2d65aa8c1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -27,4 +27,5 @@ sipwise/sca-sca_call_info_update-add-to-from-optional-parame.patch sipwise/sca-sca_handle_subscribe-honor-the-ru-value.patch sipwise/sca-fix-core-when-HDR_CSEQ-not-parsed.patch sipwise/sca-sca_call_info_update-fix-param-calls.patch +sipwise/sca-add-server_address-parameter.patch ## diff --git a/debian/patches/sipwise/sca-add-server_address-parameter.patch b/debian/patches/sipwise/sca-add-server_address-parameter.patch new file mode 100644 index 000000000..b54903ce3 --- /dev/null +++ b/debian/patches/sipwise/sca-add-server_address-parameter.patch @@ -0,0 +1,87 @@ +From: Victor Seva +Date: Mon, 3 Oct 2016 12:19:51 +0200 +Subject: sca: add "server_address" parameter + +* server address (sip:[:port]) which will become the value of + Contact header filed for NOTIFY messages. + +Change-Id: I8f0a93f180cafc4f014f621a413fcb5f6e672f46 +--- + modules/sca/sca.c | 5 +++++ + modules/sca/sca.h | 1 + + modules/sca/sca_notify.c | 14 +++++++++++--- + 3 files changed, 17 insertions(+), 3 deletions(-) + +diff --git a/modules/sca/sca.c b/modules/sca/sca.c +index f46fb1b..9dd0143 100644 +--- a/modules/sca/sca.c ++++ b/modules/sca/sca.c +@@ -111,6 +111,7 @@ int call_info_max_expires = 3600; + int line_seize_max_expires = 15; + int purge_expired_interval = 120; + int onhold_bflag = -1; ++str server_address = STR_NULL; + + static param_export_t params[] = { + { "outbound_proxy", PARAM_STR, &outbound_proxy }, +@@ -123,6 +124,7 @@ static param_export_t params[] = { + { "line_seize_max_expires", INT_PARAM, &line_seize_max_expires }, + { "purge_expired_interval", INT_PARAM, &purge_expired_interval }, + {"onhold_bflag", INT_PARAM, &onhold_bflag}, ++ {"server_address", PARAM_STR, &server_address}, + { NULL, 0, NULL }, + }; + +@@ -263,6 +265,9 @@ sca_set_config( sca_mod *scam ) + return (-1); + } + scam->cfg->onhold_bflag = onhold_bflag; ++ if (server_address.s) { ++ scam->cfg->server_address = &server_address; ++ } + + return( 0 ); + } +diff --git a/modules/sca/sca.h b/modules/sca/sca.h +index f5dd225..abcbe56 100644 +--- a/modules/sca/sca.h ++++ b/modules/sca/sca.h +@@ -38,6 +38,7 @@ struct _sca_config { + int line_seize_max_expires; + int purge_expired_interval; + int onhold_bflag; ++ str *server_address; + }; + typedef struct _sca_config sca_config; + +diff --git a/modules/sca/sca_notify.c b/modules/sca/sca_notify.c +index e8cbdba..89d8bb4 100644 +--- a/modules/sca/sca_notify.c ++++ b/modules/sca/sca_notify.c +@@ -189,15 +189,23 @@ sca_notify_append_contact_header( sca_subscription *sub, + char *hdrbuf, int maxlen ) + { + int len = strlen( "Contact: " ); ++ str *orig = NULL; + +- if ( len + sub->target_aor.len + strlen( CRLF ) >= maxlen ) { ++ if (sca->cfg->server_address != NULL) { ++ orig = sca->cfg->server_address; ++ } ++ else { ++ orig = &sub->target_aor; ++ } ++ ++ if (len + orig->len + strlen(CRLF) >= maxlen) { + LM_ERR( "Cannot append Contact header: buffer too small" ); + return( -1 ); + } + + memcpy( hdrbuf, "Contact: ", len ); +- memcpy( hdrbuf + len, sub->target_aor.s, sub->target_aor.len ); +- len += sub->target_aor.len; ++ memcpy(hdrbuf + len, orig->s, orig->len); ++ len += orig->len; + memcpy( hdrbuf + len, CRLF, strlen( CRLF )); + len += strlen( CRLF ); +