OK, I am running into some errors when starting my script:

if(to_gw("1")){
    force_send_socket(X.X.X.180:5060);
}else if(to_gw("3")){
    force_send_socket(X.X.X.179:5060);
}else if(to_gw("4")){
    force_send_socket(X.X.X.189:5060);
}

Jun 25 16:45:14 atl-sipgateway1 /usr/local/sbin/kamailio[15942]: ERROR:core:pv_parse_spec: bad parameters
Jun 25 16:45:14 atl-sipgateway1 /usr/local/sbin/kamailio[15942]: ERROR:core:fixup_pvar: parsing of pseudo variable 1 failed!
Jun 25 16:45:14 atl-sipgateway1 /usr/local/sbin/kamailio[15942]: ERROR:core:fix_actions: fixing failed (code=-1) at cfg line 348
Jun 25 16:45:14 atl-sipgateway1 /usr/local/sbin/kamailio[15942]: CRITICAL:core:fix_expr: fix_actions error
Jun 25 16:45:14 atl-sipgateway1 /usr/local/sbin/kamailio[15942]: ERROR:core:main: failed to fix configuration with err code -1


Perhaps I an confused about how the to_gw() function of the LCR module is to be used.  In my "gw" table, I have gateways with grp_id 1, 3, and 4.  I am assuming that is the value I should be checking for in the to_gw() function, but it seems to be expecting a pseudo variable or something.

What am I missing?

Thanks!




On Fri, Jun 25, 2010 at 4:31 PM, Geoffrey Mina <geoffreymina@gmail.com> wrote:
The only reason I would choose to keep the values at the top is because I have 4 machines which all need a copy of the script.... but would need the IP changed per machine.  Since the IP will be referenced in both REQUEST_ROUTE and FAILURE_ROUTE, i just figured it was easier to store in a PV instead of having to change it 2 places for each machine.

Thanks.


On Fri, Jun 25, 2010 at 4:12 PM, Juha Heinanen <jh@tutpro.com> wrote:
Geoffrey Mina writes:

> modparam("pv","shvset","gw_one=s:1.1.1.1:5060")
> modparam("pv","shvset","gw_two=s:1.1.1.2:5060")
>
> route{
>
>   load_gws();
>   next_gw();
>
>   if(to_gw("1")){
>       force_send_socket($shv(gw_one));
>    }else if(to_gw("2")){
>       force_send_socket($shv(gw_two));
>   }
>
> }

force_send_socket does what do want to do, but i don't know if it
accepts pv argument.  also, i don't see why you need to use pv argument,
rather than write force_send_socket(1.1.1.1:5060), etc.

-- juha