Help: call leg do not exist

I use asterisk 1.8.11 (192.168.100.202)to connect lync server .I use tls port 5068 to connect to this lync server .
The tls is ok to establish and I make call from softphone 3200 (register to Asterisk) and
dial 9XXXXXXX (9+85225082162) , this prefix will dial to trunk lync_trunk and pass to lync server(192.168.100.14) using tls .

But the lync client in opposite side ringing and they recevie the call , but when they answer the call , the call drop and hang up immediately .In sip trace I see there is “call leg not exits” error … what is wrong …Below is the related setting and trace …


--------------------------------------------------------------------------------

///////////////
sip.conf

/////////////////////////////

[3200]
deny=0.0.0.0/0.0.0.0
secret=
dtmfmode=rfc2833
canreinvite=no
context=from-internal
host=dynamic
type=friend
nat=no
port=5060
qualify=yes
callgroup=
pickupgroup=
disallow=all
allow=ulaw
dial=SIP/3200
mailbox=3200@default
permit=0.0.0.0/0.0.0.0
callerid=device <3200>
callcounter=yes
faxdetect=no
transport=udp



[lync_trunk]
disallow=all
allow=ulaw
type=friend
port=5068
#host=192.168.100.14
#host=Entpool.lync-demo.local
host=lync-ENT.lync-demo.local
dtmfmode=rfc2833
context=from-internal
qualify=yes
#qualify=yes
#transport=tcp
#transport=tls,udp,tcp
transport=tls,tcp,udp
encryption=yes
#encryption=no
#strpcapable=yes
nat=no


[genernal]

insecure=invite,port
#qualify=yes
disallow=all
allow=ulaw
#allow=h263
videosupport=yes
#register => 2178@10.1.2.31
#register => 2177@10.1.2.31
#register => 2179@10.1.2.31
#subsribemwi=yes
t38pt_udptl = yes
#directrtpsetup=yes
context=from-internal
port=5060
udpbindaddr=0.0.0.0
tcpenable=yes
tcpbindaddr=0.0.0.0:5060
tlsenable=yes
tlsbindaddr=192.168.100.202:5068
tlscertfile=/keytest/1/server1.pem
tlsprivatekey=/keytest/1/mykey.pem
tlscafile=/keytest/1/certnew.cer
#tlscadir=/etc/asterisk/certificates
tlsdontverifyserver=yes
#tlscipher=DES-CBC3-SHA
tlscipher=ALL
tlsclientmethod=tlsv1
transport=tls,tcp,udp
encryption=no

/////////////////////
extension.conf

[from-internal]
exten => _9.,1,Set(CHANNEL(secure_bridge_signaling)=1)
exten => _9.,2,Set(CHANNEL(secure_bridge_media)=1)
exten => _9.,3,Dial(SIP/lync_trunk/${EXTEN:1})
exten => _9.,n,HangUp()

///////////////


--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Trace



[Oct 20 01:33:28]
<--- Transmitting (no NAT) to 192.168.100.139:9446 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.100.139:9446;branch=z9hG4bK-d8754z-da1d254b6d698e3d-1---d8754z-;received=192.168.100.139;rport=9446
From: "3200"<sip:3200@192.168.100.202>;tag=f45f9247
To: "a a"<sip:9+85225082162@192.168.100.202>
Call-ID: OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.
CSeq: 1 INVITE
Server: Asterisk PBX 1.8.11.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:9+85225082162@192.168.100.202:5060>
Content-Length: 0


<------------>
[Oct 20 01:33:28]     -- Executing [9+85225082162@from-internal:1] Set("SIP/3200-00000000", "CHANNEL(secure_bridge_signaling)=1") in new stack
[Oct 20 01:33:28]     -- Executing [9+85225082162@from-internal:2] Set("SIP/3200-00000000", "CHANNEL(secure_bridge_media)=1") in new stack
[Oct 20 01:33:28]     -- Executing [9+85225082162@from-internal:3] Dial("SIP/3200-00000000", "SIP/lync_trunk/+85225082162") in new stack
[Oct 20 01:33:28]   == Using SIP RTP CoS mark 5
[Oct 20 01:33:28] Audio is at 13190
[Oct 20 01:33:28] Adding codec 0x4 (ulaw) to SDP
[Oct 20 01:33:28] Adding non-codec 0x1 (telephone-event) to SDP
[Oct 20 01:33:28] Reliably Transmitting (no NAT) to 192.168.100.14:5068:
INVITE sip:+85225082162@lync-ENT.lync-demo.local:5068 SIP/2.0
Via: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK5166129e
Max-Forwards: 70
From: "device" <sip:3200@192.168.100.202:5068>;tag=as0420bf81
To: <sip:+85225082162@lync-ENT.lync-demo.local:5068>
Contact: <sip:3200@192.168.100.202:5068;transport=TLS>
Call-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.11.0
Date: Fri, 19 Oct 2012 17:33:28 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 326

