title: CANCEL request from Android SIP demo ignored by Asterisk 1.8
body: <p>I am facing a strange problem when using the standard Android SIP Demo in combination with an asterisk 1.8.9.2 server: incoming / outgoing calls are working correctly, but there is one thing not working: when I launch a call from the SIP demo and I close the call again (hitting the "End current call" button), the call is terminated in the SIP demo, but the called device still keeps ringing.</p>
  
  <p>I have tried to check what's happening by logging the telegrams via Wireshark and it seems that the CANCEL telegram from the SIP demo to the asterisk server is not accepted, take a look:</p>
  
  <pre><code>300 08:30:39.483913 130.10.0.102    192.168.0.110   SIP/SDP 916 Request: INVITE sip:110@192.168.0.110:5060, with session description
  301 08:30:39.488686 192.168.0.110   130.10.0.102    SIP 525 Status: 100 Trying
  302 08:30:39.524884 192.168.0.110   130.10.0.102    SIP 541 Status: 180 Ringing
  309 08:30:41.041071 130.10.0.102    192.168.0.110   SIP 370 Request: CANCEL sip:110@192.168.0.110:5060
  310 08:30:41.051545 192.168.0.110   130.10.0.102    SIP 526 Status: 481 Call/Transaction Does Not Exist
  </code></pre>
  
  <p>And now the real strange thing: If I repeat the same action, and before terminating the call through the "End current call" button I wait for ca. 7 seconds, the CANCEL is accepted and the call is terminated correctly:</p>
  
  <pre><code>646 08:31:05.571464 130.10.0.102    192.168.0.110   SIP/SDP 916 Request: INVITE sip:110@192.168.0.110:5060, with session description
  647 08:31:05.576150 192.168.0.110   130.10.0.102    SIP 525 Status: 100 Trying
  648 08:31:05.662345 192.168.0.110   130.10.0.102    SIP 541 Status: 180 Ringing
  664 08:31:08.302561 130.10.0.102    192.168.0.110   SIP 389 Request: OPTIONS sip:192.168.0.110
  665 08:31:08.312097 192.168.0.110   130.10.0.102    SIP 528 Status: 404 Not Found
  698 08:31:13.370346 130.10.0.102    192.168.0.110   SIP 370 Request: CANCEL sip:110@192.168.0.110:5060
  699 08:31:13.373570 192.168.0.110   130.10.0.102    SIP 513 Status: 487 Request Terminated
  700 08:31:13.373912 192.168.0.110   130.10.0.102    SIP 497 Status: 200 OK
  </code></pre>
  
  <p>I have checked the contents of both CANCEL requests, and the structure is completely the same!
  Furthermore I have also tested a server with asterisk 1.6 and there I did NOT encounter this problem, the call is terminated correctly there!
  So it makes me believe that it has to do something with asterisk vers. 1.8.</p>
  
  <p>Did anyone encounter similar problems and has some helpful hints for me? If further data is needed for analysis, just let me know!
  Thanks for your help,
  BR</p>
  
  <p>Armin</p>