Hello All. I have kamailio with provider connection (trunk)
When I call to external number through my provider call extablished Ok. But when i try hangup call from external number no BYE sended to me. When I hangup call from my kamailio (internal num) I send by to exteral number and it respond me Ok so session if fully complete. I guess that BYE from external number not recieves to me because I have wrong routing header fields at my INVITe  or ACK messages, but can not find any information what what header must recieve info to external number where send BYE at hangup or thomething like this. 

This is my little dump for situation wherer I hangup from internal number and BYE finished successfully:



IP my.kamailio.com.5068 > my.proider.com.5060: UDP, length 1599
E....< .@.'.
...6........G.RINVITE sip:12345678900@my.provider.com:5060 SIP/2.0
Record-Route: <sip:my.kamailio.com:5068;nat=yes;ftag=as5872f19e;lr=on>
Via: SIP/2.0/UDP my.kamailio.com:5068;branch=z9hG4bK5c63.57e9ba848fadd4e228caa4445baf9d76.2
Via: SIP/2.0/UDP my.client.internal.ip:50600;branch=z9hG4bK4d90cebf;rport=50600
Max-Forwards: 70
From: <sip:TrunkNum@my.provider.com>;tag=as5872f19e
To: <sip:12345678900@my.provider.com:5068>
Contact:<TrunkNum@my.kamailio.com:5068>
Call-ID: 42b819d45c08c9d304343bf976c5b405@my.client.internal.ip:50600
CSeq: 102 INVITE
User-Agent: Asterisk PBX 12.5.0
Date: Thu, 04 Sep 2014 21:53:13 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 544
Proxy-Authorization: Digest username="TrunkNum", realm="my.provider.com", nonce="VAjgfVQI31EsekTXtYjBzKa59XFSJB5P", uri="sip:12345678900@my.provider.com:5060", qop=auth, nc=00000001, cnonce="3619116795", response="f5bc1d8125dd9e448d2e73764823adee", algorithm=MD5

v=0
o=root 1022912010 1022912010 IN IP4 my.kamailio.com
s=Asterisk PBX 12.5.0
c=IN IP4 my.kamailio.com
t=0 0
a=ice-lite
m=audio 30032 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
a=rtcp:30033
a=ice-ufrag:3o8JrqkF
a=ice-pwd:m8q4khQT8NKSABqeUkKs7ed8ClR2
a=candidate:TgT1dfTnI3kBgWQ

IP my.proider.com.5060 > my.kamailio.com.5068: UDP, length 1882
E..... ./...6...
........b..SIP/2.0 200 OK
Via: SIP/2.0/UDP my.kamailio.com:5068;rport=5068;received=my.kamailio.com;branch=z9hG4bK5c63.57e9ba848fadd4e228caa4445baf9d76.2
Via: SIP/2.0/UDP my.client.internal.ip:50600;branch=z9hG4bK4d90cebf;rport=50600
Record-Route: <sip:my.proider.com;lr=on;ftag=as5872f19e>
Record-Route: <sip:my.kamailio.com:5068;nat=yes;ftag=as5872f19e;lr=on>
From: <sip:TrunkNum@my.provider.com>;tag=as5872f19e
To: <sip:12345678900@my.provider.com:5068>;tag=5rF0FNamQ99gH
Call-ID: 42b819d45c08c9d304343bf976c5b405@my.client.internal.ip:50600
CSeq: 102 INVITE
Contact: <sip:12345678900@externail.number.end.ip:5060;transport=udp>
User-Agent: provider agent
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REFER, NOTIFY
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, conference, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 746
X-provider agentOutboundGateway: sip:5574012345678900@62.93.147.149
X-provider agentOutboundCarrierID: 23705946361020
X-provider agentCarrierRate: 0.20180
X-provider agentCloudRate: 0.00300
Remote-Party-ID: "Outbound Call" <sip:5060@my.provider.com>;party=calling;privacy=off;screen=no

v=0
o=FreeSWITCH 1409844386 1409844387 IN IP4 externail.number.end.ip
s=FreeSWITCH
c=IN IP4 externail.number.end.ip
t=0 0
a=msid-semantic: WMS hQBNQPw0VjJInvOA0H6HPZyePNO0IIqP
m=audio 23216 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=ssrc:2990874569 cname:pRs5xP

 

 

IP my.kamailio.com.5068 > my.proider.com.5060: UDP, length 596
E..p.@..@.K\
...6........\`.ACK sip:12345678900@externail.number.end.ip:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP my.kamailio.com:5068;branch=z9hG4bK5c63.8c0bfc7de0669f1b8252b97b8431b2e1.0
Via: SIP/2.0/UDP my.client.internal.ip:50600;branch=z9hG4bK5420b559;rport=50600
Route: <sip:my.proider.com;lr=on;ftag=as5872f19e>
Max-Forwards: 70
From: <sip:TrunkNum@sip.callsion.com>;tag=as5872f19e
To: <sip:12345678900@my.provider.com:5068>;tag=5rF0FNamQ99gH
Call-ID: 42b819d45c08c9d304343bf976c5b405@my.client.internal.ip:50600
CSeq: 102 ACK
User-Agent: Asterisk PBX 12.5.0
Content-Length: 0

 







 

 

IP my.kamailio.com.5068 > my.proider.com.5060: UDP, length 617
E....D..@.KC
...6........q.ZBYE sip:12345678900@externail.number.end.ip:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP my.kamailio.com:5068;branch=z9hG4bK6c63.3deda3c1fee0ef86d7eae9549dd1b194.0
Via: SIP/2.0/UDP my.client.internal.ip:50600;branch=z9hG4bK65e48b85;rport=50600
Route: <sip:my.proider.com;lr=on;ftag=as5872f19e>
Max-Forwards: 70
From: <sip:TrunkNum@sip.callsion.com>;tag=as5872f19e
To: <sip:12345678900@my.provider.com:5068>;tag=5rF0FNamQ99gH
Call-ID: 42b819d45c08c9d304343bf976c5b405@my.client.internal.ip:50600
CSeq: 103 BYE
User-Agent: Asterisk PBX 12.5.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


IP my.proider.com.5060 > my.kamailio.com.5068: UDP, length 568
E..T....-.676...
........@..SIP/2.0 200 OK
Via: SIP/2.0/UDP my.kamailio.com:5068;received=my.kamailio.com;branch=z9hG4bK6c63.3deda3c1fee0ef86d7eae9549dd1b194.0
Via: SIP/2.0/UDP my.client.internal.ip:50600;branch=z9hG4bK65e48b85;rport=50600
From: <sip:TrunkNum@sip.callsion.com>;tag=as5872f19e
To: <sip:12345678900@my.provider.com:5068>;tag=5rF0FNamQ99gH
Call-ID: 42b819d45c08c9d304343bf976c5b405@my.client.internal.ip:50600
CSeq: 103 BYE
User-Agent: provider agent
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REFER, NOTIFY
Supported: timer, precondition, path, replaces
Content-Length: 0




Thanks for help.