v=0
o=root 912592584 912592584 IN IP4 192.168.100.202
s=Asterisk PBX 1.8.11.0
c=IN IP4 192.168.100.202
t=0 0
m=audio 13190 RTP/SAVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:6WDuZdNTu1TiLAtZGLMEJjU9AxU3/Pvl9sVlzg2H

---
[Oct 20 01:33:28]     -- Called SIP/lync_trunk/+85225082162
[Oct 20 01:33:28]
<--- SIP read from TLS:192.168.100.14:5068 --->
SIP/2.0 100 Trying
FROM: "device"<sip:3200@192.168.100.202:5068>;tag=as0420bf81
TO: <sip:+85225082162@lync-ENT.lync-demo.local:5068>
CSEQ: 102 INVITE
CALL-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
VIA: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK5166129e
CONTENT-LENGTH: 0

<------------->
[Oct 20 01:33:28] --- (7 headers 0 lines) ---
[Oct 20 01:33:29]
<--- SIP read from TLS:192.168.100.14:5068 --->
SIP/2.0 183 Session Progress
FROM: "device"<sip:3200@192.168.100.202:5068>;tag=as0420bf81
TO: <sip:+85225082162@lync-ENT.lync-demo.local:5068>;tag=9980ff3864;epid=8E515F99D4
CSEQ: 102 INVITE
CALL-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
VIA: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK5166129e
CONTACT: <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls>
CONTENT-LENGTH: 0
ALLOW: CANCEL
ALLOW: BYE
ALLOW: UPDATE
ALLOW: PRACK
SERVER: RTCC/4.0.0.0 MediationServer

<------------->
[Oct 20 01:33:29] --- (13 headers 0 lines) ---
[Oct 20 01:33:29] list_route: hop: <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls>
[Oct 20 01:33:29]     -- SIP/lync_trunk-00000001 is ringing
[Oct 20 01:33:29]
<--- Transmitting (no NAT) to 192.168.100.139:9446 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.100.139:9446;branch=z9hG4bK-d8754z-da1d254b6d698e3d-1---d8754z-;received=192.168.100.139;rport=9446
From: "3200"<sip:3200@192.168.100.202>;tag=f45f9247
To: "a a"<sip:9+85225082162@192.168.100.202>;tag=as73e9d75d
Call-ID: OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.
CSeq: 1 INVITE
Server: Asterisk PBX 1.8.11.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:9+85225082162@192.168.100.202:5060>
Content-Length: 0


<------------>
[Oct 20 01:33:29]
<--- SIP read from TLS:192.168.100.14:5068 --->
SIP/2.0 180 Ringing
FROM: "device"<sip:3200@192.168.100.202:5068>;tag=as0420bf81
TO: <sip:+85225082162@lync-ENT.lync-demo.local:5068>;tag=9980ff3864;epid=8E515F99D4
CSEQ: 102 INVITE
CALL-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
VIA: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK5166129e
CONTACT: <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls>
CONTENT-LENGTH: 0
ALLOW: CANCEL
ALLOW: BYE
ALLOW: UPDATE
ALLOW: PRACK
SERVER: RTCC/4.0.0.0 MediationServer

<------------->
[Oct 20 01:33:29] --- (13 headers 0 lines) ---
[Oct 20 01:33:29] list_route: hop: <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls>
[Oct 20 01:33:29]     -- SIP/lync_trunk-00000001 is ringing
[Oct 20 01:33:29]
<--- SIP read from TLS:192.168.100.14:5068 --->
SIP/2.0 183 Session Progress
FROM: "device"<sip:3200@192.168.100.202:5068>;tag=as0420bf81
TO: <sip:+85225082162@lync-ENT.lync-demo.local:5068>;tag=59218fa047;epid=8E515F99D4
CSEQ: 102 INVITE
CALL-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
VIA: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK5166129e
CONTACT: <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls>
CONTENT-LENGTH: 326
CONTENT-TYPE: application/sdp
ALLOW: CANCEL
ALLOW: BYE
ALLOW: UPDATE
ALLOW: PRACK
SERVER: RTCC/4.0.0.0 MediationServer

v=0
o=- 0 0 IN IP4 192.168.100.118
s=session
c=IN IP4 192.168.100.118
b=CT:99980
t=0 0
m=audio 12674 RTP/SAVP 0 101
c=IN IP4 192.168.100.118
a=rtcp:12675
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WosHmjAmmfnRmkfjx+hb0UddUIiE85sNLgZ5cM4S|2^31
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
<------------->
[Oct 20 01:33:29] --- (14 headers 13 lines) ---
[Oct 20 01:33:29] list_route: hop: <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls>
[Oct 20 01:33:29] Found RTP audio format 0
[Oct 20 01:33:29] Found RTP audio format 101
[Oct 20 01:33:29] Found audio description format PCMU for ID 0
[Oct 20 01:33:29] Found audio description format telephone-event for ID 101
[Oct 20 01:33:29]     -- SIP/lync_trunk-00000001 is making progress passing it to SIP/3200-00000000
[Oct 20 01:33:29] Audio is at 12618
[Oct 20 01:33:29] Adding codec 0x4 (ulaw) to SDP
[Oct 20 01:33:29] Adding non-codec 0x1 (telephone-event) to SDP
[Oct 20 01:33:29]
<--- Transmitting (no NAT) to 192.168.100.139:9446 --->
SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.100.139:9446;branch=z9hG4bK-d8754z-da1d254b6d698e3d-1---d8754z-;received=192.168.100.139;rport=9446
From: "3200"<sip:3200@192.168.100.202>;tag=f45f9247
To: "a a"<sip:9+85225082162@192.168.100.202>;tag=as73e9d75d
Call-ID: OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.
CSeq: 1 INVITE
Server: Asterisk PBX 1.8.11.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:9+85225082162@192.168.100.202:5060>
Content-Type: application/sdp
Content-Length: 241

v=0
o=root 928537276 928537276 IN IP4 192.168.100.202
s=Asterisk PBX 1.8.11.0
c=IN IP4 192.168.100.202
t=0 0
m=audio 12618 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

<------------>
[Oct 20 01:33:31]
<--- SIP read from TLS:192.168.100.14:5068 --->
SIP/2.0 200 OK
FROM: "device"<sip:3200@192.168.100.202:5068>;tag=as0420bf81
TO: <sip:+85225082162@lync-ENT.lync-demo.local:5068>;tag=59218fa047;epid=8E515F99D4
CSEQ: 102 INVITE
CALL-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
VIA: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK5166129e
CONTACT: <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls>
CONTENT-LENGTH: 326
SUPPORTED: 100rel
CONTENT-TYPE: application/sdp
ALLOW: ACK
SERVER: RTCC/4.0.0.0 MediationServer
Allow: CANCEL,BYE,INVITE,PRACK,UPDATE

v=0
o=- 0 1 IN IP4 192.168.100.118
s=session
c=IN IP4 192.168.100.118
b=CT:99980
t=0 0
m=audio 12674 RTP/SAVP 0 101
c=IN IP4 192.168.100.118
a=rtcp:12675
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:WosHmjAmmfnRmkfjx+hb0UddUIiE85sNLgZ5cM4S|2^31
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
<------------->
[Oct 20 01:33:31] --- (13 headers 13 lines) ---
[Oct 20 01:33:31] Found RTP audio format 0
[Oct 20 01:33:31] Found RTP audio format 101
[Oct 20 01:33:31] Found audio description format PCMU for ID 0
[Oct 20 01:33:31] Found audio description format telephone-event for ID 101
[Oct 20 01:33:31] list_route: hop: <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls>
[Oct 20 01:33:31] set_destination: Parsing <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls> for address/port to send to
[Oct 20 01:33:31] set_destination: set destination to 192.168.100.14:5068
[Oct 20 01:33:31] Transmitting (no NAT) to 192.168.100.14:5068:
ACK sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls SIP/2.0
Via: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK415aff1a
Max-Forwards: 70
From: "device" <sip:3200@192.168.100.202:5068>;tag=as0420bf81
To: <sip:+85225082162@lync-ENT.lync-demo.local:5068>;tag=59218fa047
Contact: <sip:3200@192.168.100.202:5068;transport=TLS>
Call-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
CSeq: 102 ACK
User-Agent: Asterisk PBX 1.8.11.0
Content-Length: 0


