<br><br><div class="gmail_quote">On Mon, Aug 31, 2009 at 8:22 AM, Greg Thoen <span dir="ltr"><<a href="mailto:gregt@cgicommunications.com">gregt@cgicommunications.com</a>></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;">
<div style="word-wrap: break-word;">Hi. Before I go to far down this path, I wonder if what I intend to do is not a good practice.<div><br></div><div>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,</div>
<div><br></div><div><div>$response = <<< XML</div><div><?xml version="1.0" encoding="UTF-8" standalone="no"?></div><div><document type="freeswitch/xml"></div><div>
<section name="dialplan" description="example_curl_dialplan"></div><div> <context name="public"></div><div> <extension name="curl_test"></div><div> <condition field="destination_number" expression="^(\+1|1?)(5844111)$"></div>
<div> <action application="javascript" data="demos/stest-examp-st.js" /></div><div> </condition></div><div> </extension></div><div> </context></div><div>
</section></div><div></document></div><div>XML;</div><div><br></div><div>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.</div>
<div><br></div><div>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?</div><div><br></div><div>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:</div>
<div>session.collectInput(onInputsml, "emptyobject", 7000);</div><div> <span style="font-size: 12px;"><div style="word-wrap: break-word;"><div><p style="margin: 0px;"><font face="Helvetica" size="3">--</font></p>
<p style="margin: 0px;"><font face="Helvetica" size="3">Greg Thoen</font></p></div></div></span><br></div></div></div></blockquote><div><br>Just remember that you're dealing with two somewhat related but still distinctly separate entities: generating a dialplan and executing some sort of call control from the dialplan. You need some sort of dialplan no matter what, so the issue there is whether you need a dynamic one or not. If you're just going to drop calls to an extension that opens an outbound socket to your call control program then you may not need the dynamic dp generation that mod_xml_curl gives you. You'll have to decide on static vs. dynamic based on your needs. In either case, once the call is connected to your socket you've got all sorts of control options. PHP has an ESL abstraction just like the other languages so there shouldn't be any issue about PHP lacking the ability to control calls.<br>
<br>I say start hacking away at it and see what happens. :) Definitely join us in #freeswitch on <a href="http://irc.freenode.net">irc.freenode.net</a> if you want to discuss this more in realtime. <br>-MC<br><br></div></div>