Stasis application WebSocket support

This is the API that binds the Stasis dialplan application to external
Stasis applications. It also adds the beginnings of WebSocket
application support.

This module registers a dialplan function named Stasis, which is used
to put a channel into the named Stasis app. As a channel enters and
leaves the Stasis diaplan application, the Stasis app receives a
'stasis-start' and 'stasis-end' events.

Stasis apps register themselves using the stasis_app_register and
stasis_app_unregister functions. Messages are sent to an application
using stasis_app_send.

Finally, Stasis apps control channels through the use of the
stasis_app_control object, and the family of stasis_app_control_*
functions.

Other changes along for the ride are:
 * An ast_frame_dtor function that's RAII_VAR safe
 * Some common JSON encoders for name/number, timeval, and
   context/extension/priority

Review: https://reviewboard.asterisk.org/r/2361/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384879 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
David M. Lee
2013-04-08 13:27:45 +00:00
parent 426095bc55
commit a2a53cc306
14 changed files with 1536 additions and 52 deletions

View File

@@ -67,17 +67,6 @@ static void dispose_jitterbuffer(struct ast_jb *jb)
jb->jbobj = NULL;
}
/*! \internal \brief Destructor for frames
* \param f The frame to destroy
*/
static void dispose_frame(struct ast_frame *f)
{
if (!f) {
return;
}
ast_frfree(f);
}
/*! \internal \brief Create a test frame
* \param timestamp the time in ms of the frame
* \param seqno the frame's sequence number
@@ -217,8 +206,8 @@ static struct ast_jb default_jb = {
RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
const struct ast_jb_impl *impl; \
struct ast_jb_conf conf; \
RAII_VAR(struct ast_frame *, expected_frame, NULL, dispose_frame); \
RAII_VAR(struct ast_frame *, actual_frame, NULL, dispose_frame); \
RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
int res; \
\
switch (cmd) { \
@@ -273,8 +262,8 @@ static struct ast_jb default_jb = {
RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
const struct ast_jb_impl *impl; \
struct ast_jb_conf conf; \
RAII_VAR(struct ast_frame *, expected_frame, NULL, dispose_frame); \
RAII_VAR(struct ast_frame *, actual_frame, NULL, dispose_frame); \
RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
int res; \
long next; \
int i; \
@@ -336,7 +325,7 @@ static struct ast_jb default_jb = {
RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
const struct ast_jb_impl *impl; \
struct ast_jb_conf conf; \
RAII_VAR(struct ast_frame *, expected_frame, NULL, dispose_frame); \
RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
int res; \
int i; \
\
@@ -401,8 +390,8 @@ static struct ast_jb default_jb = {
RAII_VAR(struct ast_jb *, jb, &default_jb, dispose_jitterbuffer); \
const struct ast_jb_impl *impl; \
struct ast_jb_conf conf; \
RAII_VAR(struct ast_frame *, actual_frame, NULL, dispose_frame); \
RAII_VAR(struct ast_frame *, expected_frame, NULL, dispose_frame); \
RAII_VAR(struct ast_frame *, actual_frame, NULL, ast_frame_dtor); \
RAII_VAR(struct ast_frame *, expected_frame, NULL, ast_frame_dtor); \
int res; \
long next; \
int i; \