[Freeswitch-users] Incorrect method of PHP call control?

Michael Collins msc at freeswitch.org
Mon Aug 31 09:55:54 PDT 2009


On Mon, Aug 31, 2009 at 8:22 AM, Greg Thoen <gregt at cgicommunications.com>wrote:

> Hi. Before I go to far down this path, I wonder if what I intend to do is
> not a good practice.
> 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);
>
> --
>
> Greg Thoen
>
>
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.

I say start hacking away at it and see what happens. :) Definitely join us
in #freeswitch on irc.freenode.net if you want to discuss this more in
realtime.
-MC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090831/4076264e/attachment-0002.html 


More information about the FreeSWITCH-users mailing list