<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'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(&handle, client_sock, addr);</div><div><br></div><div><span class="" style="white-space:pre">        </span>esl_log(ESL_LOG_INFO, "Connected! %d\n", handle.sock);</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>esl_filter(&handle, "unique-id", esl_event_get_header(handle.info_event, "caller-unique-id"));</div><div><span class="" style="white-space:pre">        </span>esl_events(&handle, ESL_EVENT_TYPE_PLAIN, "CHANNEL_HANGUP_COMPLETE DTMF CUSTOM");</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>esl_send_recv(&handle, "linger");</div><div><br></div><div><br></div><div><span class="" style="white-space:pre">        </span>esl_execute(&handle, "set", "hangup_after_bridge=true", NULL);</div>
<div><span class="" style="white-space:pre">        </span>esl_execute(&handle, "bridge", "user/<a href="mailto:1001@192.168.1.128">1001@192.168.1.128</a>", 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(&handle, 1000)) != ESL_FAIL) {</div><div><span class="" style="white-space:pre">                </span>printf("Thread:%d\n", i);</div><div>
<span class="" style="white-space:pre">                </span>if (done) {</div><div><span class="" style="white-space:pre">                        </span>if (time(NULL) >= 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, "content-type");</div>
<div><span class="" style="white-space:pre">                        </span>if (type && !strcasecmp(type, "text/disconnect-notice")) {</div><div><span class="" style="white-space:pre">                                </span>const char *dispo = esl_event_get_header(handle.last_event, "content-disposition");</div>
<div><span class="" style="white-space:pre">                                </span>esl_log(ESL_LOG_INFO, "Got a disconnection notice dispostion: [%s]\n", dispo ? dispo : "");</div><div><span class="" style="white-space:pre">                                </span>if (dispo && !strcmp(dispo, "linger")) {</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, "Waiting 5 seconds for any remaining events.\n");</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, "Disconnected! %d\n", handle.sock);</div><div><span class="" style="white-space:pre">        </span>esl_disconnect(&handle);</div>
<div>}</div></div><div><br></div></div>