[Freeswitch-users] Which method Can I use in IVR

Michael Collins msc at freeswitch.org
Mon Jul 27 10:00:42 PDT 2009


See comments inline...

On Sun, Jul 26, 2009 at 10:07 PM, Thangappan.M <thangappan143 at gmail.com>wrote:

> Dear all,
>
>  I am learning how to implement a IVR in Freeswitch.In our organization we
> are using Perl scripting language for doing this.So In freeswitch also I
> need to use Perl.


Tony, Brian, and I all like Perl. :)


>
>
>  So far I heard two methods for executing IVR.
>         One is in dial plan using perl application.( In perl I create IVR
> menu and play the voice files)
>         Another one is using event socket.In dial plan I specified socket
> application and write a Perl script which is listening that particular port
> and get the session Id.
>

Yes, you can call a script from the dialplan using syntax like this:
<action application="perl" data="/path/to/myivr.pl"/>

OR

You can call an outbound socket connection like this:
<action application="socket" data="127.0.0.1:8084 async full"/>


>
> Have I understood correctly?.If it is correct means tell which method can I
> use?. Other make me understand well.


You're on the right track. As to which method to use, that depends on your
circumstances. How much does it need to scale? Do you want the IVR "brain"
to reside physically on a different server than the FS server? Think about
those things.


>
> I have seen downloaded perl IVR menu from freeswitch site.In that they
> called some internal functions like playandGetDigits,StreamFile,ready
> ...etc.
>
> These functions is been called by using $session variable.Where these
> functions are defined.?
>

When you call a Perl script from the dialplan the script automatically has
access to a variable called $session.  Check this for more information:
http://wiki.freeswitch.org/wiki/Mod_perl#Programming_with_mod_perl

Of course, when using the outbound event socket you will not have this magic
$session variable. Your best bet to learn more about the socket interface is
to look at the sample scripts in src/libs/esl/perl/. (server.pl, server2.pl,
and server3.pl) If you are building an IVR with Perl and the event socket be
sure to check out src/libs/esl/perl/ESL/IVR.pm which is a small Perl module
with some simple abstractions to make IVR programming a bit more convenient.

I recommend that you try and create a simple IVR using each method and get a
feel for how each one works.

-MC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090727/6902070a/attachment-0002.html 


More information about the FreeSWITCH-users mailing list