Module: kamailio Branch: 6.0 Commit: a68d952de5d6a5d91202176877730d53f9c2c580 URL: https://github.com/kamailio/kamailio/commit/a68d952de5d6a5d91202176877730d53f9c2c580
Author: Lyubomir Yatanski <lyubomir.yatan...@flolive.net> Committer: Henning Westerholt <h...@gilawa.com> Date: 2025-04-11T12:49:08Z ims_registrar_scscf: fix reg_fetch_contacts call The implementation of reg_fetch_contacts was hard-coded to empty result. The fix: - adds iteration over contacts and - adds impi to the ulc variable - improve documentation in the documentation $ulc variable is referred with misleading name cleanup the $imssulc mentions to avoid confusion (cherry picked from commit 9caf655c51d5a846fa944bb866e3abadeb8b799c) --- Modified: src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml Modified: src/modules/ims_registrar_scscf/regpv.c --- Diff: https://github.com/kamailio/kamailio/commit/a68d952de5d6a5d91202176877730d53f9c2c580.diff Patch: https://github.com/kamailio/kamailio/commit/a68d952de5d6a5d91202176877730d53f9c2c580.patch --- diff --git a/src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml b/src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml index afea49ee318..5df8c2f554e 100644 --- a/src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml +++ b/src/modules/ims_registrar_scscf/doc/ims_registrar_scscf_admin.xml @@ -744,7 +744,7 @@ switch ($retcode) { profile)</function></title> <para>The function fetches the contacts for 'uri' from table 'domain' to - pseudo-variable $imssulc(profile) [imssulc = ims scscf ulc].</para> + pseudo-variable $ulc(profile) [ulc = ims scscf ulc].</para> <para>Meaning of the parameters is as follows:</para> @@ -761,7 +761,7 @@ switch ($retcode) { </listitem> <listitem> - <para><emphasis>profile</emphasis> - Name of $imssulc + <para><emphasis>profile</emphasis> - Name of $ulc pseudo-variable profile that will store the fetched contacts. It is a static string.</para> </listitem> @@ -793,7 +793,7 @@ reg_fetch_contacts("location", "sip:u...@kamailio.org", "caller"); <itemizedlist> <listitem> - <para><emphasis>profile</emphasis> - Name of $imssulc + <para><emphasis>profile</emphasis> - Name of $ulc pseudo-variable profile that stores the contacts. It is a static string.</para> </listitem> diff --git a/src/modules/ims_registrar_scscf/regpv.c b/src/modules/ims_registrar_scscf/regpv.c index 9ef1da8f2be..236406951c0 100644 --- a/src/modules/ims_registrar_scscf/regpv.c +++ b/src/modules/ims_registrar_scscf/regpv.c @@ -45,6 +45,7 @@ typedef struct _regpv_profile str pname; str domain; str aor; + str impi; int flags; unsigned int aorhash; int nrc; @@ -121,6 +122,11 @@ static void regpv_free_profile(regpv_profile_t *rpp) rpp->aor.s = 0; rpp->aor.len = 0; } + if(rpp->impi.s != NULL) { + pkg_free(rpp->impi.s); + rpp->impi.s = 0; + rpp->impi.len = 0; + } rpp->flags = 0; rpp->aorhash = 0; @@ -245,6 +251,9 @@ int pv_get_ulc(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) case 17: /* count */ return pv_get_sintval(msg, param, res, rpp->nrc); break; + case 18: /* impi */ + return pv_get_strval(msg, param, res, &rpp->impi); + break; } return pv_get_null(msg, param, res); @@ -323,6 +332,8 @@ int pv_parse_ulc_name(pv_spec_p sp, str *in) rp->attr = 4; else if(strncmp(pa.s, "cseq", 4) == 0) rp->attr = 9; + else if(strncmp(pa.s, "impi", 4) == 0) + rp->attr = 18; else goto error; break; @@ -437,10 +448,18 @@ int pv_fetch_contacts( if(res != 0) { LM_DBG("'%.*s' Not found in usrloc\n", aor.len, ZSW(aor.s)); ul.unlock_udomain((udomain_t *)table, &aor); - return -1; + goto error; + } + + rpp->impi.s = (char *)pkg_malloc(r->private_identity.len * sizeof(char)); + if(rpp->impi.s == NULL) { + LM_ERR("no mem for impi\n"); + goto error; } + memcpy(rpp->impi.s, r->private_identity.s, r->private_identity.len); + rpp->impi.len = r->private_identity.len; - ptr = 0; //r->contacts;TODO + ptr = r->linked_contacts.head ? r->linked_contacts.head->contact : NULL; ptr0 = NULL; n = 0; while(ptr) { @@ -455,8 +474,8 @@ int pv_fetch_contacts( goto error; } memcpy(c0, ptr, ilen); - //c0->domain = {0,0};//NULL;TODO - //c0->aor = {0,0};//NULL; + c0->domain = (str){NULL, 0}; + c0->aor = (str){NULL, 0}; c0->next = NULL; c0->prev = NULL; _______________________________________________ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!