[Freeswitch-users] mod_perl examples?

Karl Vesterling kjv at ken-ton.com
Sat Sep 13 13:46:07 PDT 2008


With regard to mod_lua straight from the Wiki changed to mod_perl:

-- answer the call
session:answer();

-- play a file
session:streamFile("/path/to/blah.wav");

-- hangup
session:hangup();
mod_perl Equivalent:

$session->answer();
## I wonder what gets returned if the call failed to answer.  Let's  
say late negotiation is enabled, and it fails for that reason, how  
would I know what the cause was?
## would mod_perl be "killed" in action if that failed, or would it  
continue running until exit()?

## One could assume:
my $AnswerStatus = $session->answer();
## might contain SOMETHING, but what??

$session->streamFile("/some/path/to/file.wav");
## This probably does work.

$session->hangup();
## Probably works as well, and we don't care about anything it  
returns, since it should always return true, right?

##But now for the interesting ones...
my $DigitsDialed = $session->read(<magic 8 ball>);
### Evidently the arguments in the lua example of session:read(5,10,"/ 
path/to/some/file.wav", 3000, "#");
### mean something with the file.wav probably being the prompt, the  
3000 probably being a 3 second timeout,
### and the "#" quite possibly being a terminator to stop taking  
digits, but 5,10????

Specifically (in one instance) I'm looking to do the following:
Check the status of a particular phone/extension, see if it's  
currently registered, busy, presence, or whatnot.
Depending on the "condition" of that phone, and quite possibly the  
time of day in the time zone the phone is in, do something.  As to  
that something, well that'd be determined by what information I could  
obtain from the phone/user.

Another for instance:
For some incoming calls, I'd like to check to see if it's encrypted,  
and if it is, then and ONLY then, send it on through, otherwise call  
the extension, play a recording that the call is NOT encrypted, and  
they dial (X) to answer of (Y) to do something else etc...  At that  
point I might wish to record the non-encrypted call for review by  
someone should a need arise in the future, or if indicated in a DB  
somewhere.  Depending on the location (physical location) of the  
remote phone, I might have to play a recording notifying at least ONE  
party or BOTH parties that the call is being recorded.

Another for instance:
Outbound calls kind of like tele-marketing, but not.  What's that  
mean?  Think of it as an intelligent phone-tree that initiates a  
conference amongst many participants.
The "caller" dials a particular "extension" that's in their dialplan.
That extension kicks off an (for the lack of a better word) AGI, kind  
of like an intercom, but branches out to (X) people, who may be at (Y)  
numbers.

Person (A) which is one of (X) receives the call on their (Y)  
extensions.
They Answer one or many of them.
They dial their pin.
The other numbers/phones (Y) they're at stop ringing and they're  
dumped into a conference.

SUMMARY:
There's lots of stuff to write, but little if anything that doesn't  
involve hours upon hours of experimentation which sorry to say makes  
the learning curve too steep.
Imagine if Perl itself lacked documentation and Larry Wall merely  
said, "Go forth and play! It's sorta like 'C'!"



On Sep 13, 2008, at 3:47 PM, Wasim Baig wrote:

> there is also the mod_perl_rosetta page on the wiki that takes a  
> stab at doing asterisk::agi stuff with mod_perl
> please fix/edit as you go along, thanks ...
>
> -wasim
>
> On Sun, Sep 14, 2008 at 1:37 AM, Michael S Collins  
> <msc at freeswitch.org> wrote:
> But spewing forth dialplans is so much fun!
>
> Okay one thing I can say is that mod_perl is very similar to mod_lua  
> so there value in studying the mod_lua wiki page.
>
> Was there something in particular that you wanted to do?
>
> -MC
>
> Sent from my iPhone
>
> On Sep 13, 2008, at 10:19 AM, Karl Vesterling <kjv at ken-ton.com> wrote:
>
>>
>> Does anyone have any examples for mod_perl?
>>
>> I'm looking to do more than spew forth an XML dialplan, I want to  
>> actually interact with the call.
>>
>> There's little if anything of use for this on the Wiki
>> http://wiki.freeswitch.org/wiki/Mod_perl
>>
>> Thanks in advance.
>>
>>
>> Best Regards,
>> Karl J. Vesterling
>> kjv at ken-ton.com
>> 202-448-3009 x0
>>
>> _______________________________________________
>> Freeswitch-users mailing list
>> Freeswitch-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
>
>
> -- 
> wasim h. baig | principal consultant | convergence pk | +92 300  
> 8508070
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org

Best Regards,
Karl J. Vesterling
kjv at ken-ton.com
202-448-3009 x0

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20080913/ab70b70e/attachment-0002.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 832 bytes
Desc: This is a digitally signed message part
Url : http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20080913/ab70b70e/attachment-0002.bin 


More information about the FreeSWITCH-users mailing list