Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Freeswitch streamFile when the user answers


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
alex at sinapticode.ro
Guest





PostPosted: Fri Dec 12, 2008 6:50 am    Post subject: [Freeswitch-users] Freeswitch streamFile when the user answe Reply with quote

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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
d at d-man.org
Guest





PostPosted: Fri Dec 12, 2008 8:50 am    Post subject: [Freeswitch-users] Freeswitch streamFile when the user answe Reply with quote

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@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@sinapticode.ro]
Sent: Friday, December 12, 2008 3:39 AM
To: freeswitch-users@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@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
msc at freeswitch.org
Guest





PostPosted: Sat Dec 13, 2008 6:57 pm    Post subject: [Freeswitch-users] Freeswitch streamFile when the user answe Reply with quote

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@d-man.org (d@d-man.org)> wrote:
Quote:
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@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@sinapticode.ro (alex@sinapticode.ro)]
Sent: Friday, December 12, 2008 3:39 AM
To: freeswitch-users@lists.freeswitch.org (freeswitch-users@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@lists.freeswitch.org (Freeswitch-users@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@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services