This patch adds a scheduler thread to the core and moves the heartbeat
event to use the new scheduler as an example.
Also The following features are implemented that use this scheduler:
sched_hangup dialplan application:
<action application="sched_hangup" data="+10 normal_clearing bleg"/>
** The cause code is optional and the optional bleg keyword will only hangup the
channel the current channel is bridged to if the call is in a bridge.
sched_transfer dialplan application:
<action application="sched_transfer" data="+10 1000 XML default"/>
** The last 2 args (dialplan and context) are optional
sched_broadcast dialplan application:
<action application="sched_broadcast" data="+10 playback:/tmp/foo.wav"/>
<action application="sched_broadcast" data="+10 playback!normal_clearing:/tmp/foo.wav"/>
** The optional !<cause_code> can be added to make the channel hangup after broadcasting the file.
sched_hangup api function:
sched_hangup +10 <uuid_string> normal_clearing
** The cause code is optional
sched_transfer api function:
sched_transfer +10 <uuid_string> 1000 XML default
** The last 2 args (dialplan and context) are optional
sched_broadcast api function:
sched_broadcast +10 <uuid_str> playback:/tmp/foo.wav
sched_broadcast +10 <uuid_str> playback!normal_clearing:/tmp/foo.wav
** The optional !<cause_code> can be added to make the channel hangup after broadcasting the file.
The new C functions in the core are documented in the doxeygen.
*NOTE* This commit should satisfy at least 2 bounties on the wiki
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4785 d0543943-73ff-0310-b7d9-9358b9ac24b2
The most important thing to check is you now must create a new session with a blank constructor:
s = new Session();
then call s.originate() with all the former args that were documented to be for the constructor
this will will return true or false to indicate if the call worked.
See below this sample code demonstrates all of the changes:
////////////////////////////////////////////////////////////////////////////////
function on_hangup(hup_session)
{
console_log("debug", "HANGUP!!!! name: " + hup_session.name + " cause: " + hup_session.cause + "\n");
//exit here would end the script so you could cleanup and just be done
//exit();
}
//set the on_hangup function to be called when this session is hungup
session.setHangupHook(on_hangup);
//allocate a new b_session
var b_session = new Session();
//make a call with b_session. If this fails, all we will be able to access is the b_session.cause attr
if (b_session.originate(session, "sofia/mydomain.com/888@conference.freeswitch.org")) {
//Inform the scripting engine to automaticly hang this session up when the script ends
b_session.setAutoHangup(true);
//set the on_hangup function to be called when this session is hungup
b_session.setHangupHook(on_hangup);
//bridge session with b_session
bridge(session, b_session);
} else {
console_log("debug", "Originate Failed.. cause: " + b_session.cause + "\n");
}
////////////////////////////////////////////////////////////////////////////////
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4773 d0543943-73ff-0310-b7d9-9358b9ac24b2
Do the entire transaction as a single exec, instead of 3 separate ones to resolve issue of unmatched transaction error.
try really hard to commit the transaction (1000 times) but we no longer try forever. If 1000 times fail, you will lose some update/insert/deletes from the core db, but we will no longer continue to loop forever and stop processing the sql queue in the case of an error.
added better overflow protection to the buffer, we now ignore sql strings we get over 64k. (not full transactions, just individual sql strings that we get queued). Previously this caused a buffer overflow.
We now use sprintf instead of snprintf as we are already handling overflow checks outside of the sprintf.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4338 d0543943-73ff-0310-b7d9-9358b9ac24b2