WaitForSilence NEVER detects silence

I have a call server that runs on a few custom AGI scripts initiating calls and then managing the calls. I’m getting stuck on the detecting silence functions. I wanted to use the silence detecting as a quick method of subtituting Answering Machine Detection.

However, whenever WaitForSilence is supposed to be detecting silence, it always just ends the interval whether or not there is actual silence. If I’m still talking, it will consider that as silence also.

My AEL dialplan associated with the calling is: 100 => { Answer(); WaitForSilence(5000,2,60); AGI(agi://127.0.0.1/playmessage,${CALLID}); AGI(agi://127.0.0.1/saytext,"Goodbye."); Hangup(); }And the CLI just outputs[quote] == Using SIP RTP CoS mark 5
> Channel SIP/twilio-0000006e was answered
– Executing [100@makeCall:1] Answer(“SIP/twilio-0000006e”, “”) in new stack
– Executing [100@makeCall:2] WaitForSilence(“SIP/twilio-0000006e”, “5000,2,60”) in new stack
– Waiting 2 time(s) for 5000 ms silence with 60 timeout
– Exiting with 5000ms silence >= 5000ms required
– Exiting with 5000ms silence >= 5000ms required
– Executing [100@makeCall:3] AGI(“SIP/twilio-0000006e”, “agi://127.0.0.1/playmessage,45”) in new stack
– Playing ‘/var/nam/data/outgoing/60’ (escape_digits=#) (sample_offset 0)
> 0x7f2179cf7990 – Probation passed - setting RTP source address to 54.172.61.251:18920
– Playing ‘/var/nam/data/tts/9eccb3f2ed77972157becdfbbac7232c’ (escape_digits=1#) (sample_offset 0)
– <SIP/twilio-0000006e>AGI Script agi://127.0.0.1/playmessage completed, returning 4
== Spawn extension (makeCall, 100, 3) exited non-zero on ‘SIP/twilio-0000006e’[/quote]In my test above, it waits for 5 seconds of silence twice, but even if I’m talking for the 5 seconds it will still just figure that I’m benig silent when I’m not.

I also tried using AMD to see if that would do a good job of detecting an answering machine, but it thinks that everything is a MACHINE.

I know Asterisk is knowledgable abut detecting silence because I have another AGI script that uses the RECORD FILE command that will successfully record somebody’s voice and stop recording when there is 5 seconds of silence (which is what I set).

Is there a setting somewhere that I’m missing somewhere for a silence threshold for WaitForSilence or am I misunderstanding its use?

The Asterisk version is[quote]Asterisk 11.7.0~dfsg-1ubuntu1[/quote]And it’s an Ubuntu package.

Thanks so much!