Also, the other question is this: do you <b>need</b> early media? If not then Darren'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'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'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><action application="pre_answer"/><br><action application="set" data="execute_on_answer=transfer IVR_ANSWER"/><br>
<action application="sleep" data="20000"/><br>...handle non-answered calls<br><br>Then I define another extension that matches on ^IVR_ANSWER$ and does something like this<br><action application="sleep" data="500"/><br>
<action application="ivr" data="my_ivr"/><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"><<a href="mailto:d@d-man.org">d@d-man.org</a>></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>
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>
"You can originate a call in the background (asynchronously) and playback a<br>
message with a 60 second timeout.<br>
<br>
bgapi originate<br>
{ignore_early_media=true,originate_timeout=60}sofia/gateway/name/number<br>
&playback(message)"<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'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's ringing).<br>
It only works when I introduce a delay, but that doesn't seem right.<br>
<br>
For instance in the asterisk context referred in the call files, I had:<br>
<br>
exten => s,4,Answer<br>
exten => s,n,Wait(2)<br>
exten => 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>
session.sleep(2000);<br>
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>