Hello,
I usually look at where the call is originating from, that tells me where it’s going. If it’s coming from a user then it’s originating. Later on, if it’s going to a user it’s terminating.
Regards,
David Villasmil email: david.villasmil.work@gmail.com
On Sat, Jun 7, 2025 at 4:20 PM James Morrison via sr-users < sr-users@lists.kamailio.org> wrote:
I'm trying to find a way to differentiate between originating and terminating legs. Currently in kex module, in core_stats.c I'm adding new counters for more response codes, I want to have two sets of counters, one for originating and one for terminating.
In ims_getters.c file, I found a function called cscf_has_originating, which by description "Finds if the message contains the orig parameter in the first Route header"
I'm calling it like the following: static int km_cb_rpl_stats_by_method(struct sip_msg *msg, unsigned int flags, void *param) { int originating = cscf_has_originating(msg); ....
However it always returns CSCF_RETURN_FALSE (or -1).
I added a log message and increased log level for core module: DEBUG: <core> [ims_getters.c:561]: cscf_has_originating(): I_originating: Header Route not found ERROR: kex [core_stats.c:424]: km_cb_rpl_stats_by_method(): In kex module received rpls, the return value of cscf_has_originating is: -1
That's because cscf_has_originating function is calling parse_headers function, trying to get msg->route but that route property is not set correctly in the previous step: if(parse_headers(msg, HDR_ROUTE_F, 0) < 0) { LM_DBG("I_originating: error parsing headers\n"); return CSCF_RETURN_FALSE; } so it returns -1 after checking msg->route value.
Do you know any alternative solution? or do you know why msg->route value is 0 or NULL? __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!