<font face="arial" size="2">Had the same issue time ago, but Eric shed good light on it, have a look at:<br /><br />
http://lists.digium.com/pipermail/asterisk-users/2006-November/172079.html<br /><br />
Summary: sorry, no nice work around.<br /><br />Alyed </font>
                <br />
                <br />
                <font face="Tahoma, Arial, Sans-Serif" size="2">
                                <hr align="center" size="2" width="100%" />Return-Path: <asterisk-users-bounces@lists.digium.com><br />Received: from digium-69-16-138-164.phx1.puregig.net [69.16.138.164] by maila11.webcontrolcenter.com with SMTP;<br /> Thu, 8 Feb 2007 13:54:53 -0700<br />Received: from digium-69-16-138-164.phx1.puregig.net (localhost [127.0.0.1])<br />        by lists.digium.com (Postfix) with ESMTP id 2F6122FC4DD;<br />        Thu, 8 Feb 2007 12:35:23 -0700 (MST)<br /></font>
                <br />
                <br />Hello Asteriskers, :-)<br /><br />We're trying to set up an outbound notification calling for system <br />alerts with Asterisk 1.4.0. We generate a call file in <br />/var/spool/asterisk/outgoing and the outbound call is originated through <br />Zap/1 (Sangoma A200D to a Canadian POTS line). The problem is that <br />Asterisk does not wait for the other side to answer before it starts <br />playing the message. So the person called answers the phone after the <br />second or third ring and only hears the tail end of the message and the <br />"goodbye".<br /><br />Ideally, we want to deliver the message immediately after the person <br />answers, or if an answering machine picks up, right after the "beep".<br /><br />Any suggestions?<br /><br />(1) The call file generator script (works ok):<br />#!/bin/sh<br /><br />TMPFILE=`mktemp /tmp/tmp.XXXXXXX` || exit 1<br />echo "TMPFILE = $TMPFILE"<br /><br />cat <<eot> $TMPFILE<br />Channel: Zap/g1/phone_number_here<br />Callerid: SYSTEM<br />MaxRetries: 2<br />RetryTime: 60<br />WaitTime: 30<br />Context: dialout<br />Extension: s<br />Priority: 1<br />EOT<br /><br />mv -v $TMPFILE /var/spool/asterisk/outgoing<br /><br />(2) The dialout context in extensions.conf (problem - starts playback <br />before call is answered)<br />[dialout]<br />exten => s,1,NoOp(Dialout)<br />exten => s,n,Set(TIMEOUT(digit)=5)<br />exten => s,n,Set(TIMEOUT(response)=8)<br />exten => s,n,Set(MACHINE=0)<br />exten => s,n,Answer<br />exten => s,n,BackgroundDetect(silence/5,1000,50)<br />exten => s,n,NoOp(Ans Machine detected)<br />exten => s,n,Set(MACHINE=1)<br />exten => s,n,BackgroundDetect(silence/30,1000,50,30050)<br />exten => s,n,NoOp(Ans Machine Message Too Long)<br />exten => s,n,Hangup<br /><br />exten => talk,1,GotoIf($[${MACHINE}=1]?machine:human)<br />exten => talk,2(machine),Goto(dialout-machine,s,1)<br />exten => talk,3(human),Goto(dialout-human,s,1)<br /><br />[dialout-machine]<br />exten => s,1,NoOp(Dialout to Ans Machine)<br />exten => s,n,Playback(/tmp/asterisk-recording)<br />exten => s,n,Wait(1)<br />; we'd like to do something to wait for the "beep" here...<br />exten => s,n,Playback(vm-goodbye)<br />exten => s,n,Hangup<br /><br />[dialout-human]<br />exten => s,1,NoOp(Dialout to Human)<br />exten => s,n,Playback(/tmp/asterisk-recording)<br />exten => s,n,Wait(1)<br />exten => s,n,Playback(vm-goodbye)<br />exten => s,n,Hangup<br /><br /><br />(3) *CLI><br /> -- Attempting call on Zap/1/1234567 for s@dialout:1 (Retry 1)<br /> > Channel Zap/1-1 was answered.<br /> -- Executing [s@dialout:1] NoOp("Zap/1-1", "Dialout") in new stack<br /> -- Executing [s@dialout:2] Set("Zap/1-1", "TIMEOUT(digit)=5") in new <br />stack<br /> -- Digit timeout set to 5<br /> -- Executing [s@dialout:3] Set("Zap/1-1", "TIMEOUT(response)=8") in <br />new stack<br /> -- Response timeout set to 8<br /> -- Executing [s@dialout:4] Set("Zap/1-1", "MACHINE=0") in new stack<br /> -- Executing [s@dialout:5] Answer("Zap/1-1", "") in new stack<br />(Problem: Asterisk does not wait until the call is answered on the far end!)<br /> -- Executing [s@dialout:6] BackgroundDetect("Zap/1-1", <br />"silence/5|1000|50") in new stack<br /> -- Playing 'silence/5' (language 'en')<br /> -- Executing [talk@dialout:1] GotoIf("Zap/1-1", "0?machine:human") <br />in new stack<br /> -- Goto (dialout,talk,3)<br /> -- Executing [talk@dialout:3] Goto("Zap/1-1", "dialout-human|s|1") <br />in new stack<br /> -- Goto (dialout-human,s,1)<br /> -- Executing [s@dialout-human:1] NoOp("Zap/1-1", "Dialout to Human") <br />in new stack<br /> -- Executing [s@dialout-human:2] <br />Playback("Zap/1-1","/tmp/asterisk-recording") in new stack<br /> -- Playing '/tmp/asterisk-recording' (language 'en')<br /> -- Executing [s@dialout-human:3] Wait("Zap/1-1", "1") in new stack<br /> -- Executing [s@dialout-human:4] Playback("Zap/1-1", "vm-goodbye") <br />in new stack<br /> -- Playing 'vm-goodbye' (language 'en')<br /> -- Executing [s@dialout-human:5] Hangup("Zap/1-1", "") in new stack<br /> == Spawn extension (dialout-human, s, 5) exited non-zero on 'Zap/1-1'<br /> -- Hungup 'Zap/1-1'<br />[Feb 8 13:29:37] NOTICE[32512]: pbx_spool.c:351 attempt_thread: Call <br />completed to Zap/1/1234567<br /><br />Thanks for any ideas on this!<br /><br />Alvin<br /><br />_______________________________________________<br />--Bandwidth and Colocation provided by Easynews.com --<br /><br />asterisk-users mailing list<br />To UNSUBSCRIBE or update options visit:<br /> http://lists.digium.com/mailman/listinfo/asterisk-users<br /><br /></eot>