What you are missing is that you are parsing the results incorrectly.<br><br>The events that are showing up as CUSTOM only do so because the id of CUSTOM is 0<br>there are no types in the events received with recvEvent the are only used for transport.<br>
<br>When you say &quot;events plain all&quot;<br><br>you are asking for events to be delivered, the FS events are not the same as the events you are using<br>to communicate at the lowest level.<br><br>What you should be doing is checking for content-type of text/event-plain <br>
and then and only then, get the payload with getBody.<br>This will contain a serialized event in it&#39;s entirety from FS.<br><br>for clarity sake I have added a new event SOCKET_DATA to tree and from now on you will<br>
see those low level events with that type.<br><br><br><br><div class="gmail_quote">On Sat, Jan 2, 2010 at 12:08 PM, Alberto Escudero <span dir="ltr">&lt;<a href="mailto:aep.lists@it46.se">aep.lists@it46.se</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I do not know if really helps you but we are facing the same problem in<br>
one of our implementations using the ESL.so for PHP.<br>
<br>
We have only see this problem when subscribing to the CHANNEL_STATE<br>
<br>
getType() should always match EventName... but it does not<br>
./aep<br>
<font color="#888888"><br>
--<br>
Stopping junk mailers is good for the environment<br>
</font><div><div></div><div class="h5"><br>
&gt; Would someone please take a look at this simple PHP event socket script<br>
&gt; and<br>
&gt; tell me what I am doing wrong - or tell me that this could be a bug<br>
&gt; elsewhere?  Any help would be appreciated.<br>
&gt;<br>
&gt; When I run the script without the call to execute(), everything seems<br>
&gt; fine.<br>
&gt; When I include the call to execute(), the calls to getType() return CUSTOM<br>
&gt; for a while, then later start to return the correct name.<br>
&gt;<br>
&gt; #!/usr/bin/php<br>
&gt; &lt;?php<br>
&gt; require_once &#39;ESL.php&#39;;<br>
&gt; $endPoint = &#39;sofia/internal/695%192.168.100.132&#39;;<br>
&gt;<br>
&gt; $eventSocket = New ESLconnection(&#39;192.168.100.132&#39;, &#39;8021&#39;, &#39;ClueCon&#39;);<br>
&gt; $event = $eventSocket-&gt;events(&#39;plain&#39;, &#39;ALL&#39;);<br>
&gt;<br>
&gt; // call endpoint, get uuid<br>
&gt; $event = $eventSocket-&gt;api(&#39;originate&#39;, $endPoint . &#39; &amp;park&#39;);<br>
&gt; $serializedEvent = explode(&quot;\n&quot;, $event-&gt;serialize());<br>
&gt; foreach ($serializedEvent as $eventLine) {<br>
&gt;     list($dummy, $uuid) = explode(&#39;+OK &#39;, $eventLine);<br>
&gt;     if ($uuid) { break; }<br>
&gt; }<br>
&gt;<br>
&gt; // play announcement to endpoint<br>
&gt; $event = $eventSocket-&gt;execute(&#39;playback&#39;, &#39;/opt/ann/user-busy.wav&#39;,<br>
&gt; $uuid);<br>
&gt;<br>
&gt; // monitor events<br>
&gt; while (TRUE) {<br>
&gt;     echo &quot;getType: &quot; . $event-&gt;getType() . &quot;\n&quot;;<br>
&gt;     $serializedEvent = explode(&quot;\n&quot;, $event-&gt;serialize());<br>
&gt;     foreach ($serializedEvent as $eventLine) {<br>
&gt;         list($header, $value) = explode(&#39;: &#39;, $eventLine);<br>
&gt;         if ($header == &quot;Event-Name&quot;)   { printf($eventLine . &quot;\n&quot;); }<br>
&gt;         if ($header == &quot;Content-Type&quot;) { printf($eventLine . &quot;\n&quot;); }<br>
&gt;     }<br>
&gt;<br>
&gt;       printf(&quot;\n&quot;);<br>
&gt;     $event = $eventSocket-&gt;recvEvent();<br>
&gt; }?&gt;<br>
&gt;<br>
&gt;<br>
&gt; Run without the call to execute():<br>
&gt; ==================================<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: api/response<br>
&gt;<br>
&gt; getType: CHANNEL_CREATE<br>
&gt; Event-Name: CHANNEL_CREATE<br>
&gt;<br>
&gt; getType: CHANNEL_OUTGOING<br>
&gt; Event-Name: CHANNEL_OUTGOING<br>
&gt;<br>
&gt; getType: CHANNEL_ORIGINATE<br>
&gt; Event-Name: CHANNEL_ORIGINATE<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: PRESENCE_IN<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: PRESENCE_IN<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: CALL_UPDATE<br>
&gt; Event-Name: CALL_UPDATE<br>
&gt;<br>
&gt; getType: CHANNEL_PROGRESS<br>
&gt; Event-Name: CHANNEL_PROGRESS<br>
&gt;<br>
&gt; getType: HEARTBEAT<br>
&gt; Event-Name: HEARTBEAT<br>
&gt;<br>
&gt; getType: HEARTBEAT<br>
&gt; Event-Name: RE_SCHEDULE<br>
&gt;<br>
&gt; getType: CALL_UPDATE<br>
&gt; Event-Name: CALL_UPDATE<br>
&gt;<br>
&gt; getType: CODEC<br>
&gt; Event-Name: CODEC<br>
&gt;<br>
&gt; getType: CODEC<br>
&gt; Event-Name: CODEC<br>
&gt;<br>
&gt; getType: CHANNEL_ANSWER<br>
&gt; Event-Name: CHANNEL_ANSWER<br>
&gt;<br>
&gt; getType: PRESENCE_IN<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: API<br>
&gt; Event-Name: API<br>
&gt;<br>
&gt; getType: PRESENCE_IN<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: CHANNEL_EXECUTE<br>
&gt; Event-Name: CHANNEL_EXECUTE<br>
&gt;<br>
&gt; getType: CHANNEL_PARK<br>
&gt; Event-Name: CHANNEL_PARK<br>
&gt;<br>
&gt; getType: CHANNEL_HANGUP<br>
&gt; Event-Name: CHANNEL_HANGUP<br>
&gt;<br>
&gt; getType: CHANNEL_UNPARK<br>
&gt; Event-Name: CHANNEL_UNPARK<br>
&gt;<br>
&gt; getType: CHANNEL_EXECUTE_COMPLETE<br>
&gt; Event-Name: CHANNEL_EXECUTE_COMPLETE<br>
&gt;<br>
&gt; getType: PRESENCE_IN<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: PRESENCE_IN<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CHANNEL_HANGUP_COMPLETE<br>
&gt; Event-Name: CHANNEL_HANGUP_COMPLETE<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: CHANNEL_DESTROY<br>
&gt; Event-Name: CHANNEL_DESTROY<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt;<br>
&gt; Run with the call to execute():<br>
&gt; ===============================<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: command/reply<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_CREATE<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_OUTGOING<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_ORIGINATE<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CALL_UPDATE<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_PROGRESS<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CALL_UPDATE<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CODEC<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CODEC<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_ANSWER<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: API<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_EXECUTE<br>
&gt;<br>
&gt; getType: CUSTOM<br>
&gt; Content-Type: text/event-plain<br>
&gt; Event-Name: CHANNEL_PARK<br>
&gt;<br>
&gt; getType: CHANNEL_EXECUTE<br>
&gt; Event-Name: CHANNEL_EXECUTE<br>
&gt;<br>
&gt; getType: CHANNEL_HANGUP<br>
&gt; Event-Name: CHANNEL_HANGUP<br>
&gt;<br>
&gt; getType: CHANNEL_EXECUTE_COMPLETE<br>
&gt; Event-Name: CHANNEL_EXECUTE_COMPLETE<br>
&gt;<br>
&gt; getType: COMMAND<br>
&gt; Event-Name: COMMAND<br>
&gt;<br>
&gt; getType: CHANNEL_UNPARK<br>
&gt; Event-Name: CHANNEL_UNPARK<br>
&gt;<br>
&gt; getType: CHANNEL_EXECUTE_COMPLETE<br>
&gt; Event-Name: CHANNEL_EXECUTE_COMPLETE<br>
&gt;<br>
&gt; getType: PRESENCE_IN<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: PRESENCE_IN<br>
&gt; Event-Name: PRESENCE_IN<br>
&gt;<br>
&gt; getType: CHANNEL_HANGUP_COMPLETE<br>
&gt; Event-Name: CHANNEL_HANGUP_COMPLETE<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt; getType: CHANNEL_DESTROY<br>
&gt; Event-Name: CHANNEL_DESTROY<br>
&gt;<br>
&gt; getType: CHANNEL_STATE<br>
&gt; Event-Name: CHANNEL_STATE<br>
&gt;<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Ron<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; FreeSWITCH-users mailing list<br>
&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:+19193869900<br>