fix disconnect issue in event socket and fix a few small bugs

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11234 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2009-01-15 22:11:27 +00:00
parent 169ced2f93
commit 6f8e06f087
7 changed files with 147 additions and 82 deletions

View File

@@ -5,23 +5,24 @@
static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in addr)
{
esl_handle_t handle = {{0}};
if (fork()) {
close(client_sock);
return;
}
esl_attach_handle(&handle, client_sock, addr);
printf("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, "SESSION_HEARTBEAT CHANNEL_ANSWER CHANNEL_ORIGINATE CHANNEL_PROGRESS CHANNEL_HANGUP "
"CHANNEL_BRIDGE CHANNEL_UNBRIDGE CHANNEL_OUTGOING CHANNEL_EXECUTE CHANNEL_EXECUTE_COMPLETE DTMF CUSTOM conference::maintenance");
esl_execute(&handle, "answer", NULL, NULL);
esl_execute(&handle, "playback", "/ram/swimp.raw", NULL);
esl_execute(&handle, "conference", "3000@default", NULL);
sleep(30);
while(esl_recv(&handle) == ESL_SUCCESS);
esl_disconnect(&handle);
}