<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-ligatures:standardcontextual;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Some background…<o:p></o:p></p>
<p class="MsoNormal">We use AMI and AsyncAGI to be able to receive events about calls (and other Asterisk details) and control it from our application.<o:p></o:p></p>
<p class="MsoNormal">Works great and have about 100 sites (some newer, some older) without issues.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I was notified this morning about a customer who had something strange happen and I can’t explain it.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Asterisk 16.23.0 and PJSIP.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Call comes into Asterisk.<o:p></o:p></p>
<p class="MsoNormal">Asterisk sends the Trying.<o:p></o:p></p>
<p class="MsoNormal">Via AMI, notified of the call and dial plan has it go to AsyncAGI for our application to be able to control the call.<o:p></o:p></p>
<p class="MsoNormal">Via AMI, we tell Asterisk to Answer.<o:p></o:p></p>
<p class="MsoNormal">Asterisk processes it and indicates it was answered.<o:p></o:p></p>
<p class="MsoNormal">The Asterisk AMI/AGI indicates call was answered successfully, call state is Up, etc.<o:p></o:p></p>
<p class="MsoNormal">Everything appears to be normal.<o:p></o:p></p>
<p class="MsoNormal">We perform various actions on the call, example play a file, music, tones, etc.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">However, Asterisk never sent the 200 OK to answer the call.<o:p></o:p></p>
<p class="MsoNormal">Seems as though Asterisk is in a bizarre state where it thinks it is handling the call, but it really isn’t. 
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Reports are this happened to several calls.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Eventually, they restarted the entire VM and everything started working well.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We think this may be caused by something their switch is doing.<o:p></o:p></p>
<p class="MsoNormal">Through the grapevine, heard they had some network issue but don’t know the details of their switches and architecture for calls coming into Asterisk.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We noticed we are seeing two INVITEs happen with the same Call-ID, but 2 additional Record-Route header/value pairs and 3 additional Via header/value pairs.  At least in first glance, the rest seems to be the same.  I see Asterisk created
 two different PJSIP calls for each despite same Call-ID, but I am guessing that’s because of the additional Via or Record-Route pairs.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is it possible multiple of these double INVITEs could cause Asterisk or PJSIP on this older software to get into a bad state to cause the issues with AMI and Asterisk state?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Dan<o:p></o:p></p>
</div>
</body>
</html>