Hello,

 

your main assumption regarding the evaluation of return values is wrong. Refer e.g. to this documentation for details on how is evaluated.

 

https://www.kamailio.org/wikidocs/cookbooks/5.8.x/core/#return

 

Cheers,

 

Henning

 

From: Pavan Kumar via sr-users <sr-users@lists.kamailio.org>
Sent: Freitag, 26. April 2024 23:18
To: sr-users@lists.kamailio.org
Cc: Pavan Kumar <pavanputhra@gmail.com>
Subject: [SR-Users] Wrong code in the websocket examples cfg

 

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