е
Size: a a a
е
е
EK
е
е
е
е
F
if (session:ready()) then
-- ?
else
-- local reason = session:hangupCause()
local reason = session:getVariable("originate_disposition");
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
if ( reason == "USER_BUSY" ) then
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
elseif ( reason == "NO_ANSWER" ) then
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
elseif ( reason == "ORIGINATOR_CANCEL" ) then
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
end
end
P
if (session:ready()) then
-- ?
else
-- local reason = session:hangupCause()
local reason = session:getVariable("originate_disposition");
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
if ( reason == "USER_BUSY" ) then
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
elseif ( reason == "NO_ANSWER" ) then
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
elseif ( reason == "ORIGINATOR_CANCEL" ) then
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
end
end
P
F
P
F
P
P
F
F
P
h
if (session:ready()) then
-- ?
else
-- local reason = session:hangupCause()
local reason = session:getVariable("originate_disposition");
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
if ( reason == "USER_BUSY" ) then
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
elseif ( reason == "NO_ANSWER" ) then
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
elseif ( reason == "ORIGINATOR_CANCEL" ) then
freeswitch.consoleLog("info", "session:hangupCause() = " .. reason )
end
end
freeswitch.consoleLog("WARNING","Before first call\n")
first_session = freeswitch.Session("user/1000")
if (first_session:ready()) then
freeswitch.consoleLog("WARNING","first leg answered\n")
second_session = freeswitch.Session("user/1002")
if (second_session:ready()) then
freeswitch.consoleLog("WARNING","second leg answered\n")
freeswitch.bridge(first_session, second_session)
freeswitch.consoleLog("WARNING","After bridge\n")
else
freeswitch.consoleLog("WARNING","second leg failed\n")
end
else
freeswitch.consoleLog("WARNING","first leg failed\n")
end
-- Initiate an outbound call
obSession = freeswitch.Session("sofia/192.168.0.4/1002")
-- Check to see if the call was answered
if obSession:ready() then
-- Do something good here
else -- This means the call was not answered ... Check for the reason
local obCause = obSession:hangupCause()
freeswitch.consoleLog("info", "obSession:hangupCause() = " .. obCause )
if ( obCause == "USER_BUSY" ) then -- SIP 486
-- For BUSY you may reschedule the call for later
elseif ( obCause == "NO_ANSWER" ) then
-- Call them back in an hour
elseif ( obCause == "ORIGINATOR_CANCEL" ) then -- SIP 487
-- May need to check for network congestion or problems
else
-- Log these issues
end
end
F