Debugging the routing script

To better test and debug the routing script, we will use the xlog() function as a way to insert debugging and informational messages in our script:

loadmodule "xlog.so"
xlog("L_ERR","Marker 480 ruri=<$ru>");

You can check the latest XLOG messages with the following command:

tail /var/log/syslog

The t_on_failure() function tells OpenSIPS to handle the SIP failure (negative/unsuccessful replies) conditions. Failure conditions in this context are error messages of codes, 4XX and 5XX. When you call t_on_failure() just before calling the t_relay() function, you will tell OpenSIPS to transfer the control to failure_route[missed_call] when a failure message is detected:

Note

IMPORTANT: OpenSIPS does not execute the failure route ...

Get Building Telephony Systems with OpenSIPS - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.