<div>
chances are the calling side didn't hangup. what "show channels" tell you? What's your dialplan look like?
</div>
<div><div><br></div><div>-- </div><div>Seven Du</div><div><span style="font-size: 10pt; ">http://www.freeswitch.org.cn</span></div><div>http://about.me/dujinfang</div><div><div>http://www.dujinfang.com</div></div><div><br></div><div>Sent with <a href="http://www.sparrowmailapp.com/?sig">Sparrow</a></div><div><br></div></div>
<p style="color: #A0A0A8;">On Monday, October 21, 2013 at 6:44 PM, 王永涛 wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div><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 style="white-space:pre">                </span>struct sockaddr_in *addr) {</div>
<div><span style="white-space:pre">        </span>esl_handle_t handle = {{0}};</div><div><span style="white-space:pre">        </span>int done = 0;</div><div><span style="white-space:pre">        </span>esl_status_t status;</div>
<div><span style="white-space:pre">        </span>time_t exp = 0;</div><div><br></div><div><span style="white-space:pre">        </span>esl_attach_handle(&handle, client_sock, addr);</div><div><br></div><div><span style="white-space:pre">        </span>esl_log(ESL_LOG_INFO, "Connected! %d\n", handle.sock);</div>
<div><br></div><div><span style="white-space:pre">        </span>esl_filter(&handle, "unique-id", esl_event_get_header(handle.info_event, "caller-unique-id"));</div><div><span style="white-space:pre">        </span>esl_events(&handle, ESL_EVENT_TYPE_PLAIN, "CHANNEL_HANGUP_COMPLETE DTMF CUSTOM");</div>
<div><br></div><div><span style="white-space:pre">        </span>esl_send_recv(&handle, "linger");</div><div><br></div><div><br></div><div><span style="white-space:pre">        </span>esl_execute(&handle, "set", "hangup_after_bridge=true", NULL);</div>
<div><span 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 style="white-space:pre">        </span>int i=rand();</div>
<div><span style="white-space:pre">        </span>while((status = esl_recv_timed(&handle, 1000)) != ESL_FAIL) {</div><div><span style="white-space:pre">                </span>printf("Thread:%d\n", i);</div><div>
<span style="white-space:pre">                </span>if (done) {</div><div><span style="white-space:pre">                        </span>if (time(NULL) >= exp) {</div><div><span style="white-space:pre">                                </span>break;</div><div>
<span style="white-space:pre">                        </span>}</div><div><span style="white-space:pre">                </span>} else if (status == ESL_SUCCESS) {</div><div><span style="white-space:pre">                        </span>const char *type = esl_event_get_header(handle.last_event, "content-type");</div>
<div><span style="white-space:pre">                        </span>if (type && !strcasecmp(type, "text/disconnect-notice")) {</div><div><span style="white-space:pre">                                </span>const char *dispo = esl_event_get_header(handle.last_event, "content-disposition");</div>
<div><span style="white-space:pre">                                </span>esl_log(ESL_LOG_INFO, "Got a disconnection notice dispostion: [%s]\n", dispo ? dispo : "");</div><div><span style="white-space:pre">                                </span>if (dispo && !strcmp(dispo, "linger")) {</div>
<div><span style="white-space:pre">                                        </span>done = 1;</div><div><span style="white-space:pre">                                        </span>esl_log(ESL_LOG_INFO, "Waiting 5 seconds for any remaining events.\n");</div><div><span style="white-space:pre">                                        </span>exp = time(NULL) + 5;</div>
<div><span style="white-space:pre">                                </span>}</div><div><span style="white-space:pre">                        </span>}</div><div><span style="white-space:pre">                </span>}</div><div><span style="white-space:pre">        </span>}</div>
<div><br></div><div><span style="white-space:pre">        </span>esl_log(ESL_LOG_INFO, "Disconnected! %d\n", handle.sock);</div><div><span style="white-space:pre">        </span>esl_disconnect(&handle);</div>
<div>}</div></div><div><br></div></div>
</div><div><div>_________________________________________________________________________</div><div>Professional FreeSWITCH Consulting Services:</div><div><a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a></div><div><a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a></div><div><br></div><div>FreeSWITCH-powered IP PBX: The CudaTel Communication Server</div><div><a href="http://www.cudatel.com">http://www.cudatel.com</a></div><div><br></div><div>Official FreeSWITCH Sites</div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div><div><a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a></div><div><a href="http://www.cluecon.com">http://www.cluecon.com</a></div><div><br></div><div>FreeSWITCH-users mailing list</div><div><a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a></div><div><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></div><div>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></div><div><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></div></div></div></span>
</blockquote>
<div>
<br>
</div>