<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Hi all,<br>
<br>
OpenSIPS trunk (future 1.9) just got better with some awesome
script enhancements:<br>
<br>
1) <b>Flags with name</b>, thanks to Liviu Chircu<br>
Message, script and branch flags have now alphanumerical names,
instead of numerical ID (as so far). Now you can simply do:<br>
setflag(DO_SIPTRACE);<br>
or<br>
issflagset(SRC_IS_GW);<br>
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).<br>
This change is 100% backward compatible, but you will get some
warning about deprecation of the ID based flags.<br>
<br>
<br>
</tt><tt>2) <b>Script tracing</b>, also thanks to Liviu Chircu<br>
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.<br>
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.<br>
Script tracing can be enabled with: script_trace(log_level,
pv_format_string[, info_string]) <br>
Ex:<br>
[line 578][me][module consume_credentials] -> (INVITE from
127.0.0.1 , ruri=<a class="moz-txt-link-freetext" href="sip:111111@opensips.org">sip:111111@opensips.org</a>) <br>
[line 581][me][core setsflag] -> (INVITE from </tt><tt>127.0.0.1</tt><tt>
, ruri=sip:</tt><tt>111111</tt><tt>@opensips.org) <br>
[line 583][me][assign equal] -> (INVITE from </tt><tt>127.0.0.1</tt><tt>
, ruri=sip:</tt><tt>111111</tt><tt>@opensips.org) <br>
[line 592][me][core if] -> (INVITE from </tt><tt>127.0.0.1
</tt><tt>, ruri=<a class="moz-txt-link-freetext" href="sip:tester@opensips.org">sip:tester@opensips.org</a>) <br>
[line 585][me][module is_avp_set] -> (INVITE from </tt><tt>127.0.0.1</tt><tt>
, ruri=<a class="moz-txt-link-freetext" href="sip:tester@opensips.org">sip:tester@opensips.org</a>) <br>
[line 589][me][core if] -> (INVITE from </tt><tt>127.0.0.1</tt><tt>
, ruri=<a class="moz-txt-link-freetext" href="sip:tester@opensips.org">sip:tester@opensips.org</a>) <br>
[line 586][me][module is_method] -> (INVITE from </tt><tt>127.0.0.1</tt><tt>
, ruri=<a class="moz-txt-link-freetext" href="sip:tester@opensips.org">sip:tester@opensips.org</a>) <br>
[line 587][me][module trace_dialog] -> (INVITE </tt><tt>127.0.0.1</tt><tt>
, ruri=<a class="moz-txt-link-freetext" href="sip:tester@opensips.org">sip:tester@opensips.org</a>) <br>
[line 590][me][core setflag] -> (INVITE from </tt><tt>127.0.0.1</tt><tt>
, ruri=<a class="moz-txt-link-freetext" href="sip:tester@opensips.org">sip:tester@opensips.org</a>) <br>
<br>
See: <a class="moz-txt-link-freetext" href="http://www.opensips.org/Resources/DocsCoreFcn#toc146">http://www.opensips.org/Resources/DocsCoreFcn#toc146</a><br>
<br>
<br>
3) <b>Routes with parameters</b>, thanks to Razvan Crainea<br>
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.<br>
You can push up to 7 parameters which can be strings, numbers or
variables.
<br>
</tt><tt>Ex:<br>
<br>
route[tester] {<br>
if ($param(1) > $param(2) )<br>
xlog("test </tt><tt>$param(3) failed \n</tt><tt>");<br>
send_reply("403",Forbidden);<br>
exit;<br>
}<br>
}<br>
<br>
....<br>
route(tester, $avp(calls), 10, "max call limit");<br>
....<br>
<br>
See: <a class="moz-txt-link-freetext" href="http://www.opensips.org/Resources/DocsCoreFcn#toc145">http://www.opensips.org/Resources/DocsCoreFcn#toc145</a><br>
<a class="moz-txt-link-freetext" href="http://www.opensips.org/Resources/DocsCoreVar#toc56">http://www.opensips.org/Resources/DocsCoreVar#toc56</a><br>
<br>
<br>
<br>
I hope you will enjoy these new goodies, feedback is appreciated.<br>
<br>
</tt><tt><br>
Best regards,<br>
</tt>
<pre class="moz-signature" cols="72">--
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
</body>
</html>