[reSIProcate] Problems with Cancel
Hello DUM team,
I have included a trace below of an Invite I tried to cancel. The
problem I am seeing is that DUM does not generate proper CANCEL
messages. According to 3261
(Section 9.1.)
... The Request-URI, Call-ID, To, the numeric part of CSeq,
and From header fields in the CANCEL request MUST be identical
to those in the request being canceled, including tags.....
However, from the trace below the CANCEL uri is not the same as the
INVITE uri. The is because the ClientInviteSession::end() method results
in the Dialog::makeRequest(...) method being called. The
Dialog::makeRequest(...) method sets the uri to the mTarget uri (which
is different from the initial request uri). In order to fix the problem
you can change the ClientInviteSession::end() method to the following:
case Initial:
{
// store the uri of the initial request
SipMessage temp_req = mLastRequest;
mDialog.makeCancel(mLastRequest);
//!dcm! -- it could be argued that this(and similar) should
happen in send so users
//can't toast themselves
mLastRequest.header(h_RequestLine).uri()=
temp_req.header(h_RequestLine).uri();
mState = Cancelled;
return mLastRequest;
}
Brian
===========================================
Trace of call:
This is the initial invite:
Frame 17 (794 bytes on wire, 794 bytes captured)
Ethernet II, Src: 00:50:8d:e3:90:34, Dst: 00:01:03:a7:0f:e6
Internet Protocol, Src Addr: 192.168.2.22 (192.168.2.22), Dst Addr:
65.39.205.114 (65.39.205.114)
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 5082 (5082)
Session Initiation Protocol
Request line: INVITE sip:613@xxxxxxxxxxxxxx SIP/2.0
Message Header
To: <sip:613@xxxxxxxxxxxxxx>
From: 52017 <sip:52017@xxxxxxxxxxxxxx>;tag=2ce3d468
Via: SIP/2.0/UDP
192.168.2.22:5060;branch=z9hG4bK-c87542-814710613-1--c87542-;rport
Call-ID: bdac3f0e6963197c
CSeq: 2 INVITE
Contact: <sip:52017@xxxxxxxxxxxx:5060>
Max-Forwards: 70
Content-Type: application/sdp
Proxy-Authorization: Digest
username=52017,realm="fwd.pulver.com",nonce="40f028e4e43e17f654c45a376ff44c341fbbc4d9",uri="sip:613@xxxxxxxxxxxxxx",response="0590eaf4277ecca8e52c2ecfa937115c",algorithm=MD5
Content-Length: 187
Session Description Protocol
This is the response (the contact field is stored as the target contact
for further requests).
Frame 19 (473 bytes on wire, 473 bytes captured)
Ethernet II, Src: 00:01:03:a7:0f:e6, Dst: 00:50:8d:e3:90:34
Internet Protocol, Src Addr: 65.39.205.114 (65.39.205.114), Dst Addr:
192.168.2.22 (192.168.2.22)
User Datagram Protocol, Src Port: 5082 (5082), Dst Port: 5060 (5060)
Session Initiation Protocol
Status line: SIP/2.0 180 Ringing
Message Header
Via: SIP/2.0/UDP
192.168.2.22:5060;branch=z9hG4bK-c87542-814710613-1--c87542-;rport
From: 52017 <sip:52017@xxxxxxxxxxxxxx>;tag=2ce3d468
To: <sip:613@xxxxxxxxxxxxxx>;tag=as5cac4557
Call-ID: bdac3f0e6963197c
CSeq: 2 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:613@xxxxxxxxxxxx:5028>
Record-Route: <sip:PPC976216@xxxxxxxxxxxxx:5082>
Content-Length: 0
This is the Cancel generated (the uri in the request line is wrong):
Frame 20 (577 bytes on wire, 577 bytes captured)
Ethernet II, Src: 00:50:8d:e3:90:34, Dst: 00:01:03:a7:0f:e6
Internet Protocol, Src Addr: 192.168.2.22 (192.168.2.22), Dst Addr:
65.39.205.114 (65.39.205.114)
User Datagram Protocol, Src Port: 5060 (5060), Dst Port: 5082 (5082)
Session Initiation Protocol
Request line: CANCEL sip:613@xxxxxxxxxxxx:5028 SIP/2.0
Message Header
To: <sip:613@xxxxxxxxxxxxxx>
From: 52017 <sip:52017@xxxxxxxxxxxxxx>;tag=2ce3d468
Via: SIP/2.0/UDP
192.168.2.22:5060;branch=z9hG4bK-c87542-814710613-1--c87542-;rport
Call-ID: bdac3f0e6963197c
CSeq: 2 CANCEL
Contact: <sip:52017@xxxxxxxxxxxx:5060>
Max-Forwards: 70
Proxy-Authorization: Digest
username=52017,realm="fwd.pulver.com",nonce="40f028e4e43e17f654c45a376ff44c341fbbc4d9",uri="sip:613@xxxxxxxxxxxxxx",response="0590eaf4277ecca8e52c2ecfa937115c",algorithm=MD5
Content-Length: 0