Thanks Fred. If I understand correctly, when a document says "function
returns FALSE", it means it will return one of the negative numbers. I
assume the expresion "if(negative_number)" will be evaluated to be true in
kamailio cnf.
In that case, the code
if (loose_route()) {
> ...
> } else {
> ...
> }
will never go to "else" block. So basically the code is wrong, right?
Best regards,
Pavan Kumar
On Sat, Apr 27, 2024 at 3:29 AM Fred Posner via sr-users <
[email protected]> wrote:
> > On Apr 26, 2024, at 5:17 PM, Pavan Kumar via sr-users <
> [email protected]> wrote:
> >
> > Hello everyone,
> >
> > While going through the WebRTC example configuration (cfg) to better
> understand and implement it in my setup, I came across a potential issue in
> the code block. The code in question can be found at this link:
> https://github.com/kamailio/kamailio/blob/465994de2859c7863b4cef8457be0a207f15c932/misc/examples/webrtc/websocket.cfg#L253
> >
> > In the code, there is an "if else" block, "if(loose_route())" that seems
> to be incorrect. It appears that the "if" block will always evaluate to
> true, given that "loose_route" never returns 0. According to the
> documentation, the return values of "loose_route" are specified as 1, 2,
> -1, -2, -3.
> >
> > Therefore, it seems the "if" block is unnecessary, and the "else" block
> will never be executed. Could someone please confirm this observation and,
> if accurate, suggest a correction for the code?
> >
> > Thank you for your attention to this matter.
> >
> > Best regards,
> > Pavan Kumar
>
>
> 1,2 would be a true response.
> -1,-2,-3 would be a false response.
>
>
> https://www.kamailio.org/docs/modules/stable/modules/rr.html#rr.f.loose_route
>
> " If there is no Route: header, the function returns FALSE and routing
> should be done with normal lookup functions. If a Route: header is found,
> the function returns 1 and behaves as described in section 16.12 of RFC
> 3261. There is only one exception: If the request is out-of-dialog (no
> to-tag) and there is only one Route: header indicating the local proxy,
> then the Route: header is removed and the function returns FALSE."
>
>
> Regards,
>
> Fred Posner
> p: +1 (352) 664-3733
> https://qxork.com
>
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:
>
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the
sender!
Edit mailing list options or unsubscribe: