<p></p>
<p dir="auto">In my opinion, it does not look right. The kamailio.cfg wrapper function should call the kemi function, not the other way around.</p>
<p dir="auto">If it is not an out put script variable, then the parameter should not be provided as kamailio.cfg pseudo-variable name, but as corresponding value. Practically, the example above with:</p>
<pre class="notranslate"><code class="notranslate">KSR.carrierroute.cr_user_carrier("$fU", "$fd",  ...
</code></pre>
<p dir="auto">Should be:</p>
<pre class="notranslate"><code class="notranslate">KSR.carrierroute.cr_user_carrier(KSR.kx.get_fuser(), KSR.kx.get_fhost(), ...)
</code></pre>
<p dir="auto">Also, looking a bit at the code of the commit, for example:</p>
<pre class="notranslate"><code class="notranslate">int ki_cr_user_carrier(struct sip_msg * _msg, str *_user,
                str *_domain, str *_dstavp) {

        // native api already checks if any of required argument is null
        // so this is not strictly necessary.
        if (!_msg || !_user || !_domain || !_dstavp) {
                LM_ERR("missing a required parameter\n");
                return -1;
        };

        return w_cr_load_user_carrier(_msg, _user->s, _domain->s, _dstavp->s);
}
</code></pre>
<p dir="auto">The content pointed by <code class="notranslate">_user->s</code> is <code class="notranslate">"$fU"</code> (considering the example given in the comment above), and inside <code class="notranslate">w_cr_load_user_carrier()</code>:</p>
<pre class="notranslate"><code class="notranslate">int w_cr_load_user_carrier(struct sip_msg * _msg, char *_user, char *_domain, char *_dstavp) {
        gparam_t *pv_user, *pv_domain, *pv_dstavp;

        if (_user == NULL) {
                LM_ERR("cannot get the user parameter\n");
                return -1;
        } else {
                pv_user = (gparam_t*)_user;
                if (cr_load_user_carrier_fixup((void**)&pv_user, 1) != 0) {
                        LM_ERR("cannot parse the user parameter\n");
                        return -1;
                }
        }
...
</code></pre>
<p dir="auto">It is doing fixup (a little bit odd way), but then no free fixup.</p>
<p dir="auto">Anyhow, this is not the proper way kemi is supposed to work, from the kemi script it should come direct string (or integer) values, not names of Kamailio-specific pseudo-variables.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/3247#issuecomment-1262724500">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZP4L32ROTLKUZ7ZWJDWAXVEBANCNFSM6AAAAAAQQ7SOMU">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZNMVNGMEFJDPFB7TQTWAXVEBA5CNFSM6AAAAAAQQ7SOMWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSLIOSZI.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><kamailio/kamailio/pull/3247/c1262724500</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/3247#issuecomment-1262724500",
"url": "https://github.com/kamailio/kamailio/pull/3247#issuecomment-1262724500",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>