FreeSWITCH/Lua Call, Wait & Enter Code

This example uses Lua to dial out to a number, wait a few milliseconds, enter a PIN, wait a bit more then enter a conference.

-- call-wait-code
-- Calls a Number, Waits a Bit, Enters the Code
-- <action application="lua" data="call-wait-code.lua $call $wait $code"/>

-- api = freeswitch.API();
-- freeswitch.consoleLog("info", "Calling");

call = argv[1];
wait = argv[2];
code = argv[3];

legA = freeswitch.Session("{ignore_early_media=true,originate_timeout=90,hangup_after_bridge=true,leg=1}sofia/gateway/plivo/" .. call);

if (legA:ready()) then


	legA:execute("send_dtmf", code .. "@500");


	-- Make this do what you want
	legA:execute("conference", "1234");
	-- freeswitch.bridge(session1, session2);