Can't receive CHANNEL_HANGUP_COMPLETE event when using mod_rtmp
Hi 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. Thanks. Code is as follows static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr) { esl_handle_t handle = {{0}}; int done = 0; esl_status_t status; time_t exp = 0; esl_attach_handle(&handle, client_sock, addr); esl_log(ESL_LOG_INFO, "Connected! %d\n", handle.sock); esl_filter(&handle, "unique-id", esl_event_get_header(handle.info_event, "caller-unique-id")); esl_events(&handle, ESL_EVENT_TYPE_PLAIN, "CHANNEL_HANGUP_COMPLETE DTMF CUSTOM"); esl_send_recv(&handle, "linger"); esl_execute(&handle, "set", "hangup_after_bridge=true", NULL); esl_execute(&handle, "bridge", "user/1001@192.168.1.128", NULL); int i=rand(); while((status = esl_recv_timed(&handle, 1000)) != ESL_FAIL) { printf("Thread:%d\n", i); if (done) { if (time(NULL) >= exp) { break; } } else if (status == ESL_SUCCESS) { const char *type = esl_event_get_header(handle.last_event, "content-type"); if (type && !strcasecmp(type, "text/disconnect-notice")) { const char *dispo = esl_event_get_header(handle.last_event, "content-disposition"); esl_log(ESL_LOG_INFO, "Got a disconnection notice dispostion: [%s]\n", dispo ? dispo : ""); if (dispo && !strcmp(dispo, "linger")) { done = 1; esl_log(ESL_LOG_INFO, "Waiting 5 seconds for any remaining events.\n"); exp = time(NULL) + 5; } } } } esl_log(ESL_LOG_INFO, "Disconnected! %d\n", handle.sock); esl_disconnect(&handle); }
chances are the calling side didn't hangup. what "show channels" tell you? What's your dialplan look like? -- Seven Du http://www.freeswitch.org.cn http://about.me/dujinfang http://www.dujinfang.com Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Monday, October 21, 2013 at 6:44 PM, 王永涛 wrote:
Hi 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.
Thanks.
Code is as follows
static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr) { esl_handle_t handle = {{0}}; int done = 0; esl_status_t status; time_t exp = 0;
esl_attach_handle(&handle, client_sock, addr);
esl_log(ESL_LOG_INFO, "Connected! %d\n", handle.sock);
esl_filter(&handle, "unique-id", esl_event_get_header(handle.info_event, "caller-unique-id")); esl_events(&handle, ESL_EVENT_TYPE_PLAIN, "CHANNEL_HANGUP_COMPLETE DTMF CUSTOM");
esl_send_recv(&handle, "linger");
esl_execute(&handle, "set", "hangup_after_bridge=true", NULL); esl_execute(&handle, "bridge", "user/1001@192.168.1.128 (mailto:1001@192.168.1.128)", NULL);
int i=rand(); while((status = esl_recv_timed(&handle, 1000)) != ESL_FAIL) { printf("Thread:%d\n", i); if (done) { if (time(NULL) >= exp) { break; } } else if (status == ESL_SUCCESS) { const char *type = esl_event_get_header(handle.last_event, "content-type"); if (type && !strcasecmp(type, "text/disconnect-notice")) { const char *dispo = esl_event_get_header(handle.last_event, "content-disposition"); esl_log(ESL_LOG_INFO, "Got a disconnection notice dispostion: [%s]\n", dispo ? dispo : ""); if (dispo && !strcmp(dispo, "linger")) { done = 1; esl_log(ESL_LOG_INFO, "Waiting 5 seconds for any remaining events.\n"); exp = time(NULL) + 5; } } } }
esl_log(ESL_LOG_INFO, "Disconnected! %d\n", handle.sock); esl_disconnect(&handle); }
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org (mailto:consulting@freeswitch.org) http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org (mailto:FreeSWITCH-users@lists.freeswitch.org) http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
freeswitch@wtosdev> show channels uuid,direction,created,created_epoch,name,state,cid_name,cid_num,ip_addr,dest,application,application_data,dialplan,context,read_codec,read_rate,read_bit_rate,write_codec,write_rate,write_bit_rate,secure,hostname,presence_id,presence_data,callstate,callee_name,callee_num,callee_direction,call_uuid,sent_callee_name,sent_callee_num 56eb412a-3ace-11e3-b62f-956876d28f28,inbound,2013-10-22 11:59:24,1382414364,sofia/internal/1000@192.168.1.128 ,CS_EXECUTE,1000,1000,192.168.1.6,1001,bridge,user/1001@192.168.1.128 ,XML,default,PCMU,8000,64000,PCMU,8000,64000,,wtosdev,1000@192.168.1.128,,ACTIVE,Outbound Call,1001,SEND,56eb412a-3ace-11e3-b62f-956876d28f28,Outbound Call,1001 freeswitch@wtosdev> show calls uuid,direction,created,created_epoch,name,state,cid_name,cid_num,ip_addr,dest,presence_id,presence_data,callstate,callee_name,callee_num,callee_direction,call_uuid,hostname,sent_callee_name,sent_callee_num,b_uuid,b_direction,b_created,b_created_epoch,b_name,b_state,b_cid_name,b_cid_num,b_ip_addr,b_dest,b_presence_id,b_presence_data,b_callstate,b_callee_name,b_callee_num,b_callee_direction,b_sent_callee_name,b_sent_callee_num,call_created_epoch 56eb412a-3ace-11e3-b62f-956876d28f28,inbound,2013-10-22 11:59:24,1382414364,sofia/internal/1000@192.168.1.128 ,CS_EXECUTE,1000,1000,192.168.1.6,1001,1000@192.168.1.128,,ACTIVE,Outbound Call,1001,SEND,56eb412a-3ace-11e3-b62f-956876d28f28,wtosdev,Outbound Call,1001,,,,,,,,,,,,,,,,,,, My Dialplan Like This <extension name="socket"> <condition field="destination_number" expression="^(10[01][0-9])$"> <action application="socket", data="192.168.1.128:8084 full async"/> </condition> </extension> 2013/10/22 Seven Du <dujinfang@gmail.com>
chances are the calling side didn't hangup. what "show channels" tell you? What's your dialplan look like?
-- Seven Du http://www.freeswitch.org.cn http://about.me/dujinfang http://www.dujinfang.com
Sent with Sparrow <http://www.sparrowmailapp.com/?sig>
On Monday, October 21, 2013 at 6:44 PM, 王永涛 wrote:
Hi 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.
Thanks.
Code is as follows
static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr) { esl_handle_t handle = {{0}}; int done = 0; esl_status_t status; time_t exp = 0;
esl_attach_handle(&handle, client_sock, addr);
esl_log(ESL_LOG_INFO, "Connected! %d\n", handle.sock);
esl_filter(&handle, "unique-id", esl_event_get_header(handle.info_event, "caller-unique-id")); esl_events(&handle, ESL_EVENT_TYPE_PLAIN, "CHANNEL_HANGUP_COMPLETE DTMF CUSTOM");
esl_send_recv(&handle, "linger");
esl_execute(&handle, "set", "hangup_after_bridge=true", NULL); esl_execute(&handle, "bridge", "user/1001@192.168.1.128", NULL);
int i=rand(); while((status = esl_recv_timed(&handle, 1000)) != ESL_FAIL) { printf("Thread:%d\n", i); if (done) { if (time(NULL) >= exp) { break; } } else if (status == ESL_SUCCESS) { const char *type = esl_event_get_header(handle.last_event, "content-type"); if (type && !strcasecmp(type, "text/disconnect-notice")) { const char *dispo = esl_event_get_header(handle.last_event, "content-disposition"); esl_log(ESL_LOG_INFO, "Got a disconnection notice dispostion: [%s]\n", dispo ? dispo : ""); if (dispo && !strcmp(dispo, "linger")) { done = 1; esl_log(ESL_LOG_INFO, "Waiting 5 seconds for any remaining events.\n"); exp = time(NULL) + 5; } } } }
esl_log(ESL_LOG_INFO, "Disconnected! %d\n", handle.sock); esl_disconnect(&handle); }
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Seven Du
-
王永涛