Would someone please take a look at this simple PHP event socket script and tell me what I am doing wrong - or tell me that this could be a bug elsewhere? Any help would be appreciated.
When I run the script without the call to execute(), everything seems fine. When I include the call to execute(), the calls to getType() return CUSTOM for a while, then later start to return the correct name. #!/usr/bin/php <?php require_once 'ESL.php'; $endPoint = 'sofia/internal/695%192.168.100.132'; $eventSocket = New ESLconnection('192.168.100.132', '8021', 'ClueCon'); $event = $eventSocket->events('plain', 'ALL'); // call endpoint, get uuid $event = $eventSocket->api('originate', $endPoint . ' &park'); $serializedEvent = explode("\n", $event->serialize()); foreach ($serializedEvent as $eventLine) { list($dummy, $uuid) = explode('+OK ', $eventLine); if ($uuid) { break; } } // play announcement to endpoint $event = $eventSocket->execute('playback', '/opt/ann/user-busy.wav', $uuid); // monitor events while (TRUE) { echo "getType: " . $event->getType() . "\n"; $serializedEvent = explode("\n", $event->serialize()); foreach ($serializedEvent as $eventLine) { list($header, $value) = explode(': ', $eventLine); if ($header == "Event-Name") { printf($eventLine . "\n"); } if ($header == "Content-Type") { printf($eventLine . "\n"); } } printf("\n"); $event = $eventSocket->recvEvent(); }?> Run without the call to execute(): ================================== getType: CUSTOM Content-Type: api/response getType: CHANNEL_CREATE Event-Name: CHANNEL_CREATE getType: CHANNEL_OUTGOING Event-Name: CHANNEL_OUTGOING getType: CHANNEL_ORIGINATE Event-Name: CHANNEL_ORIGINATE getType: CHANNEL_STATE Event-Name: CHANNEL_STATE getType: PRESENCE_IN Event-Name: PRESENCE_IN getType: CHANNEL_STATE Event-Name: CHANNEL_STATE getType: PRESENCE_IN Event-Name: PRESENCE_IN getType: CHANNEL_STATE Event-Name: CHANNEL_STATE getType: CALL_UPDATE Event-Name: CALL_UPDATE getType: CHANNEL_PROGRESS Event-Name: CHANNEL_PROGRESS getType: HEARTBEAT Event-Name: HEARTBEAT getType: HEARTBEAT Event-Name: RE_SCHEDULE getType: CALL_UPDATE Event-Name: CALL_UPDATE getType: CODEC Event-Name: CODEC getType: CODEC Event-Name: CODEC getType: CHANNEL_ANSWER Event-Name: CHANNEL_ANSWER getType: PRESENCE_IN Event-Name: PRESENCE_IN getType: API Event-Name: API getType: PRESENCE_IN Event-Name: PRESENCE_IN getType: CHANNEL_STATE Event-Name: CHANNEL_STATE getType: CHANNEL_EXECUTE Event-Name: CHANNEL_EXECUTE getType: CHANNEL_PARK Event-Name: CHANNEL_PARK getType: CHANNEL_HANGUP Event-Name: CHANNEL_HANGUP getType: CHANNEL_UNPARK Event-Name: CHANNEL_UNPARK getType: CHANNEL_EXECUTE_COMPLETE Event-Name: CHANNEL_EXECUTE_COMPLETE getType: PRESENCE_IN Event-Name: PRESENCE_IN getType: CHANNEL_STATE Event-Name: CHANNEL_STATE getType: PRESENCE_IN Event-Name: PRESENCE_IN getType: CHANNEL_HANGUP_COMPLETE Event-Name: CHANNEL_HANGUP_COMPLETE getType: CHANNEL_STATE Event-Name: CHANNEL_STATE getType: CHANNEL_DESTROY Event-Name: CHANNEL_DESTROY getType: CHANNEL_STATE Event-Name: CHANNEL_STATE Run with the call to execute(): =============================== getType: CUSTOM Content-Type: command/reply getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_CREATE getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_OUTGOING getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_ORIGINATE getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_STATE getType: CUSTOM Content-Type: text/event-plain Event-Name: PRESENCE_IN getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_STATE getType: CUSTOM Content-Type: text/event-plain Event-Name: PRESENCE_IN getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_STATE getType: CUSTOM Content-Type: text/event-plain Event-Name: CALL_UPDATE getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_PROGRESS getType: CUSTOM Content-Type: text/event-plain Event-Name: CALL_UPDATE getType: CUSTOM Content-Type: text/event-plain Event-Name: CODEC getType: CUSTOM Content-Type: text/event-plain Event-Name: CODEC getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_ANSWER getType: CUSTOM Content-Type: text/event-plain Event-Name: PRESENCE_IN getType: CUSTOM Content-Type: text/event-plain Event-Name: API getType: CUSTOM Content-Type: text/event-plain Event-Name: PRESENCE_IN getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_STATE getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_EXECUTE getType: CUSTOM Content-Type: text/event-plain Event-Name: CHANNEL_PARK getType: CHANNEL_EXECUTE Event-Name: CHANNEL_EXECUTE getType: CHANNEL_HANGUP Event-Name: CHANNEL_HANGUP getType: CHANNEL_EXECUTE_COMPLETE Event-Name: CHANNEL_EXECUTE_COMPLETE getType: COMMAND Event-Name: COMMAND getType: CHANNEL_UNPARK Event-Name: CHANNEL_UNPARK getType: CHANNEL_EXECUTE_COMPLETE Event-Name: CHANNEL_EXECUTE_COMPLETE getType: PRESENCE_IN Event-Name: PRESENCE_IN getType: CHANNEL_STATE Event-Name: CHANNEL_STATE getType: PRESENCE_IN Event-Name: PRESENCE_IN getType: CHANNEL_HANGUP_COMPLETE Event-Name: CHANNEL_HANGUP_COMPLETE getType: CHANNEL_STATE Event-Name: CHANNEL_STATE getType: CHANNEL_DESTROY Event-Name: CHANNEL_DESTROY getType: CHANNEL_STATE Event-Name: CHANNEL_STATE Thanks, Ron _______________________________________________ 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