I started using mod_xml_curl to use PHP on localhost to generate a dialplan dynamically, based on the Caller-Destination-Number variable that is posted. It prints out the XML that calls the javascript that then controls the call. For example,
$response = <<< XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="freeswitch/xml">
<section name="dialplan" description="example_curl_dialplan">
<context name="public">
<extension name="curl_test">
<condition field="destination_number" expression="^(\+1|1?)(5844111)$">
<action application="javascript" data="demos/stest-examp-st.js" />
</condition>
</extension>
</context>
</section>
</document>
XML;
Then I thought, that's silly to go back out to javascript to handle the actions, playing files, using pocketsphinx, etc. I should just stay in PHP, using esl.php to answer and handle the call.
Then I rethought, is that a good practice to take over the call control from freeswitch at that point, while it is in the xml-curl dialplan hunt?
Then I also thought, is it even possible to do some of the things I need to do from the php esl, like the equivalent of this javascript:
session.collectInput(onInputsml, "emptyobject", 7000);