2

I am trying to use my dialplan to play recordings with WaitForSilence to make sure it wait until the person is done speaking or the message is left on voicemail. However, it doesn't seem to wait for 5 seconds of silence. Even if I'm talking it will still detect silence.

My AEL dialplan is this:

100 => {
        Answer();
        WaitForSilence(5000,2,60);
        AGI(agi://127.0.0.1/playmessage,${CALLID});
        AGI(agi://127.0.0.1/saytext,"Goodbye.");
        Hangup();
}

Outputs

== 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'

Even if I add in the AMD() it will always detect everything as a machine, and still won't really listen for silence. Is there something wrong in my configuration that Asterisk doesn't know what silence is?

Or am I misunderstanding how to be waiting for silence to start playing a message?

2 Answers 2

3

Thank you for all of your help. Finally, I read somewhere that it may be helpful to record calls, so I started using the Monitor() application. Finally, I found that Asterisk wasn't listening for silence until after it played a recording first. I found this by realizing that Monitor() didn't start recording until something was first played by Asterisk, and not when the other side started talking.

To fix it, I simply played a moment of silence before waiting:

        100 => {
                Answer();
//              Monitor(wav,"playback-${CALLID}",m);
                Playback(silence/1);
                WaitForSilence(1000,1,60);
                AGI(agi://127.0.0.1/playmessage,${CALLID});
                AGI(agi://127.0.0.1/saytext,"Goodbye.");
                Hangup();
        }

You can see above my simple code with the Monitor() commented out. The above works just fine for answering machines too.

0

Wait for silence and amd both waiting for period when no significant sound

So your channel always HAVE sound.

Most likely reason - bad quality line.

You can try fix that by changing silence threshold.

For AMD it is last param

AMD([|initialSilence][|greeting][|afterGreetingSilence][|totalAnalysisTime][|minimumWordLength][|betweenWordsSilence][|maximumNumberOfWords][|silenceThreshold])

In new versions you can also change threshold in dsp.conf

If you put that value high enough it will think that silence is always. So you need experiment with that.

2
  • Thank you. I've tried every value I could for silencethreshold in dsp.conf. The weird thing is that when I let it record it definitely will detect silence and end recordings. However. WaitForSilence does nothing.
    – mikealeonetti
    Mar 30, 2015 at 18:29
  • You can do full debug and see how waitforsilence try detect silence. Google "asterisk debug mode"
    – arheops
    Mar 30, 2015 at 22:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .