Hi,
I'm running 4.4.0:ea2033 and am seeing a crash when using route_if_exists() on a nonexistent route:
Core was generated by `/usr/local/sbin/kamailio -P /var/run/kamailio.pid -m 512 -M 8 -u evaristesys -g'. Program terminated with signal 11, Segmentation fault. #0 0x0000000000456751 in do_action (h=0x7ffcce5bc4c0, a=0xf0f0f0f0, msg=0x7fba440abc80) at action.c:337 337 switch ((unsigned char)a->type){ gdb) print a $1 = (struct action *) 0xf0f0f0f0 (gdb) print a->type Cannot access memory at address 0xf0f0f108
The invocation looks like this:
if(check_route_exists("AUX_RTPENGINE_OFFER_INBOUND")) route_if_exists("AUX_RTPENGINE_OFFER_INBOUND"); else { set_rtpengine_set("1"); rtpengine_offer("replace-origin replace-session-connection ICE=remove"); }
#route[AUX_RTPENGINE_OFFER_INBOUND] { # xlog("L_INFO", 'action=R-AUX-RTPENGINE-OFFER-INBOUND'); #}
Uncommenting the nonexistent route has another curious effect: script execution appears to break after route[AUX_RTPENGINE_OFFER_INBOUND] executes, and nothing further happens.
Changing
route_if_exists("AUX_RTPENGINE_OFFER_INBOUND");
to
route(AUX_RTPENGINE_OFFER_INBOUND);
resolves both issues (the crash and the script execution halting). But, of course, if the route is commented out - its normal state - then Kamailio won't start since it won't allow a nonexistent identifier to be passed to route().