This is a classic case of using the wrong tool for the job. Let the dialplan bridge app do the work for you. Only use Lua where you really need it. There is rarely a good reason to bridge from within a dialplan script.

-MC

On Tue, May 8, 2012 at 4:45 AM, Anita Hall <anita.hall@simmortel.com> wrote:
Hi

I am following FreeSWITCH cookbook Chapter 1, Page 15: Ringing multiple endpoints sequentially.

I am also using mod_lua to do a simple app that does the bridging.

The problem scenario is as follows: The first endpoint rings. It is not answered. The second endpoint starts ringing. It is answered but the call is immediately disconnected. And then the first endpoint starts ringing again!

Probably, the reason why the first endpoint starts ringing again is a repeat try in bridge application. Is there anyway to disable it ?

Here is my dialplan snippet

<action application="lua" data="bridge.lua 1 8860133622 | 9711450555"/>

And here is bridge.lua

# cat scripts/bridge.lua

-- arguments from dialplan
setAnswer       = argv[1]
num1            = argv[2]
limiter1        = argv[3]
num2            = argv[4]


session:answer()
welcome= "welcome.wav"
session:streamFile(welcome)
freeswitch.consoleLog("INFO","Prompt file is '" .. welcome .. "'\n")

freeswitch.consoleLog("INFO","Arguments '" .. argv[1] .. " " .. argv[2] .. " " .. argv[3] .. " " .. argv[4] .. "'\n")
globalChanVars = "{ignore_early_media=true,originate_continue_on_timeout=true,call_timout=60,monitor_early_media_fail=user_busy:2:480+620!destination_out_of_order:2:1776.7}"

chan1 = "[leg_timeout=15]" .. "freetdm/1/a/" .. num1
chan2 = "[leg_timeout=55]" .. "freetdm/1/a/" .. num2

-- global channel variables are applicable to all channels in the session
newSession = freeswitch.Session(globalChanVars .. chan1 .. limiter1 .. chan2)

-- bridge new Session to the current session
freeswitch.bridge(session, newSession)



Much thanks!


regards,
Anita


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

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