OK, I have decided to use htable to store the AVP returned by the LCR module.  I have everything working, except I have run into a strange issue with my failure_route logic.

Immediately after calling next_gw() in my initial REQUEST_ROUTE or FAILURE_ROUTE, I populate an htable which maps the socket I should send all in-dialog requests from.  This gets reset each time we call next_gw() in the event that a gateway can't service my request for some reason.  The issue I have is that on FAILURE_ROUTE scenarios where I am fetching the next gateway, it doesn't appear that the force_send_socket() is actually working for subsequent calls.  The real example I am seeing is below.  I am seeing my log in the ELSE statement, but Kamailio continues to send FROM X.X.X.180.  Not sure what I could be doing wrong...

method status fromip toip send_grp
INVITE
udp:X.X.X.190:5060 udp:X.X.X.179:5060
INVITE
udp:X.X.X.180:5060 udp:216.82.224.202:5060 1
INVITE 100 udp:216.82.224.202:5060 udp:X.X.X.180:5060
INVITE 408 udp:216.82.224.202:5060 udp:X.X.X.180:5060
INVITE
udp:X.X.X.180:5060 udp:216.82.225.202:5060 1
INVITE 100 udp:216.82.225.202:5060 udp:X.X.X.180:5060
INVITE 404 udp:216.82.225.202:5060 udp:X.X.X.180:5060
INVITE
udp:X.X.X.180:5060 udp:209.249.3.78:5060 0
INVITE 100 udp:209.249.3.78:5060 udp:X.X.X.180:5060
INVITE 503 udp:209.249.3.78:5060 udp:X.X.X.180:5060
INVITE
udp:X.X.X.180:5060 udp:208.93.226.12:5060 0
INVITE 100 udp:208.93.226.12:5060 udp:X.X.X.180:5060
INVITE 503 udp:208.93.226.12:5060 udp:X.X.X.180:5060
INVITE 503 udp:X.X.X.179:5060 udp:X.X.X.190:5060
ACK
udp:X.X.X.190:5060 udp:X.X.X.179:5060


if(next_gw()){
            $sht(send_grp=>$ci) = $avp(i:712);   
   
            if($sht(send_grp=>$ci) == 1){
                xlog("L_INFO", "failure_route[1] - send_group==1; sending from .180 $ru");
                force_send_socket(X.X.X.180:5060);
            }else if($sht(send_grp=>$ci) == 2){
                xlog("L_INFO", "failure_route[1] - send_group==2; sending from .180 $ru");
                force_send_socket(X.X.X.189:5060);
            }else{
                xlog("L_INFO", "failure_route[1] - default send group; sending from .179 $ru");
                force_send_socket(X.X.X.179:5060);
            }   
               
            t_on_reply("1");
            t_on_failure("1");
            t_relay();
        }else{
            # let the reply go upstram - it is the default action
            xlog("L_ERR", "No Next Gateway - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
            exit;
        }


On Mon, Jun 28, 2010 at 4:41 AM, Iņaki Baz Castillo <ibc@aliax.net> wrote:
2010/6/28 Juha Heinanen <jh@tutpro.com>:
> Ernest Mavrel writes:
>
>> I use same scenario as Geoffrey. But I have problem with
>> force_send_socket() in failure_route[1].
>> If is first gw online, then everything is ok, force send socket work.
>> But when first gw is offline and lcr try second gw, then message go
>> trough socket which is called on first gw. I am using kamailio 1.4.2. Is
>> this a bug?
>
> i don't know if it is a bug or not, but i call force_send_socket in
> branch route and it has worked as expected.

It's required to use to_gw_grp() in branch_route as changes done by
LCR in the RURI are not visible until etering into branch_route.

--
Iņaki Baz Castillo
<ibc@aliax.net>

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users