Looks pretty straight forward. The biggest hurtle is design. From the posted code it's invoked on a per call basis. Quicker to write but not ideal if you want to scale it up. You could do similar in FS too by embed scripting or a daemon that catches any call to a certain extension regex and applies your logic.<br>
<br>outbound event socket would work too if you wanted to stick with PHP and reuse most of what you have. <br><a href="http://wiki.freeswitch.org/wiki/PHP_ESL">http://wiki.freeswitch.org/wiki/PHP_ESL</a> (I wrote that page so any questions/suggestions are welcome.) <br>
<br>-- W<br><br>PS: sorry for any typos but it's getting a bit late (3:38am)<br>