<div dir="ltr">Hi<div><div>I made some changes on testserver.c. Then I call a sipnumber from the flex client to a x-lite client. When I hang up from the flex side, can receive CHANNEL_HANGUP_COMPLETE event loop can be ended. When I hang up from the x-lite  side, I can&#39;t receive CHANNEL_HANGUP_COMPLETE event and loop can not be ended, the variable status value is ESL_BREAK.</div>
<div><br></div><div>Thanks.</div><div><br></div><div>Code is as follows</div></div><div><br></div><div><div>static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock,</div><div><span class="" style="white-space:pre">                </span>struct sockaddr_in *addr) {</div>
<div><span class="" style="white-space:pre">        </span>esl_handle_t handle = {{0}};</div><div><span class="" style="white-space:pre">        </span>int done = 0;</div><div><span class="" style="white-space:pre">        </span>esl_status_t status;</div>
<div><span class="" style="white-space:pre">        </span>time_t exp = 0;</div><div><br></div><div><span class="" style="white-space:pre">        </span>esl_attach_handle(&amp;handle, client_sock, addr);</div><div><br></div><div><span class="" style="white-space:pre">        </span>esl_log(ESL_LOG_INFO, &quot;Connected! %d\n&quot;, handle.sock);</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>esl_filter(&amp;handle, &quot;unique-id&quot;, esl_event_get_header(handle.info_event, &quot;caller-unique-id&quot;));</div><div><span class="" style="white-space:pre">        </span>esl_events(&amp;handle, ESL_EVENT_TYPE_PLAIN, &quot;CHANNEL_HANGUP_COMPLETE DTMF CUSTOM&quot;);</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>esl_send_recv(&amp;handle, &quot;linger&quot;);</div><div><br></div><div><br></div><div><span class="" style="white-space:pre">        </span>esl_execute(&amp;handle, &quot;set&quot;, &quot;hangup_after_bridge=true&quot;, NULL);</div>
<div><span class="" style="white-space:pre">        </span>esl_execute(&amp;handle, &quot;bridge&quot;, &quot;user/<a href="mailto:1001@192.168.1.128">1001@192.168.1.128</a>&quot;, NULL);</div><div><br></div><div><span class="" style="white-space:pre">        </span>int i=rand();</div>
<div><span class="" style="white-space:pre">        </span>while((status = esl_recv_timed(&amp;handle, 1000)) != ESL_FAIL) {</div><div><span class="" style="white-space:pre">                </span>printf(&quot;Thread:%d\n&quot;, i);</div><div>
<span class="" style="white-space:pre">                </span>if (done) {</div><div><span class="" style="white-space:pre">                        </span>if (time(NULL) &gt;= exp) {</div><div><span class="" style="white-space:pre">                                </span>break;</div><div>
<span class="" style="white-space:pre">                        </span>}</div><div><span class="" style="white-space:pre">                </span>} else if (status == ESL_SUCCESS) {</div><div><span class="" style="white-space:pre">                        </span>const char *type = esl_event_get_header(handle.last_event, &quot;content-type&quot;);</div>
<div><span class="" style="white-space:pre">                        </span>if (type &amp;&amp; !strcasecmp(type, &quot;text/disconnect-notice&quot;)) {</div><div><span class="" style="white-space:pre">                                </span>const char *dispo = esl_event_get_header(handle.last_event, &quot;content-disposition&quot;);</div>
<div><span class="" style="white-space:pre">                                </span>esl_log(ESL_LOG_INFO, &quot;Got a disconnection notice dispostion: [%s]\n&quot;, dispo ? dispo : &quot;&quot;);</div><div><span class="" style="white-space:pre">                                </span>if (dispo &amp;&amp; !strcmp(dispo, &quot;linger&quot;)) {</div>
<div><span class="" style="white-space:pre">                                        </span>done = 1;</div><div><span class="" style="white-space:pre">                                        </span>esl_log(ESL_LOG_INFO, &quot;Waiting 5 seconds for any remaining events.\n&quot;);</div><div><span class="" style="white-space:pre">                                        </span>exp = time(NULL) + 5;</div>
<div><span class="" style="white-space:pre">                                </span>}</div><div><span class="" style="white-space:pre">                        </span>}</div><div><span class="" style="white-space:pre">                </span>}</div><div><span class="" style="white-space:pre">        </span>}</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>esl_log(ESL_LOG_INFO, &quot;Disconnected! %d\n&quot;, handle.sock);</div><div><span class="" style="white-space:pre">        </span>esl_disconnect(&amp;handle);</div>
<div>}</div></div><div><br></div></div>