[OpenSIPS-Devel] NEW additions to configuration file routes

Anca Vamanu anca at opensips.org
Thu Sep 10 14:45:26 CEST 2009


Hi,

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.

1. The routes can have string names also, not only numerical IDs as it 
was until now.  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.
Ex:
----
route[relay] {...}

route{...; route(relay); ....}
----

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.
The first one is *startup_route* - 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.
Ex:
-----
startup_route {
avp_db_query("select gwlist where ruleid==1",$avp(i:100));
    cache_store("local", "rule1", "$avp(i:100)");
}
-----

The second one is *timer_route* - 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.
Ex:
-----
timer_route[gw_update, 300] {
   avp_db_query("select gwlist where ruleid==1",$avp(i:100));
   $shv(i:100) =$avp(i:100);
}
-----

3. One new type of *onreply_route* was added: *per branch on reply 
route*. 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].
Ex:
-------
branch_route[1] {
    if ($rU=="alice")
        t_on_reply("alice"); # the "alice" reply route
                             # is set only for second branch
}


onreply_route[alice] {
    xlog("received reply on the branch from alice\n");
}


Enjoy them.

Regards,
Anca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/devel/attachments/20090910/d3480ab4/attachment.htm 


More information about the Devel mailing list