<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
In the last weeks the configuration possibilities for OpenSIPS have
been enriched with new additions related to the routes. The intention
was to extend the action range and also to make the configuration file
easier to write and read.<br>
<br>
1. The routes can have string names also, not only numerical IDs as it
was until now.&nbsp; This way the routing flow will be more meaningful and
easier to understand and follow. The backward compatibility was kept -
and you can also use number IDs as route names. <br>
Ex:<br>
----<br>
<big><tt>route[relay] {...}<br>
<br>
route{...; route(relay); ....}</tt></big><br>
----<br>
<br>
2. Two new types of routes were added. They are different to the routes
that existed until now (route, onreply route, failure route, branch
route, local route) because they are not triggered at the receipt of a
SIP message but do independent processing. <br>
The first one is <b>startup_route</b> - called only once when the
server is started and before the listener processes are created. You
can configure here some initialization actions to ease up the future
processing. For example, you could take some values from database and
store them in cache or in shared memory pseudovariables to have faster
access to those values when needed. <br>
Ex:<br>
-----<br>
<big><tt>startup_route {<br>
avp_db_query("select gwlist where ruleid==1",$avp(i:100));<br>
&nbsp;&nbsp;&nbsp; cache_store("local", "rule1", "$avp(i:100)");<br>
}</tt></big><br>
-----<br>
<br>
The second one is <b>timer_route</b> - called on a timer basis at a
given interval. This can be used to configure some periodical actions
that do some data refresh actions for example. The time interval is
given after the name of the route separated by comma and it represents
a value in seconds.<br>
Ex:<br>
-----<br>
<big><tt> timer_route[gw_update, 300] {<br>
&nbsp;&nbsp; avp_db_query("select gwlist where ruleid==1",$avp(i:100));<br>
&nbsp;&nbsp; $shv(i:100) =$avp(i:100);<br>
}</tt></big><br>
-----<br>
<br>
3. One new type of <b>onreply_route</b> was added: <b>per branch on
reply route</b>. Sometimes it is useful to know in a reply route to
which branch it belongs to. Now this is very simple to achieve - if you
call t_on_reply("name") from a branch route then only the replies for
that branch will go through onreply_route[name].<br>
Ex:<br>
-------<br>
<big><tt><big><small>branch_route[1] {<br>
&nbsp;&nbsp;&nbsp; if ($rU=="alice")<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t_on_reply("alice"); # the "alice" reply route<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # is set only for second branch<br>
}<br>
<br>
</small></big></tt></big><br>
<big><tt>onreply_route[alice] {</tt></big><br>
<big><tt>&nbsp;&nbsp;&nbsp; xlog("received reply on the branch from alice\n");</tt></big><br>
<big><tt>}</tt></big><br>
<br>
<br>
Enjoy them.<br>
<br>
Regards,<br>
Anca<br>
</body>
</html>