---
[Oct 20 01:33:31] set_destination: Parsing <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls> for address/port to send to
[Oct 20 01:33:31] set_destination: set destination to 192.168.100.14:5068
[Oct 20 01:33:31] Reliably Transmitting (no NAT) to 192.168.100.14:5068:
BYE sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls SIP/2.0
Via: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK71280805
Max-Forwards: 70
From: "device" <sip:3200@192.168.100.202:5068>;tag=as0420bf81
To: <sip:+85225082162@lync-ENT.lync-demo.local:5068>;tag=59218fa047
Call-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
CSeq: 103 BYE
User-Agent: Asterisk PBX 1.8.11.0
X-Asterisk-HangupCause: Unknown
X-Asterisk-HangupCauseCode: 0
Content-Length: 0


---
[Oct 20 01:33:31] Scheduling destruction of SIP dialog '5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068' in 19328 ms (Method: INVITE)
[Oct 20 01:33:31]     -- SIP/lync_trunk-00000001 answered SIP/3200-00000000
[Oct 20 01:33:31] Audio is at 12618
[Oct 20 01:33:31] Adding codec 0x4 (ulaw) to SDP
[Oct 20 01:33:31] Adding non-codec 0x1 (telephone-event) to SDP
[Oct 20 01:33:31]
<--- Reliably Transmitting (no NAT) to 192.168.100.139:9446 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.100.139:9446;branch=z9hG4bK-d8754z-da1d254b6d698e3d-1---d8754z-;received=192.168.100.139;rport=9446
From: "3200"<sip:3200@192.168.100.202>;tag=f45f9247
To: "a a"<sip:9+85225082162@192.168.100.202>;tag=as73e9d75d
Call-ID: OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.
CSeq: 1 INVITE
Server: Asterisk PBX 1.8.11.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:9+85225082162@192.168.100.202:5060>
Content-Type: application/sdp
Content-Length: 241

v=0
o=root 928537276 928537277 IN IP4 192.168.100.202
s=Asterisk PBX 1.8.11.0
c=IN IP4 192.168.100.202
t=0 0
m=audio 12618 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

