Also, the other question is this: do you <b>need</b> early media? If not then Darren&#39;s suggestion is definitely the way to go. Note that if you ignore early media then all calls that fail will show up as a NO ANSWER. If this doesn&#39;t work for you then ignoring early media is not an option, in which case there simply is no perfect way to do it and you just have to make the best of it. What I&#39;ve done in the past is something like this:<br>
<br>originate openzap/1/a/5551212 825551212<br><br>Then I define an extension that matches on ^82(\d+)$ and does something like this<br>&lt;action application=&quot;pre_answer&quot;/&gt;<br>&lt;action application=&quot;set&quot; data=&quot;execute_on_answer=transfer IVR_ANSWER&quot;/&gt;<br>
&lt;action application=&quot;sleep&quot; data=&quot;20000&quot;/&gt;<br>...handle non-answered calls<br><br>Then I define another extension that matches on ^IVR_ANSWER$ and does something like this<br>&lt;action application=&quot;sleep&quot; data=&quot;500&quot;/&gt;<br>
&lt;action application=&quot;ivr&quot; data=&quot;my_ivr&quot;/&gt;<br>...etc...<br><br>The idea for me is to handle the different scenarios I might face when dialing. At the very least if the call goes unanswered then I have the hangup_cause variable that tells me if it was busy, no answer, invalid, etc.<br>
<br>Hope that helps.<br>-MC<br><br><div class="gmail_quote">On Fri, Dec 12, 2008 at 5:48 AM, Darren Schreiber <span dir="ltr">&lt;<a href="mailto:d@d-man.org">d@d-man.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
How are you originating calls? You probably need to add<br>
{ignore_early_media=true}. This tells FreeSWITCH not to return from<br>
origination when early media (progress/ringing) was received (I think<br>
anyway)...<br>
<br>
See <a href="http://wiki.freeswitch.org/wiki/Channel_Variables#ignore_early_media" target="_blank">http://wiki.freeswitch.org/wiki/Channel_Variables#ignore_early_media</a><br>
<br>
There is a sample of this in use with the originate command here:<br>
<a href="http://wiki.freeswitch.org/wiki/Mod_commands#originate" target="_blank">http://wiki.freeswitch.org/wiki/Mod_commands#originate</a> (about halfway down)<br>
<br>
Setting channel variables before doing the originate<br>
<br>
 &nbsp; originate {ignore_early_media=true}sofia/<a href="http://mydomain.com/18005551212@1.2.3.4" target="_blank">mydomain.com/18005551212@1.2.3.4</a><br>
15555551212<br>
<br>
<br>
<br>
Since you are making a dialer, you may want to start the originations in the<br>
background and move on to the next call while tweaking the timeout value for<br>
originated calls. From the WIKI again:<br>
<br>
&quot;You can originate a call in the background (asynchronously) and playback a<br>
message with a 60 second timeout.<br>
<br>
 &nbsp; bgapi originate<br>
{ignore_early_media=true,originate_timeout=60}sofia/gateway/name/number<br>
&amp;playback(message)&quot;<br>
<font color="#888888"><br>
- Darren<br>
</font><div><div></div><div class="Wj3C7c"><br>
<br>
<br>
-----Original Message-----<br>
From: Alexandru Nedelcu [mailto:<a href="mailto:alex@sinapticode.ro">alex@sinapticode.ro</a>]<br>
Sent: Friday, December 12, 2008 3:39 AM<br>
To: <a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a><br>
Subject: [Freeswitch-users] Freeswitch streamFile when the user answers<br>
<br>
Hi,<br>
<br>
I&#39;m working on a simple dialer, and I have the following problem: the audio<br>
file starts playing before the user answeres the phone (while it&#39;s ringing).<br>
It only works when I introduce a delay, but that doesn&#39;t seem right.<br>
<br>
For instance in the asterisk context referred in the call files, I had:<br>
<br>
exten =&gt; s,4,Answer<br>
exten =&gt; s,n,Wait(2)<br>
exten =&gt; s,n,Background(${SOUNDFILE})<br>
And indeed it played a soundfile 2 seconds after the called person picked up<br>
the phone<br>
<br>
In FS I currently initiate calls like this:<br>
<br>
session.waitForAnswer(10000);<br>
<br>
if (session.ready()) {<br>
 &nbsp; &nbsp;session.sleep(2000);<br>
 &nbsp; &nbsp;session.streamFile(/*...*/);<br>
}<br>
<br>
Is this right?<br>
<br>
<br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br>
<br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br>