I am developing an java-asterisk application that is calling subscribers to deliver messages. At some moments during the call, I need to monitor whether the subscriber is talking or is silent. I need to monitor that for a fairly long time (1-3 seconds) but don’t want to interrupt the flow of the outgoing message.
The way I am doing it now is as below
[code]
streamFile(*file A*);
exec("WaitForSilence","300,1,1");
waitStatus=getVariable("WAITSTATUS");
streamFile(*file B*);[/code]
This works fine but it is only a 300ms detect and a 1s timeout, so from the subscriber point of view the silence between file A and file B is almost unnoticeable. But if I want to listen for longer (say 3 seconds for example) then the subscriber’s experience will be ruined.
What I would need is a function similar to “WaitForSilence” but that:
[ul]
- runs in parallel to the script;
- delivers its outcome in a variable channel with a name that I define (as there might be several calls to the function, and I need to get all the results)[/ul]
I’ve been looking for more than aweek now and couldn’t find a way to do that. Any ideas?