<------------>
[Oct 20 01:33:31]     -- Executing [h@from-internal:1] Macro("SIP/3200-00000000", "hangupcall") in new stack
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:1] GotoIf("SIP/3200-00000000", "1?endmixmoncheck") in new stack
[Oct 20 01:33:31]     -- Goto (macro-hangupcall,s,9)
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:9] NoOp("SIP/3200-00000000", "End of MIXMON check") in new stack
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:10] GotoIf("SIP/3200-00000000", "1?nomeetmemon") in new stack
[Oct 20 01:33:31]     -- Goto (macro-hangupcall,s,15)
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:15] NoOp("SIP/3200-00000000", "MEETME_RECORDINGFILE=") in new stack
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:16] GotoIf("SIP/3200-00000000", "1?noautomon") in new stack
[Oct 20 01:33:31]     -- Goto (macro-hangupcall,s,18)
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:18] NoOp("SIP/3200-00000000", "TOUCH_MONITOR_OUTPUT=") in new stack
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:19] GotoIf("SIP/3200-00000000", "1?noautomon2") in new stack
[Oct 20 01:33:31]     -- Goto (macro-hangupcall,s,25)
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:25] NoOp("SIP/3200-00000000", "MONITOR_FILENAME=") in new stack
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:26] GotoIf("SIP/3200-00000000", "1?skiprg") in new stack
[Oct 20 01:33:31]     -- Goto (macro-hangupcall,s,29)
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:29] GotoIf("SIP/3200-00000000", "1?skipblkvm") in new stack
[Oct 20 01:33:31]     -- Goto (macro-hangupcall,s,32)
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:32] GotoIf("SIP/3200-00000000", "1?theend") in new stack
[Oct 20 01:33:31]     -- Goto (macro-hangupcall,s,34)
[Oct 20 01:33:31]     -- Executing [s@macro-hangupcall:34] Hangup("SIP/3200-00000000", "") in new stack
[Oct 20 01:33:31]   == Spawn extension (macro-hangupcall, s, 34) exited non-zero on 'SIP/3200-00000000' in macro 'hangupcall'
[Oct 20 01:33:31]   == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/3200-00000000'
[Oct 20 01:33:31] Scheduling destruction of SIP dialog '5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068' in 19328 ms (Method: INVITE)
[Oct 20 01:33:31] set_destination: Parsing <sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls> for address/port to send to
[Oct 20 01:33:31] set_destination: set destination to 192.168.100.14:5068
[Oct 20 01:33:31] Reliably Transmitting (no NAT) to 192.168.100.14:5068:
BYE sip:LYNC-ENT.LYNC-demo.local:5068;transport=Tls SIP/2.0
Via: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK303f67a9
Max-Forwards: 70
From: "device" <sip:3200@192.168.100.202:5068>;tag=as0420bf81
To: <sip:+85225082162@lync-ENT.lync-demo.local:5068>;tag=59218fa047
Call-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
CSeq: 104 BYE
User-Agent: Asterisk PBX 1.8.11.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
[Oct 20 01:33:31]   == Spawn extension (from-internal, 9+85225082162, 3) exited non-zero on 'SIP/3200-00000000'
[Oct 20 01:33:31] Scheduling destruction of SIP dialog 'OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.' in 120128 ms (Method: INVITE)
[Oct 20 01:33:31]
<--- SIP read from UDP:192.168.100.139:9446 --->
ACK sip:9+85225082162@192.168.100.202:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.100.139:9446;branch=z9hG4bK-d8754z-a878d618655fa061-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:3200@192.168.100.139:9446;transport=udp>
To: "a a"<sip:9+85225082162@192.168.100.202>;tag=as73e9d75d
From: "3200"<sip:3200@192.168.100.202>;tag=f45f9247
Call-ID: OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.
CSeq: 1 ACK
User-Agent: eyeBeam release 1100z stamp 47739
Content-Length: 0

<------------->
[Oct 20 01:33:31] --- (10 headers 0 lines) ---
[Oct 20 01:33:31] set_destination: Parsing <sip:3200@192.168.100.139:9446;transport=udp> for address/port to send to
[Oct 20 01:33:31] set_destination: set destination to 192.168.100.139:9446
[Oct 20 01:33:31] Reliably Transmitting (no NAT) to 192.168.100.139:9446:
BYE sip:3200@192.168.100.139:9446;transport=udp SIP/2.0
Via: SIP/2.0/UDP 192.168.100.202:5060;branch=z9hG4bK2d2bfc3a;rport
Max-Forwards: 70
From: "a a"<sip:9+85225082162@192.168.100.202>;tag=as73e9d75d
To: "3200"<sip:3200@192.168.100.202>;tag=f45f9247
Call-ID: OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.
CSeq: 102 BYE
User-Agent: Asterisk PBX 1.8.11.0
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
[Oct 20 01:33:31] Scheduling destruction of SIP dialog 'OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.' in 120128 ms (Method: ACK)
[Oct 20 01:33:31]
<--- SIP read from TLS:192.168.100.14:5068 --->
SIP/2.0 200 OK
FROM: "device"<sip:3200@192.168.100.202:5068>;tag=as0420bf81
TO: <sip:+85225082162@lync-ENT.lync-demo.local:5068>;tag=59218fa047;epid=8E515F99D4
CSEQ: 103 BYE
CALL-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
VIA: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK71280805
CONTENT-LENGTH: 0
SERVER: RTCC/4.0.0.0 MediationServer

<------------->
[Oct 20 01:33:31] --- (8 headers 0 lines) ---
[Oct 20 01:33:31]
<--- SIP read from UDP:192.168.100.139:9446 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.100.202:5060;branch=z9hG4bK2d2bfc3a;rport=5060
Contact: <sip:3200@192.168.100.139:9446;transport=udp>
To: "3200"<sip:3200@192.168.100.202>;tag=f45f9247
From: "a a"<sip:9+85225082162@192.168.100.202>;tag=as73e9d75d
Call-ID: OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.
CSeq: 102 BYE
User-Agent: eyeBeam release 1100z stamp 47739
Content-Length: 0

