Question

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

streamFile(*file A*);
exec("WaitForSilence","300,1,1");
waitStatus=getVariable("WAITSTATUS");
streamFile(*file B*);

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:

  • 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)

I've been looking for more than aweek now and couldn't find a way to do that. Any ideas?

Was it helpful?

Solution

Code you provided will do wait, after that will do playback.

There are no way do that simple in one application.

Posible ways:

1) create c/c++ application(asterisk guru skill required) for that.

2) create enother channel, mix it with ChanSpy and in that channel do silence detect. Complexity - expert in asterisk.

Both are not so short(more then 2-3 screens of code), so can't be described in this site.

You can also try use Background application, but i am afraid it will not work too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top