According to your description BYE was sent using the information from R-URI which had no 5080 port.
Asterisk should have added port 5080 to the outgoing Invite contact so that it could be used for in-dialog routing.

Can you show a full trace with sip traffic between kamailio and asterisk. To catch sip traffic on all interfaces use "-i any" option for tcpdump or "-d any" for ngrep.

I've been working on integration of Asterisk and Kamailio, currently on the 
same host with different ports, and have come across a problem with calls that 
originate from the Asterisk side (PSTN/DAHDI) and route through Kamailio to a 
SIP UAC.  In short, when the SIP UAC (10.1.1.9) sends the BYE, loose_route() 
is returning -1 and the BYE is routed back to Kamailio (10.1.1.1:5060) instead 
of Asterisk (10.1.1.1:5080).  I am using the stock WITHINDLG route 
configuration.

RR module settings are as follows:
modparam("rr", "enable_full_lr", 1)
modparam("rr", "append_fromtag", 1)

The BYE from the SIP UAC contains the following Route header which only 
contains the contents of Kamailio's Record-Route header.  I have attached the 
full sip trace for review as well.

Route: <sip:10.1.1.1;lr=on;ftag=2400d939-de0b-4456-9e01-f9a3302f3e25;nat=yes>.

What would be the best method to resolve this issue in either Asterisk or 
Kamailio?  Should I manually add a Record-Route header for the Asterisk 
host:port to Kamailio config? Is there something to be done in Asterisk?

Thanks.  -A



_______________________________________________
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