[Freeswitch-users] mod_java - usage question

Anthony Minessale anthmct at yahoo.com
Tue Dec 11 06:27:52 PST 2007


To accomplish what you are wanting with mod_java you would need a way to
invoke another thread outside of the call to assume control of the channels
rather than trying to do it from the call's thread.

In javascript there is a jsrun api command that will launch another script in
it's own thread with no calls in it.  I assume the author of mod_java could extend it to do something similar so you could run a management app that listens for events and acts accordingly.

Also you could use the event_socket with a standalone java app to manage the 
calls from a separate entity.  

But by design the high level interfaces block on things like playback
and bridging but allow callbacks to be connected for things like read frame
and dtmf and message reception. 

You can always do it in C where you have full control and ability to
launch threads etc.



 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org
pstn:213-799-1400


----- Original Message ----
From: jonathan augenstine <jaugenstine at gmail.com>
To: freeswitch-users at lists.freeswitch.org
Sent: Tuesday, December 11, 2007 12:58:55 AM
Subject: Re: [Freeswitch-users] mod_java - usage question


Damjan,

What I want to do is the following:

incoming call
- play a prompt
- bridge incoming to endpoint 1
- endpoint 1 hangs up
- park the incoming call

originate call to endpoint 2
- play a prompt to endpoint 2

- bridge endpoint 2 to endpoint 3
- endpoint 3 hangs up
- bridge incoming call to endpoint 2

The details on how to accomplish this with mod_java are eluding me.  Every approach I have attempted I have encountered roadblocks of either hitting execute blocking what I need to do or not having the right info (what needs to be passed to originate or how to play a prompt to endpoint2 or bridge to endpoint 3).  I am getting stuck on the details and cannot find the docs to clarify.


Jonathan


On Dec 10, 2007 10:05 PM, Damjan Jovanovic <damjan at ecntelecoms.com> wrote:

X-ECN Telecoms-MailScanner-Information: Contact ECN Telecoms
X-ECN Telecoms-MailScanner: Found to be clean
X-ECN Telecoms-MailScanner-SpamCheck: not spam, SpamAssassin (not cached,

        score=-
101.233, required 6, autolearn=not spam, ALL_TRUSTED -1.80,
        AWL 3.17, BAYES_00 -2.60, USER_IN_WHITELIST -100.00)
X-ECN Telecoms-MailScanner-From: damjan at ecntelecoms.com

X-Spam-Status: No



On Mon, 2007-12-10 at 08:53 -0800, jonathan augenstine wrote:
>
>
>
>         On Mon, 2007-12-10 at 00:38 -0800, jonathan augenstine wrote:

>         > I am trying to put together a prototype app for Freeswitch
>         using the
>         > mod_java interface, I am hitting a deadend and I need some
>         guidance.
>         >

>         > What I want to do is to answer an incoming call (endpoint
>         1), play a
>         > prompt to that call, and bridge that call to another
>         endpoint
>         > (endpoint 2).  After the second endpoint (endpoint 2)

>         disconnects, I
>         > want to park that call, originate a call to another endpoint
>         (endpoint
>         > 3), play a prompt to endpoint 3, and then bridge endpoint 3

>         to a new
>         > endpoint (endpoint 4).  After endpoint 4 hangs up, I want to
>         bridge
>         > endpoint 1 and endpoint 3.  Then main issue I keep running
>         into is

>         > that in the dialplan and in mod_java, calls appear to block,
>         so that
>         > it has blocked me from a solution.
>
>
>         How do calls "block"? Use a remote debugger and see where it

>         happens.
>
> If I run the following code:
>
>
>             session = new JavaSession(sessionUuid);
>             freeswitch.console_log("notice", "STARTED!!!\n");

>             session.streamFile
> ("/usr/local/freeswitch/sounds/intro.wav", 0);
>             session.execute("bridge",
> "sofia/gateway/[gatewayname]/3237773456");

>             freeswitch.console_log("notice", "COMPLETED!!!\n");
>
> I do not see the "COMPLETED!!!" console message until one of the
> callers from the "bridge" hangs up.  The

> session.execute("bridge",.....) call blocks.



session.execute() is supposed to block until the application finishes
running. I'm not sure why that's a problem, you only want to park the

call after bridge is finished.


>
>         > My first question is, can you do this with the mod_java
>         interface?  If
>         > so, how?  Secondly, if it is not possible then do you need

>         to use the
>         > event_socket interface to accomplish this app?  Thank you.
>
>
>         When there is no other function that does the job, try the
>         execute()

>         method in mod_java. Event sockets can probably do the same,
>         but I've
>         found them harder to work with (don't know if there are any
>         APIs that
>         make it easier), and since they cost 2 sockets and probably 1

>         thread per
>         call and if on the same machine double the number of context
>         switches,
>         they are more resource intensive too.
>
> As illustrated above I am using the execute.

>
>
>
>
>         > Best Regards,
>         > Jonathan
>         >
>         > _______________________________________________
>         > 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
>
>         Damjan
>
>
>
>         _______________________________________________

>         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

Damjan



_______________________________________________
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











      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20071211/302979d1/attachment-0002.html 


More information about the FreeSWITCH-users mailing list