I was wondering if anyone knew of a way to make a synchronous call from another server via Asterisk. I have an application (Java) that needs to initiate calls and block until the call is completed. Specifically, I have 2 servers. The main server contacts the asterisk server via the manager API and intiates a phone call. I would like my “phone call request” thread to block until the call has completed. The problem is that the originate command returns before the call completes.
ugh… only thing i can think of is to write a couple of AGI scripts that synchronize (using a lockfile or something…) the creation of the ‘i am done’ file would have to be hooked into the ‘h’ priority for that call (i think this is possible?) the application doing the originate would run the agi script that would wait for the ‘i am done’ file to show up.
Do you want to block until
a) the originate has completed, i.e. the first party answered and the second is being called
b) the call has been setup, i.e. the second party answered
c) the whole call is completed, i.e. one party hung up
Why do you need to block a thread? Doesn’t an asynchronous model fit much better?
I am looking for C. I want to block until the entire call is complete. The call that is being maded is automated. In a nutshell, the phone call ask the answering party to enter some DTMF digits. On my application server (java), I will have a thread that is tasked with ensuring the call is initiate and completed. I might have 10 threads going on at once, each in the process of being in a call. (Specifically, I am using JMS queues to handle requests to make (automated) calls. My MDB is handing the requests in the queue. I want the MDB to block until the call is completed (or fails)).
I’m not doing a typical PBX application. Asynchronous doesn’t actually fit better. I can have my application server deal with an asynchronous call to initiate and a “call back” when the call is completed, but with my current design on my app sever, it would require more work and moving parts.
Thank you for the pointer. This solution looks like it will work well.
My time line to solve this problem is actually pretty tight. Do you have any idea on when 0.3 will be “officially” released? Can you think of a way to do this using 0.2?