[Freeswitch-users] Early media playback
Anthony Minessale
anthony.minessale at gmail.com
Sat Sep 24 22:55:22 MSD 2011
here are your 2 options.
(beware that the file will loop if it finishes)
<action application="set" data="ringback=/path/to/file.wav"/>
<action application="bridge"
data="{ignore_early_media=true}sofia/internal/foo at bar.com"/>
<action application="set"
data="execute_on_pre_answer=playback::/path/to/file.wav"/>
<action application="bridge" data="sofia/internal/foo at bar.com"/>
You can do neither in conjunction with proxy_media mode because by
design, FreeSWITCH stays out of the media negotiation and has no idea
how to stream audio to the endpoints when you choose this setting.
There is no benefit at all to proxy_media mode unless you are trying
to use codecs that FreeSWITCH does not understand.
On Fri, Sep 23, 2011 at 2:39 AM, Chris Martineau <chris at ghosttelecom.com> wrote:
> Hi,
>
> Testing this a bit more and it isn't quite doing what I expect.
>
> You were right about the inline, wasn't need and it worked mainly because putting inline on the preanswer actually prevents it from being executed as it isn't allowed.
>
> Basically once proxy media was removed all worked as scripted.
>
> application='set' data='execute_on_media=playback /path/file' triggers the playback on the a leg on receiving a 183 on the b leg but this was the way I did it on opensips which was a proxy whereas we are a b2b environment and this takes no account of whether there is a valid rtp path back to the a leg source.
>
> By chance it works as there is no nat on my source but it wouldn't in a nat environment.
>
> I tried your export nolocal version which I assume then looks for media back on the a leg from the b leg but this never seems to trigger anything.
>
> Now I am not 100% on what on_media or on_preanswer are looking for, I assume just a 183 and 180 respectively because it doesn't seem to do anything on receiving actual rtp. If this is the case will execute on media actually trigger b leg to a leg seeing as the a leg doesn't receive a 183 (only sends it out). From looking at the log it would seem this is the case?
>
> Here is a list of what seems to happen with different setups for the purposes of the test i use execute on media as this is looking for 183s.
> 1.
> application='set' data='execute_on_media=playback /path/file'
> application='preanswer'
> Result->Plays immediately without waiting for preanswer or b leg 183?
> 2.
> application='preanswer'
> application='set' data='execute_on_media=playback /path/file'
> Result->Preanswer sent to a leg but no subsequent playback heard?
> 3.
> application='set' data='execute_on_media=playback /path/file'
> Result->Plays okay on b leg 183 however does not deliver 183 to a leg until playback finished?
> 4.
> application=' playback' data=/path/file'
> application='preanswer'
> Result->Plays immediately?
> 5.
> application='preanswer'
> application=' playback' data=/path/file'
> Result->Plays after a leg preanswer sent however does not initiate b leg bridge until playback finished?
>
> The one that would be perfect is number 2 with preanswer followed by execute on media which would allow time for the a leg rtp to set up whilst the call was still progressing but for some reason this just will not playback even though the log says it is?
>
> I have got it sort of working by setting it as a sched_broadcast after 1 second which seems to allow the preanswer to be sent and the bridge to progress before playing.
>
> Any ideas on how to make this a bit cleaner would be greatly appreciated.
>
> Regards
>
>
> Chris
>
>
>
> -----Original Message-----
> From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Kristian Kielhofner
> Sent: 21 September 2011 16:01
> To: FreeSWITCH Users Help
> Subject: Re: [Freeswitch-users] Early media playback
>
> Please try to be as specific as possible when describing issues. As
> far as proxy_media, well, this comes up all of the time:
>
> http://wiki.freeswitch.org/wiki/Proxy_Media#Common_misconceptions_.28READ_THIS.29
>
> I have no idea why you'd need to use inline but whatever works, I guess...
>
> On Wed, Sep 21, 2011 at 10:30 AM, Chris Martineau
> <chris at ghosttelecom.com> wrote:
>> Hi,
>>
>> Managed to fix this by trying every possible combination starting from a
>> very basic scenario.
>>
>> Works as follows...
>>
>> Execute on media <playback etc> inline
>> Pre-answer inline (must be inline)
>> <whatever else you want to do>
>> Bridge
>>
>> My big mistake was having proxy media enabled. Must be full fs
>> processing for early media playback to work.
>> You can use proxy media but only works when set as part of the bridge
>> action.
>>
>> I don't ignore far end 183 as I want this to kick in after my playback
>> and works as I want.
>>
>> Only a couple of things I am still stuck on.
>>
>> 1. I would like to terminate the playback on answer but cannot find any
>> obvious process to do this. Obviously you could do an execute_on_answer
>> but can't see what I would execute to achieve the desired effect?
>> Currently if the far end answers quickly they get silence until the
>> playback has finished and then they get through.
>>
>> 2. How do you execute multiple applications on answer? I need to execute
>> a sched_hangup and a sched_broadcast on answer so that the timers start
>> from answer. However cannot find any combination which allows me to put
>> multiple apps in the same execute on answer action. If I just create
>> multiple action entries it only seems to action the last one entered?
>> So have...
>> application='set' data='execute_on_answer=sched_hangup +XX
>> allotted_timeout'
>> if I add...
>> application='set' data='execute_on_answer=sched_broadcast +XX
>> /path/file'
>> only the broadcast triggers?
>>
>> Many thanks again
>>
>> Chris
>>
>> -----Original Message-----
>> From: freeswitch-users-bounces at lists.freeswitch.org
>> [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of
>> Kristian Kielhofner
>> Sent: 21 September 2011 15:04
>> To: FreeSWITCH Users Help
>> Subject: Re: [Freeswitch-users] Early media playback
>>
>> While I haven't done this before you probably need to ignore the 183
>> from the remote end and set execute_on_preanswer or possibly
>> execute_on_media:
>>
>> <action application="export"
>> data="nolocal:execute_on_preanswer=playback somefile"/>
>> <action application="export" data="nolocal:ignore_early_media=true"/>
>> <action application="bridge" data="bridge/string"/>
>>
>> However if you're getting a codec error now you probably have some
>> other issues to deal with. It looks like you're trying to use
>> mod_native_file. Can you try a normal wav (using mod_sndfile) and try
>> it again with the above code snippet? Send the FS console logs to
>> http://pastebin.freeswitch.org.
>>
>> On Wed, Sep 21, 2011 at 5:24 AM, Chris Martineau
>> <chris at ghosttelecom.com> wrote:
>>> Hi
>>>
>>>
>>>
>>> Trying to play a custom announcement/welcome to the a leg on receiving
>> a 183
>>> from the far end.
>>>
>>> Have tried a straight playback just before the bridge which confirms
>> that it
>>> finds the playback file as the recording is heard but as this is a bit
>> nasty
>>> FS complains with a codec error and closes the call.
>>>
>>> Tried execute on media with the same playback details as follows...
>>>
>>> <action application="set" data="execute_on_media=playback
>> /path/mediafile"
>>>
>>> Which according to the logs seems to work but I get just silence until
>> I
>>> presume the file stops playing which is strange as the file plays fine
>> when
>>> using a forced playback?
>>>
>>> Logs in both cases show the same file being found and used
>> mediafile.PCMA.
>>>
>>>
>>>
>>> Also I would like to terminate the playback on answer but cannot find
>> any
>>> obvious process to do this. Obviously you could do an
>> execute_on_answer but
>>> can't see what I would execute to achieve the desired effect?
>>>
>>>
>>>
>>> Many thanks for any help you can offer.
>>>
>>>
>>>
>>> Regards
>>>
>>>
>>>
>>>
>>>
>>> Chris
>>>
>>>
>>>
>>> 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
>>>
>>>
>>
>>
>>
>> --
>> Kristian Kielhofner
>>
>>
>> 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
>>
>
>
>
> --
> Kristian Kielhofner
>
>
> 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
>
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list