<div dir="ltr">Hello all.<div>I am currently using Asterisk 11.7.0 (also tried Asterisk 12, but same behavior) and is having an issue when it comes to reINVITE on BYEs.</div><div>Apparently one of the SIP providers that I am using does not always process reINVITEs correctly, and would return a 500 Internal Server Error message on some (but not all) of these transactions.</div>

<div>To get around this issue, I have been using directrtpsetup = yes in my sip.conf, and it worked quite well. However, even with this option set, Asterisk would reINVITE itself back into the audio path as soon as the caller hangs up. The behavior I am seeing is that if the SIP provider sends back a 500 Internal Server Error on the reINVITE, Asterisk will not hang up the call until the called party hangs up. The transaction goes something like this:</div>

<div><br></div><div>1. Caller calls a number using a target SIP server.</div><div>2. -- Early Media --</div><div>3. Answer, -- Answering Machine --</div><div>4. Caller hangs up</div><div>5. Asterisk sends reINVITE to target SIP server back to itself</div>

<div>--- If SIP server returns 500 Internal Server Error, step 6 is never reached and the call stalls.</div><div>6. Asterisk sends a BYE to the target SIP server</div><div><br></div><div>This is what happens when the reINVITE proceeds normally, but if 500 Internal Server Error is returned on step 5, then Asterisk will only acknowledge the 500 Internal Server Error and never send back a BYE. As a result, the other parties are getting minutes of empty voicemail (due to timeout) and I am getting charged for these minutes on my provider.</div>

<div><br></div><div>With this in mind, is there something I can do so that a BYE is sent immediately to the SIP provider when the client initiates a hang up? I don't believe this can be done via some kind of setting, but maybe changing the source may help. I don't plan to have any dialplan rules execute after hangup so making this a global option would be okay in my case.</div>

<div><br></div><div>Anyone has any pointers?</div><div>Thanks!</div></div>