[OpenSIPS-Users] New User - Trying to use variables instead of IP no's

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Jan 22 12:11:07 CET 2009


Hi Matti,

Matti Zemack wrote:
>
> Hi all,
>
> I’m new to Opensips and love the speed of the code. Even in the VmWare 
> dev server I’m running on my (ancient) desktop machine!
>
> As a first attempt at my new job I thought I could try and rewrite the 
> config-scripts used at my company so that one script easily could be 
> used in both dev and all the different Live environments.
>
> Basically I could change a variable early in the opensips.cfg, and 
> this would assign the correct IP’s for me to be used later in the config.
>
> But I suspect I’m using Opensips variables in the wrong way…
>
> Example of original code:
>
> rewritehostport(“10.0.1.100:5060”);
>
> Which I try changing to:
>
> $var(GateWay_5060)=”10.0.1.100:5060”;
>
> rewritehostport(“$var(GateWay_5060)”);
>
Try:
$var(GateWay_5060)=”10.0.1.100:5060”;
$rd = $var(GateWay_5060);

or
$rd = 10.0.1.100:5060”

Regards,
Bogdan


> (This gives me runtime error: ERROR:tm:uri2proxy: bad host name in URI 
> <sip:$var(GateWay_5060)>)
>
> Actually also tried rewritehostport($var(GateWay_5060)); which also 
> gives error: String expected…
>
> So basically, I suppose I’m asking;
>
> How can I cast variables in Opensips? Or should I do this some other, 
> smarter, way?
>
> Thanks in advance,
>
> Matti Zemack
>
> Stockholm
>
> Sweden
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   




More information about the Users mailing list