<p dir="ltr">You might be able to set the "ringback" variable on the inbound leg then call the bridge application on the outbound leg dial string. If you insist to do it manually in lua, you need to set ringback on inbound leg and supply the inbound session object to the constructor for the outbound leg which is over complicated. </p>
<p dir="ltr">Based on what you are doing, I suggest that you consult one of the FS books or some of the wiki to properly understand the way the software works because you have several false assumptions going on.<br><br><br>
<br></p>
<p dir="ltr">On Aug 12, 2014 10:21 PM, "Michael Jerris" <<a href="mailto:mike@jerris.com">mike@jerris.com</a>> wrote:<br>
><br>
> only if its before you try calling the other party.<br>
><br>
> On Aug 12, 2014, at 9:44 PM, Leo Lau <<a href="mailto:ningliuxd@gmail.com">ningliuxd@gmail.com</a>> wrote:<br>
><br>
>> In the original mail,<br>
>>><br>
>>> Assume that Bob calls Alice, before Bob here the ringtone of Alice,may be a clip of music. When bob use voip phone, after he dials,<br>
>>> maybe there will be a bit longer time before he receives the ringtone. I want to play some music in this period. <br>
>><br>
>><br>
>> ——— the ringtone means the color ring of Alice. So, is there any way I can play my own music before the color ring?<br>
>><br>
>><br>
>> 发件人: Michael Jerris <<a href="mailto:mike@jerris.com">mike@jerris.com</a>><br>
>> 答复: FreeSWITCH Users Help <<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a>><br>
>> 日期: 2014年8月13日 星期三 5:01<br>
>> 至: FreeSWITCH Users Help <<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a>><br>
>> 主题: Re: [Freeswitch-users] play back and moh<br>
>><br>
>> I don't think we have any way to do this, you can use color ring back and you can ignore progress and play it right away, but you can not then have real ring indication take over. I'm not sure the feature makes any sense as it should never be more than a few seconds, in practice it would be a very strange effect to call someone and immediately get music, then a couple seconds later get ringing.<br>
>><br>
>> On Aug 12, 2014, at 12:11 PM, 刘宁 <<a href="mailto:ningliuxd@gmail.com">ningliuxd@gmail.com</a>> wrote:<br>
>><br>
>>> Hi all<br>
>>><br>
>>> Sorry to trouble you ,but I really came across a problem still remaining unsolved when using freeswitch to develop some features.<br>
>>> Assume that Bob calls Alice, before Bob here the ringtone of Alice,may be a clip of music. When bob use voip phone, after he dials,<br>
>>> maybe there will be a bit longer time before he receives the ringtone. I want to play some music in this period. <br>
>>><br>
>>> Here is the diaplan config <br>
>>> The path is :/usr/local/freeswitch/conf/dialplan/default/call.xml<br>
>>><br>
>>> Here is the content:<br>
>>><br>
>>> </extension><br>
>>> <extension name="testlua"><br>
>>> <condition field="destination_number" expression="^(\d{4}\d+)$"><br>
>>> <action application="playback" data="voicemail/qav_video_incoming.wav"/> <!-- just for test replace it later--><br>
>>> <action application="lua" data="gen_dialplan_xml.lua"/><br>
>>> </condition><br>
>>> </extension><br>
>>> </include><br>
>>><br>
>>><br>
>>> The lua scripts “gen_dialplan_xml.lua" have to set some arguments for the session and finally it calls freeswitch.bridge(session,newsession)<br>
>>><br>
>>> Assume that the time when entering the bridge function is t1, and the time when the ringtone of Alice arrives is t2, thus a time of (t1— t2) exists.<br>
>>> I want to play a music to Bob during this time. But the action of “playback” and “lua” seem to be applied sequentially, that means ,the music is not played during the (t1—t2)time.<br>
>>><br>
>>> I also tried<br>
>>><br>
>>> <extension name="testlua"><br>
>>> <condition field="destination_number" expression="^(\d{4}\d+)$"><br>
>>> <!--action application="playback" data="voicemail/qav_video_incoming.wav"/--> <!-- just for test replace it later--><br>
>>> <action application="set" data="hold_music=${sound_prefix}/voicemail/qav_video_incoming.wav"/> <!-- just for test replace it later--><br>
>>> <action application="set" data="tmp_hold_music=${sound_prefix}/voicemail/qav_video_incoming.wav"/> <!-- just for test replace it later--><br>
>>> <action application="lua" data="gen_dialplan_xml.lua"/><br>
>>> </condition><br>
>>> </extension><br>
>>> </include><br>
>>><br>
>>><br>
>>> And the music file does exist, but it still did not work.<br>
>>><br>
>>><br>
>>> How could I complete this feature?Do I have to complete this in the lua scripts?<br>
>>><br>
>>><br>
>>> Than you in advance,looking forward to your reply.<br>
>><br>
>><br>
><br>
><br>
> _________________________________________________________________________<br>
> Professional FreeSWITCH Consulting Services:<br>
> <a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
> <a href="http://www.freeswitchsolutions.com">http://www.freeswitchsolutions.com</a><br>
><br>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
> <a href="http://www.cudatel.com">http://www.cudatel.com</a><br>
><br>
> Official FreeSWITCH Sites<br>
> <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>
> <a href="http://wiki.freeswitch.org">http://wiki.freeswitch.org</a><br>
> <a href="http://www.cluecon.com">http://www.cluecon.com</a><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">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
> <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>
><br>
</p>