[OpenSER-Users] Global variables in scripts.

Peter Lemenkov lemenkov at gmail.com
Fri Apr 25 16:23:35 CEST 2008


Hello All!

Are any ways to define global variables in openser's scripts?

I need somethng like

==========================================

$var(router1) = "192.168.1.1"
$var(router2) = "192.168.1.2"

route {
 ...
 myfunc1("$ru")
switch($retcode)
 case 1:
  $ruri = "sip:" + $rU + "@" + $var(route1);
 case 2:
  $ruri = "sip:" + $rU + "@" + $var(route2);
}

failure_route[1] {
 myfunc2("$ru")
switch($retcode)
 case 1:
  $ruri = "sip:" + $rU + "@" + $var(route1);
 case 2:
  $ruri = "sip:" + $rU + "@" + $var(route2);
}

onreply_route[1] {
 myfunc3("$ru")
switch($retcode)
 case 1:
  $ruri = "sip:" + $rU + "@" + $var(route1);
 case 2:
  $ruri = "sip:" + $rU + "@" + $var(route2);
}

==========================================

Right now (AFAIK) variables may be defined only within one route.
Maybe I missing something? What's the scope of visibility of variables
within configuration script?



-- 
With best regards!




More information about the sr-users mailing list