Open dilyanpalauzov opened 1 year ago
https://github.com/kamailio/kamailio/blob/master/src/modules/rtpproxy/examples/alg.cfg contains more examples with break
outside of case
and switch
.
The break
was the first execution control statement, before exit/drop
as well as before while/switch
. The examples using break
where it should be exit
are very old, they must be updated.
Now whether break
can still be used there or not: probably it should be tested, in 2008 we merged source code of Kamailio and SER projects, and it could have some functionality inherited from SER code base, which Kamailio devs might not have used or be familiar with. So it could be like a backward-compatibility
functionality.
But, over all, the recommandation is to use break on in while/switch, in other places there are more suggesting options like exit or drop.
Just to add, did a quick test, it parses and starts. But we certainly should remove it from the module examples.
henning@app01:~/repositories/kamailio$ cat etc/test.cfg
loadmodule "tm.so"
request_route {
seturi("sip:a@example.com");
t_relay();
break;
}
henning@app01:~/repositories/kamailio$ ./src/kamailio -f etc/test.cfg -E -L src/modules/ -Y /tmp/
Listening on
udp: 127.0.0.1:5060
[..]
https://www.kamailio.org/wikidocs/cookbooks/devel/core/ says about
break
:…
https://www.kamailio.org/docs/modules/devel/modules/tm.html contains examples with
break
, like:Either the definition for
break
is wrong, or the four tm-examples are incorrect.The cited documentation is contradicting itself on whether
break
can be used inwhile
.