title: SIPp: Cancel scenario 487 before 200
body: <p>I'm trying to simulate how to deal when 487 comes before 200 in cancel scenario. But i get "Aborting call on unexpected message for Call-Id while sending (index 5), received 'ACK sip:service@192.168.1.20:5060 SIP/2.0" error.
  this is my server.
  
      </p>
  
  <pre><code>&lt;scenario name="Basic UAS responder"&gt;
  
  &lt;recv request="INVITE" crlf="true"&gt;
  &lt;/recv&gt;
  &lt;send&gt;
  &lt;![CDATA[
  
      SIP/2.0 100 Trying
      [last_Via:]
      [last_From:]
      [last_To:]
      [last_Call-ID:]
      [last_CSeq:]
      Contact: &lt;sip:[local_ip]:[local_port];transport=[transport]&gt;
      Content-Length: [len]
  
  ]]&gt;
  &lt;/send&gt;
  &lt;send&gt;
  &lt;![CDATA[
  
      SIP/2.0 180 Ringing
      [last_Via:]
      [last_From:]
      [last_To:];tag=[call_number]
      [last_Call-ID:]
      [last_CSeq:]
      Contact: &lt;sip:[local_ip]:[local_port];transport=[transport]&gt;
      Content-Length: [len]
  
  ]]&gt;
  &lt;/send&gt;
  
  &lt;recv request="CANCEL"&gt;
  &lt;/recv&gt;
  &lt;send&gt;
  &lt;![CDATA[
  
      SIP/2.0 487 Request Terminated
      [last_Via:]
      [last_From:]
      [last_To:]
      [last_Call-ID:]
      CSeq: [cseq] INVITE
      Contact: &lt;sip:[local_ip]:[local_port];transport=[transport]&gt;
      Content-Length: [len]
  
  ]]&gt;
  &lt;/send&gt;
  
  &lt;send&gt;
  &lt;![CDATA[
  
      SIP/2.0 200 OK
      [last_Via:]
      [last_From:]
      [last_To:]
      [last_Call-ID:]
      [last_CSeq:]
      Contact: &lt;sip:[local_ip]:[local_port];transport=[transport]&gt;
      Content-Length: [len]
  
  ]]&gt;
  &lt;/send&gt;
  
  
  
  
  
  &lt;!--pause milliseconds="4000"/--&gt;
  &lt;recv request="ACK"
  crlf="true"&gt;
  &lt;/recv&gt;
  
  
  &lt;/scenario&gt;
  </code></pre>
  
  <p>this is my client</p>
  
  <p>
      </p>
  
  <pre><code>&lt;scenario name="UAC Cancel"&gt;
  
  &lt;send retrans="500"&gt;
  
  &lt;![CDATA[
  
      INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      To: &lt;sip:[service]@[remote_ip]:[remote_port]&gt;
      From: &lt;sip:sipp@[local_ip]:[local_port]; tag=[call_number]
      Call-ID: [call_id]
      CSeq: [cseq] INVITE
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Content-Length: [len]
  
  ]]&gt;
  &lt;/send&gt;
  
  &lt;recv response="100" optional="true"&gt;
  &lt;/recv&gt;
  
  &lt;recv response="180"&gt;
  &lt;/recv&gt;
  
  &lt;pause milliseconds="4000"/&gt;
  
  &lt;send&gt;
  &lt;![CDATA[
  
      CANCEL sip:[service]@[remote_ip]:[remote_port] SIP/2.0
      [last_Via:]
      To: sip:[service]@[local_ip]:[local_port]&gt;[peer_tag_param]
      From: sip:sipp@[local_ip]:[local_port];tag=[call_number]
      Call-ID: [call_id]
      [last_CSeq:]
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Content-length: [len]
  
  ]]&gt;
  &lt;/send&gt;
  
  &lt;recv response="200" optional="true"&gt;
  &lt;/recv&gt;
  
  &lt;recv response="487" next="cancelACK"&gt;
  &lt;/recv&gt;
  
  &lt;label id="cancelACK"/&gt;
  &lt;send&gt;
  &lt;![CDATA[
      ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
      [last_Via:]
      To: &lt;sip:[service]@[remote_ip]:[remote_port]&gt;[peer_tag_param]
      From: &lt;sip:sipp@[local_ip]:[local_port];tag=[call_number]
      Call-ID: [call_id]
      CSeq: [cseq] ACK
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Content-Length: [len]
  ]]&gt;
  &lt;/send&gt;
  &lt;pause milliseconds="3000"/&gt;
  
  &lt;/scenario&gt;
  </code></pre>