Asterisk 1.6 WaitForSilence Problem

I’ve set up an outbound .call system for customer callbacks and the like. Calls are going out over analog lines and I’m trying to use the WaitForSilence routine to make sure the phone has stopped ringing before starting message playback. The problem is that if I set the first argument of WaitForSilence to anything other than 1, WaitForSilence never exits.

Some general info on my setup:

more /proc/version

Linux version 2.6.16.60-0.34-smp (geeko@buildhost) (gcc version 4.1.2 20070115 (SUSE Linux)) #1 SMP Fri Jan 16 14:59:01 UTC 2009
Connected to Asterisk 1.6.1.0 currently running on ivueivrtest (pid = 1639)

dahdi version: 2.2.0-rc4

/etc/dahdi/system.conf

# Autogenerated by /usr/sbin/dahdi_genconf on Thu May 21 11:50:14 2009
# If you edit this file and execute /usr/sbin/dahdi_genconf again,
# your manual changes will be LOST.
# Dahdi Configuration File
#
# This file is parsed by the Dahdi Configurator, dahdi_cfg
#
# Span 1: WCTDM/0 "Wildcard TDM2400P Board 1" (MASTER) 
fxsks=1
echocanceller=mg2,1
fxsks=2
echocanceller=mg2,2
fxsks=3
echocanceller=mg2,3
fxsks=4
echocanceller=mg2,4
fxsks=5
echocanceller=mg2,5
fxsks=6
echocanceller=mg2,6
fxsks=7
echocanceller=mg2,7
fxsks=8
echocanceller=mg2,8
fxsks=9
echocanceller=mg2,9
fxsks=10
echocanceller=mg2,10
fxsks=11
echocanceller=mg2,11
fxsks=12
echocanceller=mg2,12
fxsks=13
echocanceller=mg2,13
fxsks=14
echocanceller=mg2,14
fxsks=15
echocanceller=mg2,15
fxsks=16
echocanceller=mg2,16
fxsks=17
echocanceller=mg2,17
fxsks=18
echocanceller=mg2,18
fxsks=19
echocanceller=mg2,19
fxsks=20
echocanceller=mg2,20
fxsks=21
echocanceller=mg2,21
fxsks=22
echocanceller=mg2,22
fxsks=23
echocanceller=mg2,23
fxsks=24
echocanceller=mg2,24

# Global data

loadzone	= us
defaultzone	= us

/etc/asterisk/dahdi-channels.conf

; Autogenerated by /usr/sbin/dahdi_genconf on Thu May 21 11:50:15 2009
; If you edit this file and execute /usr/sbin/dahdi_genconf again,
; your manual changes will be LOST.
; Dahdi Channels Configurations (chan_dahdi.conf)
;
; This is not intended to be a complete chan_dahdi.conf. Rather, it is intended
; to be #include-d by /etc/chan_dahdi.conf that will include the global settings
;

; Span 1: WCTDM/0 "Wildcard TDM2400P Board 1" (MASTER) 
;;; line="1 WCTDM/0/0"

threewaycalling=yes
callwaiting=yes
transfer=yes
callprogress=no

signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 1
callerid=
group=
context=default

;;; line="2 WCTDM/0/1"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 2
callerid=
group=
context=default

;;; line="3 WCTDM/0/2"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 3
callerid=
group=
context=default

;;; line="4 WCTDM/0/3"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 4
callerid=
group=
context=default

;;; line="5 WCTDM/0/4"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 5
callerid=
group=
context=default

;;; line="6 WCTDM/0/5"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 6
callerid=
group=
context=default

;;; line="7 WCTDM/0/6"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 7
callerid=
group=
context=default

;;; line="8 WCTDM/0/7"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 8
callerid=
group=
context=default

;;; line="9 WCTDM/0/8"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 9
callerid=
group=
context=default

;;; line="10 WCTDM/0/9"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 10
callerid=
group=
context=default

;;; line="11 WCTDM/0/10"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 11
callerid=
group=
context=default

;;; line="12 WCTDM/0/11"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 12
callerid=
group=
context=default

;;; line="13 WCTDM/0/12"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 13
callerid=
group=
context=default

;;; line="14 WCTDM/0/13"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 14
callerid=
group=
context=default

;;; line="15 WCTDM/0/14"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 15
callerid=
group=
context=default

;;; line="16 WCTDM/0/15"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 16
callerid=
group=
context=default

;;; line="17 WCTDM/0/16"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 17
callerid=
group=
context=default

;;; line="18 WCTDM/0/17"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 18
callerid=
group=
context=default

;;; line="19 WCTDM/0/18"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 19
callerid=
group=
context=default

;;; line="20 WCTDM/0/19"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 20
callerid=
group=
context=default

;;; line="21 WCTDM/0/20"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 21
callerid=
group=
context=default

;;; line="22 WCTDM/0/21"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 22
callerid=
group=
context=default

;;; line="23 WCTDM/0/22"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 23
callerid=
group=
context=default

;;; line="24 WCTDM/0/23"
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 24
callerid=
group=
context=default

/etc/asterisk/extensions.conf

[general]
static=yes
writeprotect=no
clearglobalvars=no

[globals]
CONSOLE=Console/dsp                             ; Console interface for demo
IAXINFO=guest                                   ; IAXtel username/password
TRUNK=DAHDI/G0                                    ; Trunk interface
TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)

[outdial]
exten => s,1,Set(TIMEOUT(response)=3)
exten => s,n,WaitForSilence(4000,1,16)
exten => s,n,Agi(agi://localhost/Outdial.agi)
exten => s,n,Hangup()

exten => failed,1,Verbose(Outdial failed)
exten => failed,n,Verbose(Reason= ${REASON})
exten => failed,n,Hangup()

Thanks in advance for any help you can provide.

It is a bug in dsp.c. It does not properly init thresholds[THRESHOLD_SILENCE]
if the conf file is missing and does not warn if the file is missing

I found that because I did not have a dsp.conf file in /etc/asterisk the dialplan entry exten => s,1,WaitForSilence(4000,1,60) would be stuck.

add this to /etc/asterisk

dsp.conf [default] ; ; Length of sound (in milliseconds) before a period of silence is considered ; to be a change from talking to silence or a period of noise converts silence ; to talking. [default=256] ; ;silencethreshold=256