<------------->
[Oct 20 01:33:31] --- (9 headers 0 lines) ---
[Oct 20 01:33:31] SIP Response message for INCOMING dialog BYE arrived
[Oct 20 01:33:31] Really destroying SIP dialog 'OTA0MDMxMGYxNzNmNDU2ZDZhMDllZGZhOTc1MzJmZTM.' Method: ACK
[Oct 20 01:33:31] Really destroying SIP dialog '5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068' Method: INVITE
[Oct 20 01:33:31]
<--- SIP read from TLS:192.168.100.14:5068 --->
SIP/2.0 481 Call Leg/Transaction Does Not Exist
FROM: "device"<sip:3200@192.168.100.202:5068>;tag=as0420bf81
TO: <sip:+85225082162@lync-ENT.lync-demo.local:5068>;tag=59218fa047
CSEQ: 104 BYE
CALL-ID: 5807aca52f1a12b64e77473d0c30277c@192.168.100.202:5068
VIA: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK303f67a9
CONTENT-LENGTH: 0
SERVER: RTCC/4.0.0.0 MediationServer

<------------->
[Oct 20 01:33:31] --- (8 headers 0 lines) ---
[Oct 20 01:34:17]
<--- SIP read from UDP:192.168.100.139:9446 --->
REGISTER sip:192.168.100.202 SIP/2.0
Via: SIP/2.0/UDP 192.168.100.139:9446;branch=z9hG4bK-d8754z-e926025c0d4b0c2c-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:3200@192.168.100.139:9446;rinstance=db6cf8cddc12b351;transport=udp>;expires=0
To: "3200"<sip:3200@192.168.100.202>
From: "3200"<sip:3200@192.168.100.202>;tag=486eb323
Call-ID: N2NlMWFlYmQ2ZGE1MzcwMTRiNmRiM2VhZjdiYjk2ZjI.
CSeq: 2 REGISTER
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: eyeBeam release 1100z stamp 47739
Content-Length: 0

<------------->
[Oct 20 01:34:17] --- (11 headers 0 lines) ---
[Oct 20 01:34:17] Sending to 192.168.100.139:9446 (NAT)
[Oct 20 01:34:17]     -- Unregistered SIP '3200'
[Oct 20 01:34:17]
<--- Transmitting (no NAT) to 192.168.100.139:9446 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.100.139:9446;branch=z9hG4bK-d8754z-e926025c0d4b0c2c-1---d8754z-;received=192.168.100.139;rport=9446
From: "3200"<sip:3200@192.168.100.202>;tag=486eb323
To: "3200"<sip:3200@192.168.100.202>;tag=as5f7ea9e8
Call-ID: N2NlMWFlYmQ2ZGE1MzcwMTRiNmRiM2VhZjdiYjk2ZjI.
CSeq: 2 REGISTER
Server: Asterisk PBX 1.8.11.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Expires: 0
Date: Fri, 19 Oct 2012 17:34:17 GMT
Content-Length: 0


<------------>
[Oct 20 01:34:17] Scheduling destruction of SIP dialog 'N2NlMWFlYmQ2ZGE1MzcwMTRiNmRiM2VhZjdiYjk2ZjI.' in 32000 ms (Method: REGISTER)
[Oct 20 01:34:18]
<--- SIP read from TLS:192.168.100.14:63004 --->
NEGOTIATE sip:127.0.0.1:5061 SIP/2.0
FROM: <sip:LYNC-ENT.LYNC-demo.local>
TO: <sip:elastix23.lync-demo.local>
CSEQ: 1 NEGOTIATE
CALL-ID: 4f444c61a8b9413a803abf72623101b7
MAX-FORWARDS: 0
VIA: SIP/2.0/TLS 192.168.100.14:63004
CONTENT-LENGTH: 0
SUPPORTED: NewNegotiate
SUPPORTED: ECC
REQUIRE: ms-feature-info
SERVER: RTC/4.0

<------------->
[Oct 20 01:34:18] --- (12 headers 0 lines) ---
[Oct 20 01:34:25] Reliably Transmitting (no NAT) to 192.168.100.14:5068:
OPTIONS sip:lync-ENT.lync-demo.local SIP/2.0
Via: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK3bfc1a5b
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.100.202:5068>;tag=as1bfb7580
To: <sip:lync-ENT.lync-demo.local>
Contact: <sip:asterisk@192.168.100.202:5068;transport=TLS>
Call-ID: 0bba540c5cc0f0313fcfa8244bb5d159@192.168.100.202:5068
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.11.0
Date: Fri, 19 Oct 2012 17:34:25 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


---
[Oct 20 01:34:25]
<--- SIP read from TLS:192.168.100.14:5068 --->
SIP/2.0 200 OK
FROM: "asterisk"<sip:asterisk@192.168.100.202:5068>;tag=as1bfb7580
TO: <sip:lync-ENT.lync-demo.local>;tag=7443e03eda
CSEQ: 102 OPTIONS
CALL-ID: 0bba540c5cc0f0313fcfa8244bb5d159@192.168.100.202:5068
VIA: SIP/2.0/TLS 192.168.100.202:5068;branch=z9hG4bK3bfc1a5b
ACCEPT: application/sdp
CONTENT-LENGTH: 0
ACCEPT-ENCODING: gzip
ACCEPT-LANGUAGE: en
ALLOW: NOTIFY
ALLOW: BENOTIFY
SERVER: RTCC/4.0.0.0 MediationServer

<------------->
[Oct 20 01:34:25] --- (13 headers 0 lines) ---
[Oct 20 01:34:26] Really destroying SIP dialog '0bba540c5cc0f0313fcfa8244bb5d159@192.168.100.202:5068' Method: OPTIONS
[Oct 20 01:34:48]
<--- SIP read from TLS:192.168.100.14:63013 --->
NEGOTIATE sip:127.0.0.1:5061 SIP/2.0
FROM: <sip:LYNC-ENT.LYNC-demo.local>
TO: <sip:elastix23.lync-demo.local>
CSEQ: 1 NEGOTIATE
CALL-ID: 920cbf268ec34e4190d0ad0d73c78388
MAX-FORWARDS: 0
VIA: SIP/2.0/TLS 192.168.100.14:63013
CONTENT-LENGTH: 0
SUPPORTED: NewNegotiate
SUPPORTED: ECC
REQUIRE: ms-feature-info
SERVER: RTC/4.0

<------------->
[Oct 20 01:34:48] --- (12 headers 0 lines) ---
[Oct 20 01:34:49] Really destroying SIP dialog 'N2NlMWFlYmQ2ZGE1MzcwMTRiNmRiM2VhZjdiYjk2ZjI.' Method: REGISTER
elastix23*CLI>

Lync is behaving as though it received a duplicate BYE, but Asterisk only seems to be sending one. Lync or router problem, I think.

why there is dup bye to Lync , the call is not hangup by softphone , it is drop automatically.
Not the user want … please advice …

I can’t find a duplicate BYE. What I said is that Lync is behaving as though it received a second BYE after a first one already cleared the call. Even that is not strictly true, as I think it should have responded OK, unless the duplicate was very late.

The BYE immediately follows the OK for the INVITE, which suggests that something unacceptable was negotiated, too late to reject the call. You could try turning on core debugging, and see if that reports a reason.

No… there is no error in lync side .The trace is already open by "sip set debug on ".
Please advice any setting wrong or not ???

sip set debug on doesn’t turn on all the debugging in chan_sip. You need to do core set debug 5 (or higher) before you have enough information for a bug report.

There appears to be an OK followed by an error for the same BYE. Unless you can find an other BYE being sent by Asterisk, there has to be something wrong outside Asterisk.

The normal reason for a BYE immediately following an OK is that the OK resulted in an unsupportable codec combination. That doesn’t seem to be the case here, so I would guess that the encryption options aren’t supported. That still doesn’t explain why you get an error final response after the OK final response has been sent. Unless I’ve missed a BYE, that is a protocol error.

I solve it by my self .
I find the call is drop when I use TLS for control and rtp encrytion .
That mean use TLS amd SRTP and connect to lync server .
The control signal TLS is ok but when SRTP is establish ,there is a field lifetime from lync server and
asterisk check there is this field and prompt “lifetime field not support " and " not accpetable” in full log .
I find there is patch for this in internet and I also change the src code in sdp_crypto.c in dir /usr/src/asterisk-1.8.11.0/channels/sip .YOu only need to comment out one “contine” statement and recopmile the src code again.I use asterisk 1.8.11 and recomiple the chan_sip.so again .
Then it work the TLS and SRTP to lync server is ok and the call can establish without drop amymore … Hope this can share with other …