Vinicius,

The obvious is that PATH is broken in Asterisk's PJSIP and they won't do anything about it as it's marked "minor". It's been 2 yrs now that me and others have reported it.
[3] https://community.asterisk.org/t/wrong-d-uri-for-invites-with-pjsip-and-path/74079

Bottom line: there's nothing wrong with Kamailio. Start looking for a workaround, don't bet on Sangoma to fix it any time soon, lol.

Regards,
--Sergiu



On Wed, Mar 24, 2021 at 4:52 PM Vinicius Kwiecien Ruoso <vinicius@leads2b.com> wrote:
Hi!

Thanks for the fast response. Sorry about not replying to the correct
email, I've just entered the list and was not getting its individual
emails.

> So it’s an outbound call to a webrtc registered user? If so, kamailio
> should route it to wherever the called user is registered.

Yes, it is a call from the backend Asterisk to a user registered via
the websocket. The register is not stored in Kamailio, so it needs to
use the information in the INVITE message to be able to route to the
correct connection.

> you'll need to share your config and logs. This should work in your scenario.

Turns out looking closer, Asterisk is not respecting the Path protocol
[1] [2]. In the INVITE sent to Kamailio, there is no information about
the path in the message.

To me the best second approach that should work is the "alias="
information in the contact. That makes sense?

I'm sharing my current config as an attachment here. I'm new to
Kamailio, so I might be missing something really obvious here.

[1] https://issues.asterisk.org/jira/browse/ASTERISK-28211
[2] https://community.asterisk.org/t/pjsip-path-module-issues/88046/12

Thanks,
Vinicius

On Tue, Mar 23, 2021 at 6:43 PM Vinicius Kwiecien Ruoso
<vinicius@leads2b.com> wrote:
>
> Hi!
>
> I'm using Kamaio in front of multiple Asterisk instances. At this
> moment it works as a SIP over Websocket proxy, with rtpengine, for
> browser clients to connect to Asterisk using WebRTC. I do not use the
> registration module of Kamailio, as each backend Asterisk is
> independent and handles its own registrations.
>
> Everything works great when making calls from the browser, and the
> routing is correctly executed by Kamailio based on the request SIP
> domain. We have an internal routing API that it calls to discover
> which backend Asterisk to route the calls.
>
> The issue I have is when a call initiates from that backend Asterisk,
> trying to reach a contact that is connected in Kamailio via the
> websocket. The Asterisk sends the message to the proxy, and Kamailio
> must route it to the corresponding websocket.
>
> I've tried a few approaches:
> - using add_contact_alias + handle_ruri_alias: I have the alias with
> alias=<ip>~<port>~ws in the contact registration, but for some reason
> handle_ruri_alias cannot use it
> - using the Path module on Asterisk, so when registering, the path is
> recorded and sent back from Asterisk, Kamailio is also not respecting
> that
> - Using contact_param_encode and contact_param_encode and
> contact_param_decode_ruri, but the encoded sip address is always the
> invalid websocket, like sip:58c0ktrg@5hp0nn5hqqv9.invalid;transport=ws
>
> None with success. Any hints on that can be wrong? I can share more
> detailed information.
>
> Greetings,
> Vinicius
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users