吴伟贤のBlog

Feed Rss

freeswitch lua 回拨 主叫被叫号码

10.08.2013, freeswitch, by .

freeswitch lua 回拨 主叫被叫号码

功能实现

1:主叫呼叫接入号,挂断主叫回busy给主叫

2:回拨 接通主叫号码及被叫号码

dialplan代码:

<extension name=”testlua”>
<condition field=”destination_number” expression=”^11111$”>
<action application=”lua” data=”test.lua ${destination_number}”/>
</condition>
</extension>

test.lua代码:

freeswitch.consoleLog("notice","test.lua debug\n")
local caller=session:getVariable("caller_id_number");
local callee=argv[1];
freeswitch.consoleLog("notice","get caller "..caller.."\n")
freeswitch.consoleLog("notice","get callee "..callee.."\n")
session:hangup("USER_BUSY");
api = freeswitch.API();
local callstring = "bgapi originate {ignore_early_media=true,origination_caller_id_number="..callee..",origination_caller_id_name="..callee.."}user/"..caller.." \'&bridge(sofia/gateway/szcmcc/"..callee..")\'";
freeswitch.consoleLog("notice", callstring.."\n");
api:executeString(callstring);
freeswitch.consoleLog("notice", "Leave callback Scripts\n");

缺点

还不知道怎么实现等待几秒后再回拨。
呼叫接入号后会马上进行回拨操作。

评论已关闭。