Re: How to detect originating and terminating?

David Villasmil via sr-users <[email protected]>
Newsgroups gmane.comp.voip.ser
Message-ID <CAFGRPVq81QPaAOFTK=8Q8=AjbH+4WnvWB+dSYjdQGiYbF_nsLQ@mail.gmail.com>
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: [email protected]



On Sat, Jun 7, 2025 at 4:20 PM James Morrison via sr-users <
[email protected]> 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 --
> [email protected]
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
>

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.