Here's how it works:

1.  First we detect that the answered call IS a voice mail using a 
number of accepted parameters.  Mostly we're looking for energy on the 
line - more specifically we're looking for combination of energy and 
silence that would most common distinguish the difference between "Hello 
or Acme Widets John speaking" vs. "The person you are calling is not 
available at this time. Please leave your name and number at the tone.  
or Thank you for calling Vonage.  All of  our operators are busy fending 
off hungry lawyers.  You may hold as long as you wish but we're going to 
send you to voice mail anyway." I used app_machinedetect to figure this 
part out.  app_machinedetect was an Asterisk "add-on" that didn't seem 
to make it into CallWeaver.  So, I borrowed and modified it a bit for my 
own use.
2.  Once we know the answered call is answering machine the ticket is to 
play our message when all is quiet.  What we chose to do was use 
opbx_dsp_silence() to first wait for a single occurrence of 800ms of 
silence within 1 second.  If we don't get this 800ms we repeat this step 
until we do or the called party hangs up.
3.  Now that we can get a word in "edge-wise" we cause the system to 
begin playing the message.
4.  While playing the message we continue to look for voice energy using 
the same algorithm - 800ms of silence within 1 second.  If we don't get 
this 800ms we terminate the outgoing message and repeat step 2.

The foregoing is the process.  The implementation may take a number of 
approaches.  In my case I need the whole thing embedded in an app.  So, 
unfortunately the code is not suitable for display. 

I suppose, however, you might also take a similar approach using 
extensions.conf with MachineDetect and BackGroundDetect... perhaps 
something like this (note ... I rarely use extensions.conf scripting.. 
this could be way off):

[default]
exten => s,n,...
exten => s,n,MachineDetect(700,2,2200) ;  MachineDetect(x|y|z) Waits for 
answering machine greetings to finish and sets a flag. Waits for 'x' 
milliseconds of silence, 'y' times. ${MACHINE} will be set to 1 if 'z' 
miliseconds of total (non-continuous) audio noise is detected. It will 
not clear the flag, so it is possible to run through several calls to 
the application with different detection settings in sequence.
exten => s,n,GotoIf($[ ${MACHINE} = 1 ]?machine,s,1)
exten => s,n,...

[machine]
exten => s,1,NoOp(machine)
exten => s,n,BackgroundDetect(my_play_file|800|800|1000)
exten =>talk,1,Goto(1)


William Suffill wrote:
> I'd be interested to see what you came up with. Seems like it could be
> quite useful. Glad to see more people willing to be involved in the
> community of late.
>
> -- William
> _______________________________________________
> Openpbx-dev mailing list
> [email protected]
> http://lists.openpbx.org/mailman/listinfo/openpbx-dev
>
>   
_______________________________________________
Openpbx-dev mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-dev

Reply via email to