Re: How to detect originating and terminating?
Alex Balashov via sr-users <[email protected]>
| Newsgroups | gmane.comp.voip.ser |
|---|---|
| Message-ID | <[email protected]> |
Outside the IMS context, my usual approach for deciding whether this is an "inbound" call or an "outbound" call is to branch this based on whether the call is coming from a trusted origination gateway, versus from any other destination, e.g.
if(allow_trusted()) {
# inbound call to user
} else {
# outbound call from user
}
-- Alex
> On Jun 7, 2025, at 10:34 AM, David Villasmil via sr-users <[email protected]> wrote:
>
> 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!
--
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com, https://www.csrpswitch.com
Tel: +1-706-510-6800
__________________________________________________________
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!