[Freeswitch-users] Freeswitch streamFile when the user answers

Michael Collins msc at freeswitch.org
Sat Dec 13 15:49:05 PST 2008


Also, the other question is this: do you *need* 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:

originate openzap/1/a/5551212 825551212

Then I define an extension that matches on ^82(\d+)$ and does something like
this
<action application="pre_answer"/>
<action application="set" data="execute_on_answer=transfer IVR_ANSWER"/>
<action application="sleep" data="20000"/>
...handle non-answered calls

Then I define another extension that matches on ^IVR_ANSWER$ and does
something like this
<action application="sleep" data="500"/>
<action application="ivr" data="my_ivr"/>
...etc...

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.

Hope that helps.
-MC

On Fri, Dec 12, 2008 at 5:48 AM, Darren Schreiber <d at d-man.org> wrote:

> How are you originating calls? You probably need to add
> {ignore_early_media=true}. This tells FreeSWITCH not to return from
> origination when early media (progress/ringing) was received (I think
> anyway)...
>
> See http://wiki.freeswitch.org/wiki/Channel_Variables#ignore_early_media
>
> There is a sample of this in use with the originate command here:
> http://wiki.freeswitch.org/wiki/Mod_commands#originate (about halfway
> down)
>
> Setting channel variables before doing the originate
>
>   originate {ignore_early_media=true}sofia/
> mydomain.com/18005551212 at 1.2.3.4
> 15555551212
>
>
>
> Since you are making a dialer, you may want to start the originations in
> the
> background and move on to the next call while tweaking the timeout value
> for
> originated calls. From the WIKI again:
>
> "You can originate a call in the background (asynchronously) and playback a
> message with a 60 second timeout.
>
>   bgapi originate
> {ignore_early_media=true,originate_timeout=60}sofia/gateway/name/number
> &playback(message)"
>
> - Darren
>
>
>
> -----Original Message-----
> From: Alexandru Nedelcu [mailto:alex at sinapticode.ro]
> Sent: Friday, December 12, 2008 3:39 AM
> To: freeswitch-users at lists.freeswitch.org
> Subject: [Freeswitch-users] Freeswitch streamFile when the user answers
>
> Hi,
>
> I'm working on a simple dialer, and I have the following problem: the audio
> file starts playing before the user answeres the phone (while it's
> ringing).
> It only works when I introduce a delay, but that doesn't seem right.
>
> For instance in the asterisk context referred in the call files, I had:
>
> exten => s,4,Answer
> exten => s,n,Wait(2)
> exten => s,n,Background(${SOUNDFILE})
> And indeed it played a soundfile 2 seconds after the called person picked
> up
> the phone
>
> In FS I currently initiate calls like this:
>
> session.waitForAnswer(10000);
>
> if (session.ready()) {
>    session.sleep(2000);
>    session.streamFile(/*...*/);
> }
>
> Is this right?
>
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20081213/a72fbf7f/attachment-0002.html 


More information about the FreeSWITCH-users mailing list