Hi Mihaylov,

If your Asterisk servers add a Record-Route header to the initial Invite, for in-dialog requests ( ACK, BYE) you should use loose_route() function to do the routing. This will make sure the requests go the same path as the initial Invite. It is not a good practice to manually route these requests.

Regards,
Anca


On 01/29/2012 11:10 PM, Stoyan Mihaylov wrote:
My whole configuration is:
[Sip clients] < = > Kamailio 3.2 <=> Asterisk servers (behind Kamailio)
Asterisk servers have only local IP addresses, and I use t_relay instead of forward.
Kamailio runs on same server as rtpproxy.
Everything is fine if clients connect to Kamailio with its IP address - global, or if they are behind Kamailio with local address.
When clients connect to Kamailio using sip.ourcompany.com, then call (video also) is OK, but ACK and BYE do not work.
BYE receives not here (404), and ACK die somewhere.
I forward BYE and ACK in case when src_ip==$td to Asterisk server.

If one of clients use IP - then calls initiated from it are OK (BYE/ACK - are going correctly - to Asterisk and to other client also). But calls from other client have problems with BYE and ACK.

To use sip.ourcompany.com - I put:
alias=sip.ourcompany.com


route[ACKBYE] {
#!ifdef WITH_PSTN
if (is_method("BYE|ACK"))
{
xlog("L_ALERT","AB $rm $sht(forw=>$ft) $td");
if(src_ip==$td){
#I have to rewrite du - messages loop in Kamailio, I store in $sht(forw=>$ft) $du which I use during INVITE.
$du=$sht(forw=>$ft);
route(RELAY);
exit;
}
xlog("L_ALERT","ACK,Bye Not me");
}
#!endif
return;
}