Script enhancemets

OpenSIPS trunk (future 1.9) just got better with some awesome script

1) *Flags with name*, thanks to Liviu Chircu
Message, script and branch flags have now alphanumerical names, instead
of numerical ID (as so far). Now you can simply do:
The migration to named flags affects all flag related functions and the
module parameters used for defining flags (like flag to enable sip
tracing, etc).
This change is 100% backward compatible, but you will get some warning
about deprecation of the ID based flags.

2) *Script tracing*, also thanks to Liviu Chircu
With script tracing, you can better understand the flow of execution in
the OpenSIPS script. Moreover, you can also trace the values of
pseudo-variables, as script execution progresses.
The blocks of the script where script tracing is enabled will print a
line for each individual action that is done (e.g. assignments,
conditional tests, module functions, core functions, etc.). Multiple
pseudo-variables can be monitored by specifying a pv_format string (e.g.
"$ru---$avp(var1)"). The current value of the format will be printed
along with each line.
Script tracing can be enabled with: script_trace(log_level,
pv_format_string[, info_string])
[line 578][me][module consume_credentials] -> (INVITE from , ruri=sip:111111 at
[line 581][me][core setsflag] -> (INVITE from,
ruri=sip:111111 at
[line 583][me][assign equal] -> (INVITE from,
ruri=sip:111111 at
[line 592][me][core if] -> (INVITE from ,
ruri=sip:tester at
[line 585][me][module is_avp_set] -> (INVITE from,
ruri=sip:tester at
[line 589][me][core if] -> (INVITE from,
ruri=sip:tester at
[line 586][me][module is_method] -> (INVITE from,
ruri=sip:tester at
[line 587][me][module trace_dialog] -> (INVITE,
ruri=sip:tester at
[line 590][me][core setflag] -> (INVITE from,
ruri=sip:tester at


3) *Routes with parameters*, thanks to Razvan Crainea
When calling a script route, some extra parameters can be attached
(example: route(ROUTE_NAME, 1);), that can be later retrieved from
within the route using the a type of '$param' pseudo variable.
You can push up to 7 parameters which can be strings, numbers or variables.

route[tester] {
if ($param(1) > $param(2) )
xlog("test $param(3) failed \n");

route(tester, $avp(calls), 10, "max call limit");


Posted by Bogdan-Andrei Iancu 2013-01-21

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks