Hi,
I am experiencing problems with CANCEL after INVITE requests from a users private PBX (Mitel):
[Aug 29 16:55:22] ERROR[11139]: res_pjsip/pjsip_distributor.c:231 find_dialog: Could not find matching INVITE transaction for CANCEL request
INVITE:
22:23:45.64 ZGS_SIP: INVITE sip:015112345678@sip.example.com SIP/2.0
22:23:45.65 ZGS_SIP: Via: SIP/2.0/UDP 192.168.96.230:10670;branch=z9hG4bK11552_INVITE;rport
22:23:45.65 ZGS_SIP: From: <sip:sip329892@sip.example.com>;tag=9fxced2231sl
22:23:45.65 ZGS_SIP: To: <sip:015112345678@sip.example.com>
22:23:45.65 ZGS_SIP: Call-ID: 1346-0-1978-1998d58@csip
22:23:45.65 ZGS_SIP: CSeq: 11552 INVITE
22:23:45.65 ZGS_SIP: Contact: <sip:sip329892@123.123.123.123:10670;transport=udp> #123 -> Public IP
22:23:45.65 ZGS_SIP: P-preferred-identity: <sip:0221987654321@sip.example.com>
22:23:45.65 ZGS_SIP: Privacy: none
22:23:45.65 ZGS_SIP: Max-Forwards: 70
22:23:45.65 ZGS_SIP: User-Agent: OpenCom X320 (R 1.576.19.1 mitel-ocx)
22:23:45.65 ZGS_SIP: Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, INFO, REFER, NOTIFY, PRACK
22:23:45.65 ZGS_SIP: Content-Type: application/sdp
22:23:45.65 ZGS_SIP: Accept: application/sdp, multipart/mixed, application/vnd.etsi.pstn+xml, application/dtmf-relay
22:23:45.65 ZGS_SIP: Content-Length: 254
22:23:45.65 ZGS_SIP: v=0
22:23:45.65 ZGS_SIP: o=root 1472502230 1472502230 IN IP4 192.168.96.230
22:23:45.66 ZGS_SIP: s=session
22:23:45.66 ZGS_SIP: c=IN IP4 192.168.96.230
22:23:45.66 ZGS_SIP: t=0 0
22:23:45.66 ZGS_SIP: m=audio 44104 RTP/AVP 8 101
22:23:45.66 ZGS_SIP: a=rtpmap:8 PCMA/8000
22:23:45.66 ZGS_SIP: a=rtpmap:101 telephone-event/8000
22:23:45.66 ZGS_SIP: a=fmtp:101 0-15
22:23:45.66 ZGS_SIP: a=ptime:20
22:23:45.66 ZGS_SIP: a=silenceSupp:off - - - -
22:23:45.66 ZGS_SIP: a=sendrecv
Asterisk sends 183 Session Progress.
–> Hang up phone.
CANCEL:
22:24:22.44 ZGS_SIP: CANCEL sip:015112345678@sip.example.com SIP/2.0
22:24:22.44 ZGS_SIP: Via: SIP/2.0/UDP 192.168.96.230:10670;branch=z9hG4bK11553_INVITE;rport
22:24:22.44 ZGS_SIP: From: <sip:sip329892@sip.example.com>;tag=9fxced2231sl
22:24:22.44 ZGS_SIP: To: <sip:015112345678@sip.example.com>
22:24:22.44 ZGS_SIP: Call-ID: 1346-0-1978-1998d58@csip
22:24:22.44 ZGS_SIP: CSeq: 11553 CANCEL
22:24:22.44 ZGS_SIP: Contact: <sip:sip329892@123.123.123.123:10670;transport=udp>
22:24:22.44 ZGS_SIP: Authorization: XXXXXXXXXXXXX
22:24:22.44 ZGS_SIP: Max-Forwards: 70
22:24:22.44 ZGS_SIP: User-Agent: OpenCom X320 (R 1.576.19.1 mitel-ocx)
22:24:22.44 ZGS_SIP: Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, INFO, REFER, NOTIFY, PRACK
22:24:22.45 ZGS_SIP: Content-Length: 0
Response from Asterisk (481):
22:24:22.51 ZGS_SIP: SIP/2.0 481 Call/Transaction Does Not Exist
22:24:22.51 ZGS_SIP: Via: SIP/2.0/UDP 192.168.96.230:10670;rport=10670;received=123.123.123.123;branch=z9hG4bK11553_INVITE
22:24:22.51 ZGS_SIP: Call-ID: 1346-0-1978-1998d58@csip
22:24:22.51 ZGS_SIP: From: <sip:sip329892@sip.example.com>;tag=9fxced2231sl
22:24:22.51 ZGS_SIP: To: <sip:015112345678@sip.example.com>;tag=z9hG4bK11553_INVITE
22:24:22.52 ZGS_SIP: CSeq: 11553 CANCEL
22:24:22.52 ZGS_SIP: Server: Asterisk PBX 13.10.0
22:24:22.52 ZGS_SIP: Content-Length: 0
I don’t see any mistakes in the CANCEL request. The mitel PBX just finishes the call but the backbone is still calling which results in silence when the call is taken.
I have tested Asterisk 13.8-cert1, cert2 and 13.10 with PJSIP. Problem only occours with mitel PBXs. I just checked with X-Lite and Phoner and both can successfully end the call with CANCEL.
So, what is the problem? 

