Module: kamailio Branch: master Commit: 474f55c2d85f6d407957210ff777e8c38a102b89 URL: https://github.com/kamailio/kamailio/commit/474f55c2d85f6d407957210ff777e8c3...
Author: Sipwise Development Team support@sipwise.com Committer: Victor Seva linuxmaniac@torreviejawireless.org Date: 2024-09-18T10:10:12+02:00
sca: contact_fallback parameter
---
Modified: src/modules/sca/sca.c Modified: src/modules/sca/sca.h Modified: src/modules/sca/sca_call_info.c
---
Diff: https://github.com/kamailio/kamailio/commit/474f55c2d85f6d407957210ff777e8c3... Patch: https://github.com/kamailio/kamailio/commit/474f55c2d85f6d407957210ff777e8c3...
---
diff --git a/src/modules/sca/sca.c b/src/modules/sca/sca.c index e1e7e0a1c1d..c03df5002a4 100644 --- a/src/modules/sca/sca.c +++ b/src/modules/sca/sca.c @@ -151,6 +151,7 @@ int line_seize_max_expires = 15; int purge_expired_interval = 120; int onhold_bflag = -1; str server_address = STR_NULL; +str contact_fallback = STR_NULL; str from_uri_avp_param = STR_NULL; str to_uri_avp_param = STR_NULL;
@@ -165,6 +166,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}, + {"contact_fallback", PARAM_STR, &contact_fallback}, {"server_address", PARAM_STR, &server_address}, {"from_uri_avp", PARAM_STR, &from_uri_avp_param}, {"to_uri_avp", PARAM_STR, &to_uri_avp_param}, @@ -337,6 +339,10 @@ static int sca_set_config(sca_mod *scam) scam->cfg->server_address = &server_address; }
+ if(contact_fallback.s) { + scam->cfg->contact_fallback = &contact_fallback; + } + if(from_uri_avp_param.s) { if(sca_process_avps(&from_uri_avp_param, &sca->cfg->from_uri_avp, &sca->cfg->from_uri_avp_type) diff --git a/src/modules/sca/sca.h b/src/modules/sca/sca.h index 79fb4984e88..f1f8bf1aef8 100644 --- a/src/modules/sca/sca.h +++ b/src/modules/sca/sca.h @@ -41,6 +41,7 @@ struct _sca_config int purge_expired_interval; int onhold_bflag; str *server_address; + str *contact_fallback; avp_flags_t from_uri_avp_type; avp_name_t from_uri_avp; avp_flags_t to_uri_avp_type; diff --git a/src/modules/sca/sca_call_info.c b/src/modules/sca/sca_call_info.c index d322476ab0b..b15a7251746 100644 --- a/src/modules/sca/sca_call_info.c +++ b/src/modules/sca/sca_call_info.c @@ -1988,7 +1988,7 @@ int sca_call_info_update( rc = -1; goto done; } - } else if(rc < 0) { + } else if(rc < 0 && !sca->cfg->contact_fallback) { LM_ERR("Bad Contact\n"); goto done; } @@ -2037,6 +2037,13 @@ int sca_call_info_update( LM_DBG("to_aor[%.*s] from_aor[%.*s]\n", STR_FMT(&to_aor), STR_FMT(&from_aor));
+ if(contact_uri.s == NULL && sca->cfg->contact_fallback) { + contact_uri.s = sca->cfg->contact_fallback->s; + contact_uri.len = sca->cfg->contact_fallback->len; + LM_DBG("No Contact header, using default owner[%.*s]\n", + STR_FMT(&contact_uri)); + } + // early check to see if we're dealing with any SCA endpoints if(sca_uri_is_shared_appearance(sca, &from_aor)) { if((update_mask & SCA_CALL_INFO_SHARED_CALLER)) {