Hi,
     Need a little help with get_redirects(), using openser 1.2.  I am using the following in failure_route to capture contacts from a "multiple choices" reply from cisco media gateway.  

Following code sets the ruri to the last contact, however, the $ds show more information about other contacts.  Is there a way to reset this so that only ruri information is used? Cisco response and xlog information is also given below. 

if(!get_redirects("*:*"))
                {
                                xlog("L_ERROR", "Failed to fetch contact '$ct' from 301/302 - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                                acc_db_request("480", "acc");
                                t_reply("480", "Temporarily Unavailable");
                                exit;
                }
# get last URI from destination-set and set it as R-URI
                xlog("L_INFO", "Redirect from UAC intercepted 1 - M=$rm RURI=$ru D=$ds B=$bR \nF=$fu T=$tu IP=$si ID=$ci\n");
                avp_delete("$avp(s:tmp)/g");
                $avp(s:tmp) = $ds;
                avp_subst("$avp(s:tmp)", "/.*(sip:.+@[^:;>]+).*$/\1/");
                avp_pushto("$ru", "$avp(s:tmp)");
                setflag(29);
                xlog("L_INFO", "Redirect from UAC intercepted 2 - M=$rm RURI=$ru D=$ds B=$bR \ntmp=$avp(s:tmp) \nF=$fu T=$tu IP=$si ID=$ci\n");
                append_branch();
route(17); # process 
exit;
}


Thanks in advance for your advice.  

-- 
Zahid
  


The response from gateway:

U 2008/08/26 08:19:04.440411 10.10.0.32:5060 -> 10.10.0.98:5060
SIP/2.0 300 Multiple Choices.
Via: SIP/2.0/UDP 10.10.0.98;branch=z9hG4bK901b.335cb695.0,SIP/2.0/UDP 10.10.12.140;branch=z9hG4bK612a4f20B9293665.
From: "10521" <sip:10521@devproxy.myip.org>;tag=B395F9F2-4618AC3F.
To: <sip:40001@devproxy.myip.org;user=phone>;tag=195535C4-11AC.
Date: Tue, 26 Aug 2008 12:19:04 GMT.
Call-ID: f7932e23-d89cd014-e3ea20a9@10.10.12.140.
Server: Cisco-SIPGateway/IOS-12.x.
CSeq: 2 INVITE.
Allow-Events: telephone-event.
Diversion: <sip:40001@10.10.0.32>;reason=unconditional;counter=1.
Contact: <sip:10512@10.10.0.98>,<sip:10512@10.10.0.32>.
Content-Length: 0.


xlog entries:


Aug 26 08:19:04 mousse openser[15353]: Redirect from UAC intercepted 1 - 
M=INVITE RURI=sip:40001@10.10.0.32:5060;transport=udp  
D=Contact: sip:40001@10.10.0.32:5060;transport=udp, <sip:10512@10.10.0.32>;q=0.01, <sip:10512@10.10.0.98>;q=0.01  
B=<sip:10512@10.10.0.32>;q=0.01, <sip:10512@10.10.0.98>;q=0.01  
F=sip:10521@devproxy.myip.org T=sip:40001@devproxy.myip.org;user=phone IP=10.10.12.140 ID=f7932e23-d89cd014-e3ea20a9@10.10.12.140 

Aug 26 08:19:04 mousse openser[15353]: Redirect from UAC intercepted 2 - 
M=INVITE RURI=sip:10512@10.10.0.98  
D=Contact: sip:10512@10.10.0.98, <sip:10512@10.10.0.32>;q=0.01, <sip:10512@10.10.0.98>;q=0.01  
B=<sip:10512@10.10.0.32>;q=0.01, <sip:10512@10.10.0.98>;q=0.01  
tmp=sip:10512@10.10.0.98  F=sip:10521@devproxy.myip.org T=sip:40001@devproxy.myip.org;user=phone IP=10.10.12.140 ID=f7932e23-d89cd014-e3ea20a9@10.10.12.140 

Aug 26 08:19:04 mousse openser[15353]: Redirect from UAC intercepted - 
M=INVITE RURI=sip:10512@10.10.0.98  
D=Contact: sip:10512@10.10.0.98, <sip:10512@10.10.0.32>;q=0.01, <sip:10512@10.10.0.98>;q=0.01, sip:10512@10.10.0.98  
B=<sip:10512@10.10.0.32>;q=0.01, <sip:10512@10.10.0.98>;q=0.01, sip:10512@10.10.0.98  
F=sip:10521@devproxy.myip.org T=sip:40001@devproxy.myip.org;user=phone IP=10.10.12.140 ID=f7932e23-d89cd014-e3ea20a9@10.10.12.140