mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 03:08:45 +00:00
Move JSON event generators into separate modules
This moves the JSON event generators out of the Stasis-HTTP modules and into standalone JSON-related counterparts so that Stasis-HTTP and res_stasis can depend on them without creating dependency cycles. This also provides a future location for Swagger Model validator functions once the generators for that code are written. Review: https://reviewboard.asterisk.org/r/2534/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388668 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*** MODULEINFO
|
/*** MODULEINFO
|
||||||
|
<depend>res_stasis_json_events</depend>
|
||||||
<support_level>core</support_level>
|
<support_level>core</support_level>
|
||||||
***/
|
***/
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/strings.h"
|
#include "asterisk/strings.h"
|
||||||
#include "asterisk/stasis_message_router.h"
|
#include "asterisk/stasis_message_router.h"
|
||||||
#include "asterisk/callerid.h"
|
#include "asterisk/callerid.h"
|
||||||
#include "stasis_http/resource_events.h"
|
#include "stasis_json/resource_events.h"
|
||||||
|
|
||||||
/*! Time to wait for a frame in the application */
|
/*! Time to wait for a frame in the application */
|
||||||
#define MAX_WAIT_MS 200
|
#define MAX_WAIT_MS 200
|
||||||
|
@@ -44,7 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/stasis_app.h"
|
#include "asterisk/stasis_app.h"
|
||||||
#include "stasis_http/resource_events.h"
|
#include "stasis_http/resource_events.h"
|
||||||
#include "asterisk/stasis_channels.h"
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Parameter parsing callback for /events.
|
* \brief Parameter parsing callback for /events.
|
||||||
@@ -79,524 +78,6 @@ static struct stasis_rest_handlers events = {
|
|||||||
.children = { }
|
.children = { }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_snapshot_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
|
|
||||||
event = ast_json_object_create();
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_snapshot", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_destroyed_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
struct ast_json *validator;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "cause");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "cause_txt");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_destroyed", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_caller_id_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
struct ast_json *validator;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "caller_presentation_txt");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "caller_presentation");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_caller_id", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_hangup_request_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
struct ast_json *validator;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "soft");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
}
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "cause");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_hangup_request", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_application_replaced_create(
|
|
||||||
struct ast_json *blob
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
struct ast_json *validator;
|
|
||||||
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "application");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "application_replaced", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_varset_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
struct ast_json *validator;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "variable");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "value");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_varset", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_userevent_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
struct ast_json *validator;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "eventname");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_userevent", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_created_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
|
|
||||||
event = ast_json_object_create();
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_created", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_stasis_start_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
struct ast_json *validator;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "args");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "stasis_start", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_dialplan_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
struct ast_json *validator;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "application");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "application_data");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_dialplan", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_state_change_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
|
|
||||||
event = ast_json_object_create();
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_state_change", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_channel_dtmf_received_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
struct ast_json *validator;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "digit");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "channel_dtmf_received", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ast_json *stasis_json_event_stasis_end_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
|
|
||||||
event = ast_json_object_create();
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
message = ast_json_pack("{s: o}", "stasis_end", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int load_module(void)
|
static int load_module(void)
|
||||||
{
|
{
|
||||||
stasis_app_ref();
|
stasis_app_ref();
|
||||||
|
60
res/res_stasis_json_asterisk.c
Normal file
60
res/res_stasis_json_asterisk.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/res_stasis_http_resource.c.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Asterisk resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*** MODULEINFO
|
||||||
|
<support_level>core</support_level>
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
|
#include "asterisk/module.h"
|
||||||
|
#include "asterisk/json.h"
|
||||||
|
#include "stasis_json/resource_asterisk.h"
|
||||||
|
static int load_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unload_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
|
||||||
|
"Stasis JSON Generators and Validators - Asterisk resources",
|
||||||
|
.load = load_module,
|
||||||
|
.unload = unload_module,
|
||||||
|
.load_pri = AST_MODPRI_DEFAULT,
|
||||||
|
);
|
4
res/res_stasis_json_asterisk.exports.in
Normal file
4
res/res_stasis_json_asterisk.exports.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
60
res/res_stasis_json_bridges.c
Normal file
60
res/res_stasis_json_bridges.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/res_stasis_http_resource.c.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Bridge resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*** MODULEINFO
|
||||||
|
<support_level>core</support_level>
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
|
#include "asterisk/module.h"
|
||||||
|
#include "asterisk/json.h"
|
||||||
|
#include "stasis_json/resource_bridges.h"
|
||||||
|
static int load_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unload_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
|
||||||
|
"Stasis JSON Generators and Validators - Bridge resources",
|
||||||
|
.load = load_module,
|
||||||
|
.unload = unload_module,
|
||||||
|
.load_pri = AST_MODPRI_DEFAULT,
|
||||||
|
);
|
4
res/res_stasis_json_bridges.exports.in
Normal file
4
res/res_stasis_json_bridges.exports.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
60
res/res_stasis_json_channels.c
Normal file
60
res/res_stasis_json_channels.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/res_stasis_http_resource.c.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Channel resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*** MODULEINFO
|
||||||
|
<support_level>core</support_level>
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
|
#include "asterisk/module.h"
|
||||||
|
#include "asterisk/json.h"
|
||||||
|
#include "stasis_json/resource_channels.h"
|
||||||
|
static int load_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unload_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
|
||||||
|
"Stasis JSON Generators and Validators - Channel resources",
|
||||||
|
.load = load_module,
|
||||||
|
.unload = unload_module,
|
||||||
|
.load_pri = AST_MODPRI_DEFAULT,
|
||||||
|
);
|
4
res/res_stasis_json_channels.exports.in
Normal file
4
res/res_stasis_json_channels.exports.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
60
res/res_stasis_json_endpoints.c
Normal file
60
res/res_stasis_json_endpoints.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/res_stasis_http_resource.c.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Endpoint resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*** MODULEINFO
|
||||||
|
<support_level>core</support_level>
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
|
#include "asterisk/module.h"
|
||||||
|
#include "asterisk/json.h"
|
||||||
|
#include "stasis_json/resource_endpoints.h"
|
||||||
|
static int load_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unload_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
|
||||||
|
"Stasis JSON Generators and Validators - Endpoint resources",
|
||||||
|
.load = load_module,
|
||||||
|
.unload = unload_module,
|
||||||
|
.load_pri = AST_MODPRI_DEFAULT,
|
||||||
|
);
|
4
res/res_stasis_json_endpoints.exports.in
Normal file
4
res/res_stasis_json_endpoints.exports.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
580
res/res_stasis_json_events.c
Normal file
580
res/res_stasis_json_events.c
Normal file
@@ -0,0 +1,580 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/res_stasis_http_resource.c.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief WebSocket resource
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*** MODULEINFO
|
||||||
|
<support_level>core</support_level>
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
|
#include "asterisk/module.h"
|
||||||
|
#include "asterisk/json.h"
|
||||||
|
#include "stasis_json/resource_events.h"
|
||||||
|
#include "asterisk/stasis_channels.h"
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_snapshot_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
|
||||||
|
event = ast_json_object_create();
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_snapshot", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_destroyed_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
struct ast_json *validator;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "cause");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "cause_txt");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_destroyed", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_caller_id_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
struct ast_json *validator;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "caller_presentation_txt");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "caller_presentation");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_caller_id", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_hangup_request_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
struct ast_json *validator;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "soft");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
}
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "cause");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_hangup_request", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_application_replaced_create(
|
||||||
|
struct ast_json *blob
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
struct ast_json *validator;
|
||||||
|
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "application");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "application_replaced", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_varset_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
struct ast_json *validator;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "variable");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "value");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_varset", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_userevent_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
struct ast_json *validator;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "eventname");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_userevent", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_created_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
|
||||||
|
event = ast_json_object_create();
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_created", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_stasis_start_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
struct ast_json *validator;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "args");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "stasis_start", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_dialplan_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
struct ast_json *validator;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "application");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "application_data");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_dialplan", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_state_change_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
|
||||||
|
event = ast_json_object_create();
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_state_change", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_channel_dtmf_received_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
struct ast_json *validator;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "digit");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "channel_dtmf_received", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ast_json *stasis_json_event_stasis_end_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
|
||||||
|
event = ast_json_object_create();
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
message = ast_json_pack("{s: o}", "stasis_end", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int load_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unload_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
|
||||||
|
"Stasis JSON Generators and Validators - WebSocket resource",
|
||||||
|
.load = load_module,
|
||||||
|
.unload = unload_module,
|
||||||
|
.load_pri = AST_MODPRI_DEFAULT,
|
||||||
|
);
|
18
res/res_stasis_json_events.exports.in
Normal file
18
res/res_stasis_json_events.exports.in
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
global:
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_snapshot_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_destroyed_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_caller_id_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_hangup_request_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_application_replaced_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_varset_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_userevent_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_created_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_stasis_start_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_dialplan_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_state_change_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_channel_dtmf_received_create;
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_stasis_end_create;
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
60
res/res_stasis_json_playback.c
Normal file
60
res/res_stasis_json_playback.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/res_stasis_http_resource.c.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Playback control resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*** MODULEINFO
|
||||||
|
<support_level>core</support_level>
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
|
#include "asterisk/module.h"
|
||||||
|
#include "asterisk/json.h"
|
||||||
|
#include "stasis_json/resource_playback.h"
|
||||||
|
static int load_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unload_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
|
||||||
|
"Stasis JSON Generators and Validators - Playback control resources",
|
||||||
|
.load = load_module,
|
||||||
|
.unload = unload_module,
|
||||||
|
.load_pri = AST_MODPRI_DEFAULT,
|
||||||
|
);
|
4
res/res_stasis_json_playback.exports.in
Normal file
4
res/res_stasis_json_playback.exports.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
60
res/res_stasis_json_recordings.c
Normal file
60
res/res_stasis_json_recordings.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/res_stasis_http_resource.c.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Recording resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*** MODULEINFO
|
||||||
|
<support_level>core</support_level>
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
|
#include "asterisk/module.h"
|
||||||
|
#include "asterisk/json.h"
|
||||||
|
#include "stasis_json/resource_recordings.h"
|
||||||
|
static int load_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unload_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
|
||||||
|
"Stasis JSON Generators and Validators - Recording resources",
|
||||||
|
.load = load_module,
|
||||||
|
.unload = unload_module,
|
||||||
|
.load_pri = AST_MODPRI_DEFAULT,
|
||||||
|
);
|
4
res/res_stasis_json_recordings.exports.in
Normal file
4
res/res_stasis_json_recordings.exports.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
60
res/res_stasis_json_sounds.c
Normal file
60
res/res_stasis_json_sounds.c
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/res_stasis_http_resource.c.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Sound resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*** MODULEINFO
|
||||||
|
<support_level>core</support_level>
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
|
#include "asterisk/module.h"
|
||||||
|
#include "asterisk/json.h"
|
||||||
|
#include "stasis_json/resource_sounds.h"
|
||||||
|
static int load_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unload_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
|
||||||
|
"Stasis JSON Generators and Validators - Sound resources",
|
||||||
|
.load = load_module,
|
||||||
|
.unload = unload_module,
|
||||||
|
.load_pri = AST_MODPRI_DEFAULT,
|
||||||
|
);
|
4
res/res_stasis_json_sounds.exports.in
Normal file
4
res/res_stasis_json_sounds.exports.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
@@ -53,10 +53,4 @@ struct ast_get_asterisk_info_args {
|
|||||||
*/
|
*/
|
||||||
void stasis_http_get_asterisk_info(struct ast_variable *headers, struct ast_get_asterisk_info_args *args, struct stasis_http_response *response);
|
void stasis_http_get_asterisk_info(struct ast_variable *headers, struct ast_get_asterisk_info_args *args, struct stasis_http_response *response);
|
||||||
|
|
||||||
/*
|
|
||||||
* JSON models
|
|
||||||
*
|
|
||||||
* AsteriskInfo
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* _ASTERISK_RESOURCE_ASTERISK_H */
|
#endif /* _ASTERISK_RESOURCE_ASTERISK_H */
|
||||||
|
@@ -151,12 +151,4 @@ struct ast_record_bridge_args {
|
|||||||
*/
|
*/
|
||||||
void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_bridge_args *args, struct stasis_http_response *response);
|
void stasis_http_record_bridge(struct ast_variable *headers, struct ast_record_bridge_args *args, struct stasis_http_response *response);
|
||||||
|
|
||||||
/*
|
|
||||||
* JSON models
|
|
||||||
*
|
|
||||||
* Bridge
|
|
||||||
* - channels: List[string] (required)
|
|
||||||
* - bridgeType: string (required)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* _ASTERISK_RESOURCE_BRIDGES_H */
|
#endif /* _ASTERISK_RESOURCE_BRIDGES_H */
|
||||||
|
@@ -241,34 +241,4 @@ struct ast_record_channel_args {
|
|||||||
*/
|
*/
|
||||||
void stasis_http_record_channel(struct ast_variable *headers, struct ast_record_channel_args *args, struct stasis_http_response *response);
|
void stasis_http_record_channel(struct ast_variable *headers, struct ast_record_channel_args *args, struct stasis_http_response *response);
|
||||||
|
|
||||||
/*
|
|
||||||
* JSON models
|
|
||||||
*
|
|
||||||
* Originated
|
|
||||||
* DialplanCEP
|
|
||||||
* - priority: long (required)
|
|
||||||
* - exten: string (required)
|
|
||||||
* - context: string (required)
|
|
||||||
* Channel
|
|
||||||
* - accountcode: string (required)
|
|
||||||
* - linkedid: string (required)
|
|
||||||
* - name: string (required)
|
|
||||||
* - userfield: string (required)
|
|
||||||
* - caller: CallerID (required)
|
|
||||||
* - creationtime: Date (required)
|
|
||||||
* - state: string (required)
|
|
||||||
* - parkinglot: string (required)
|
|
||||||
* - peeraccount: string (required)
|
|
||||||
* - appl: string (required)
|
|
||||||
* - connected: CallerID (required)
|
|
||||||
* - uniqueid: string (required)
|
|
||||||
* - hangupsource: string (required)
|
|
||||||
* - dialplan: DialplanCEP (required)
|
|
||||||
* - data: string (required)
|
|
||||||
* CallerID
|
|
||||||
* - name: string (required)
|
|
||||||
* - number: string (required)
|
|
||||||
* Dialed
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* _ASTERISK_RESOURCE_CHANNELS_H */
|
#endif /* _ASTERISK_RESOURCE_CHANNELS_H */
|
||||||
|
@@ -79,12 +79,4 @@ struct ast_get_endpoint_args {
|
|||||||
*/
|
*/
|
||||||
void stasis_http_get_endpoint(struct ast_variable *headers, struct ast_get_endpoint_args *args, struct stasis_http_response *response);
|
void stasis_http_get_endpoint(struct ast_variable *headers, struct ast_get_endpoint_args *args, struct stasis_http_response *response);
|
||||||
|
|
||||||
/*
|
|
||||||
* JSON models
|
|
||||||
*
|
|
||||||
* Endpoint
|
|
||||||
* - resource: string (required)
|
|
||||||
* - technology: string (required)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* _ASTERISK_RESOURCE_ENDPOINTS_H */
|
#endif /* _ASTERISK_RESOURCE_ENDPOINTS_H */
|
||||||
|
@@ -55,240 +55,4 @@ struct ast_event_websocket_args {
|
|||||||
*/
|
*/
|
||||||
void stasis_http_event_websocket(struct ast_variable *headers, struct ast_event_websocket_args *args, struct stasis_http_response *response);
|
void stasis_http_event_websocket(struct ast_variable *headers, struct ast_event_websocket_args *args, struct stasis_http_response *response);
|
||||||
|
|
||||||
struct ast_channel_snapshot;
|
|
||||||
struct ast_bridge_snapshot;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Some part of channel state changed.
|
|
||||||
*
|
|
||||||
* \param channel The channel to be used to generate this event
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_snapshot_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Notification that a channel has been destroyed.
|
|
||||||
*
|
|
||||||
* \param channel The channel to be used to generate this event
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
* - cause: integer - Integer representation of the cause of the hangup (required)
|
|
||||||
* - cause_txt: string - Text representation of the cause of the hangup (required)
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_destroyed_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Channel changed Caller ID.
|
|
||||||
*
|
|
||||||
* \param channel The channel that changed Caller ID.
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
* - caller_presentation_txt: string - The text representation of the Caller Presentation value. (required)
|
|
||||||
* - caller_presentation: integer - The integer representation of the Caller Presentation value. (required)
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_caller_id_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief A hangup was requested on the channel.
|
|
||||||
*
|
|
||||||
* \param channel The channel on which the hangup was requested.
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
* - soft: boolean - Whether the hangup request was a soft hangup request.
|
|
||||||
* - cause: integer - Integer representation of the cause of the hangup.
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_hangup_request_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Notification that another WebSocket has taken over for an application.
|
|
||||||
*
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
* - application: string (required)
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_application_replaced_create(
|
|
||||||
struct ast_json *blob
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Channel variable changed.
|
|
||||||
*
|
|
||||||
* \param channel The channel on which the variable was set.
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
* - variable: string - The variable that changed. (required)
|
|
||||||
* - value: string - The new value of the variable. (required)
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_varset_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief User-generated event with additional user-defined fields in the object.
|
|
||||||
*
|
|
||||||
* \param channel The channel that signaled the user event.
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
* - eventname: string - The name of the user event. (required)
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_userevent_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Notification that a channel has been created.
|
|
||||||
*
|
|
||||||
* \param channel The channel to be used to generate this event
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_created_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Notification that a channel has entered a Stasis appliction.
|
|
||||||
*
|
|
||||||
* \param channel The channel to be used to generate this event
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
* - args: List[string] - Arguments to the application (required)
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_stasis_start_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Channel changed location in the dialplan.
|
|
||||||
*
|
|
||||||
* \param channel The channel that changed dialplan location.
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
* - application: string - The application that the channel is currently in. (required)
|
|
||||||
* - application_data: string - The data that was passed to the application when it was invoked. (required)
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_dialplan_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Notification of a channel's state change.
|
|
||||||
*
|
|
||||||
* \param channel The channel to be used to generate this event
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_state_change_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief DTMF received on a channel.
|
|
||||||
*
|
|
||||||
* \param channel The channel on which DTMF was received
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
* - digit: string - DTMF digit received (0-9, A-E, # or *) (required)
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_channel_dtmf_received_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot,
|
|
||||||
struct ast_json *blob
|
|
||||||
);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Notification that a channel has left a Stasis appliction.
|
|
||||||
*
|
|
||||||
* \param channel The channel to be used to generate this event
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
struct ast_json *stasis_json_event_stasis_end_create(
|
|
||||||
struct ast_channel_snapshot *channel_snapshot
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* JSON models
|
|
||||||
*
|
|
||||||
* ChannelSnapshot
|
|
||||||
* ChannelDestroyed
|
|
||||||
* - cause: integer (required)
|
|
||||||
* - cause_txt: string (required)
|
|
||||||
* ChannelCallerId
|
|
||||||
* - caller_presentation_txt: string (required)
|
|
||||||
* - caller_presentation: integer (required)
|
|
||||||
* ChannelHangupRequest
|
|
||||||
* - soft: boolean
|
|
||||||
* - cause: integer
|
|
||||||
* ApplicationReplaced
|
|
||||||
* - application: string (required)
|
|
||||||
* ChannelVarset
|
|
||||||
* - variable: string (required)
|
|
||||||
* - value: string (required)
|
|
||||||
* ChannelUserevent
|
|
||||||
* - eventname: string (required)
|
|
||||||
* ChannelCreated
|
|
||||||
* StasisStart
|
|
||||||
* - args: List[string] (required)
|
|
||||||
* ChannelDialplan
|
|
||||||
* - application: string (required)
|
|
||||||
* - application_data: string (required)
|
|
||||||
* ChannelStateChange
|
|
||||||
* ChannelDtmfReceived
|
|
||||||
* - digit: string (required)
|
|
||||||
* Event
|
|
||||||
* - channel_created: ChannelCreated
|
|
||||||
* - channel_destroyed: ChannelDestroyed
|
|
||||||
* - channel_dialplan: ChannelDialplan
|
|
||||||
* - channel_varset: ChannelVarset
|
|
||||||
* - application_replaced: ApplicationReplaced
|
|
||||||
* - channel_state_change: ChannelStateChange
|
|
||||||
* - stasis_start: StasisStart
|
|
||||||
* - application: string (required)
|
|
||||||
* - channel_hangup_request: ChannelHangupRequest
|
|
||||||
* - channel_userevent: ChannelUserevent
|
|
||||||
* - channel_snapshot: ChannelSnapshot
|
|
||||||
* - channel_dtmf_received: ChannelDtmfReceived
|
|
||||||
* - channel_caller_id: ChannelCallerId
|
|
||||||
* - stasis_end: StasisEnd
|
|
||||||
* StasisEnd
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* _ASTERISK_RESOURCE_EVENTS_H */
|
#endif /* _ASTERISK_RESOURCE_EVENTS_H */
|
||||||
|
@@ -81,11 +81,4 @@ struct ast_control_playback_args {
|
|||||||
*/
|
*/
|
||||||
void stasis_http_control_playback(struct ast_variable *headers, struct ast_control_playback_args *args, struct stasis_http_response *response);
|
void stasis_http_control_playback(struct ast_variable *headers, struct ast_control_playback_args *args, struct stasis_http_response *response);
|
||||||
|
|
||||||
/*
|
|
||||||
* JSON models
|
|
||||||
*
|
|
||||||
* Playback
|
|
||||||
* - id: string (required)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* _ASTERISK_RESOURCE_PLAYBACK_H */
|
#endif /* _ASTERISK_RESOURCE_PLAYBACK_H */
|
||||||
|
@@ -190,18 +190,4 @@ struct ast_unmute_recording_args {
|
|||||||
*/
|
*/
|
||||||
void stasis_http_unmute_recording(struct ast_variable *headers, struct ast_unmute_recording_args *args, struct stasis_http_response *response);
|
void stasis_http_unmute_recording(struct ast_variable *headers, struct ast_unmute_recording_args *args, struct stasis_http_response *response);
|
||||||
|
|
||||||
/*
|
|
||||||
* JSON models
|
|
||||||
*
|
|
||||||
* Recording
|
|
||||||
* - id: string (required)
|
|
||||||
* StoredRecording
|
|
||||||
* - durationSeconds: int
|
|
||||||
* - time: Date
|
|
||||||
* - id: string (required)
|
|
||||||
* - formats: List[string] (required)
|
|
||||||
* LiveRecording
|
|
||||||
* - id: string (required)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* _ASTERISK_RESOURCE_RECORDINGS_H */
|
#endif /* _ASTERISK_RESOURCE_RECORDINGS_H */
|
||||||
|
@@ -66,14 +66,4 @@ struct ast_get_stored_sound_args {
|
|||||||
*/
|
*/
|
||||||
void stasis_http_get_stored_sound(struct ast_variable *headers, struct ast_get_stored_sound_args *args, struct stasis_http_response *response);
|
void stasis_http_get_stored_sound(struct ast_variable *headers, struct ast_get_stored_sound_args *args, struct stasis_http_response *response);
|
||||||
|
|
||||||
/*
|
|
||||||
* JSON models
|
|
||||||
*
|
|
||||||
* Sound
|
|
||||||
* - lang: string (required)
|
|
||||||
* - text: string
|
|
||||||
* - id: string (required)
|
|
||||||
* - formats: List[string] (required)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif /* _ASTERISK_RESOURCE_SOUNDS_H */
|
#endif /* _ASTERISK_RESOURCE_SOUNDS_H */
|
||||||
|
46
res/stasis_json/resource_asterisk.h
Normal file
46
res/stasis_json/resource_asterisk.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Generated file - declares stubs to be implemented in
|
||||||
|
* res/stasis_json/resource_asterisk.c
|
||||||
|
*
|
||||||
|
* Asterisk resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/stasis_http_resource.h.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_RESOURCE_ASTERISK_H
|
||||||
|
#define _ASTERISK_RESOURCE_ASTERISK_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JSON models
|
||||||
|
*
|
||||||
|
* AsteriskInfo
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_RESOURCE_ASTERISK_H */
|
48
res/stasis_json/resource_bridges.h
Normal file
48
res/stasis_json/resource_bridges.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Generated file - declares stubs to be implemented in
|
||||||
|
* res/stasis_json/resource_bridges.c
|
||||||
|
*
|
||||||
|
* Bridge resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/stasis_http_resource.h.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_RESOURCE_BRIDGES_H
|
||||||
|
#define _ASTERISK_RESOURCE_BRIDGES_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JSON models
|
||||||
|
*
|
||||||
|
* Bridge
|
||||||
|
* - channels: List[string] (required)
|
||||||
|
* - bridgeType: string (required)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_RESOURCE_BRIDGES_H */
|
70
res/stasis_json/resource_channels.h
Normal file
70
res/stasis_json/resource_channels.h
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Generated file - declares stubs to be implemented in
|
||||||
|
* res/stasis_json/resource_channels.c
|
||||||
|
*
|
||||||
|
* Channel resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/stasis_http_resource.h.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_RESOURCE_CHANNELS_H
|
||||||
|
#define _ASTERISK_RESOURCE_CHANNELS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JSON models
|
||||||
|
*
|
||||||
|
* Originated
|
||||||
|
* DialplanCEP
|
||||||
|
* - priority: long (required)
|
||||||
|
* - exten: string (required)
|
||||||
|
* - context: string (required)
|
||||||
|
* Channel
|
||||||
|
* - accountcode: string (required)
|
||||||
|
* - linkedid: string (required)
|
||||||
|
* - name: string (required)
|
||||||
|
* - userfield: string (required)
|
||||||
|
* - caller: CallerID (required)
|
||||||
|
* - creationtime: Date (required)
|
||||||
|
* - state: string (required)
|
||||||
|
* - parkinglot: string (required)
|
||||||
|
* - peeraccount: string (required)
|
||||||
|
* - appl: string (required)
|
||||||
|
* - connected: CallerID (required)
|
||||||
|
* - uniqueid: string (required)
|
||||||
|
* - hangupsource: string (required)
|
||||||
|
* - dialplan: DialplanCEP (required)
|
||||||
|
* - data: string (required)
|
||||||
|
* CallerID
|
||||||
|
* - name: string (required)
|
||||||
|
* - number: string (required)
|
||||||
|
* Dialed
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_RESOURCE_CHANNELS_H */
|
48
res/stasis_json/resource_endpoints.h
Normal file
48
res/stasis_json/resource_endpoints.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Generated file - declares stubs to be implemented in
|
||||||
|
* res/stasis_json/resource_endpoints.c
|
||||||
|
*
|
||||||
|
* Endpoint resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/stasis_http_resource.h.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_RESOURCE_ENDPOINTS_H
|
||||||
|
#define _ASTERISK_RESOURCE_ENDPOINTS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JSON models
|
||||||
|
*
|
||||||
|
* Endpoint
|
||||||
|
* - resource: string (required)
|
||||||
|
* - technology: string (required)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_RESOURCE_ENDPOINTS_H */
|
275
res/stasis_json/resource_events.h
Normal file
275
res/stasis_json/resource_events.h
Normal file
@@ -0,0 +1,275 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Generated file - declares stubs to be implemented in
|
||||||
|
* res/stasis_json/resource_events.c
|
||||||
|
*
|
||||||
|
* WebSocket resource
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/stasis_http_resource.h.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_RESOURCE_EVENTS_H
|
||||||
|
#define _ASTERISK_RESOURCE_EVENTS_H
|
||||||
|
|
||||||
|
struct ast_channel_snapshot;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Some part of channel state changed.
|
||||||
|
*
|
||||||
|
* \param channel The channel to be used to generate this event
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_snapshot_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Notification that a channel has been destroyed.
|
||||||
|
*
|
||||||
|
* \param channel The channel to be used to generate this event
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
* - cause: integer - Integer representation of the cause of the hangup (required)
|
||||||
|
* - cause_txt: string - Text representation of the cause of the hangup (required)
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_destroyed_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Channel changed Caller ID.
|
||||||
|
*
|
||||||
|
* \param channel The channel that changed Caller ID.
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
* - caller_presentation_txt: string - The text representation of the Caller Presentation value. (required)
|
||||||
|
* - caller_presentation: integer - The integer representation of the Caller Presentation value. (required)
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_caller_id_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief A hangup was requested on the channel.
|
||||||
|
*
|
||||||
|
* \param channel The channel on which the hangup was requested.
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
* - soft: boolean - Whether the hangup request was a soft hangup request.
|
||||||
|
* - cause: integer - Integer representation of the cause of the hangup.
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_hangup_request_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Notification that another WebSocket has taken over for an application.
|
||||||
|
*
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
* - application: string (required)
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_application_replaced_create(
|
||||||
|
struct ast_json *blob
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Channel variable changed.
|
||||||
|
*
|
||||||
|
* \param channel The channel on which the variable was set.
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
* - variable: string - The variable that changed. (required)
|
||||||
|
* - value: string - The new value of the variable. (required)
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_varset_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief User-generated event with additional user-defined fields in the object.
|
||||||
|
*
|
||||||
|
* \param channel The channel that signaled the user event.
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
* - eventname: string - The name of the user event. (required)
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_userevent_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Notification that a channel has been created.
|
||||||
|
*
|
||||||
|
* \param channel The channel to be used to generate this event
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_created_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Notification that a channel has entered a Stasis appliction.
|
||||||
|
*
|
||||||
|
* \param channel The channel to be used to generate this event
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
* - args: List[string] - Arguments to the application (required)
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_stasis_start_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Channel changed location in the dialplan.
|
||||||
|
*
|
||||||
|
* \param channel The channel that changed dialplan location.
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
* - application: string - The application that the channel is currently in. (required)
|
||||||
|
* - application_data: string - The data that was passed to the application when it was invoked. (required)
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_dialplan_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Notification of a channel's state change.
|
||||||
|
*
|
||||||
|
* \param channel The channel to be used to generate this event
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_state_change_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief DTMF received on a channel.
|
||||||
|
*
|
||||||
|
* \param channel The channel on which DTMF was received
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
* - digit: string - DTMF digit received (0-9, A-E, # or *) (required)
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_channel_dtmf_received_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot,
|
||||||
|
struct ast_json *blob
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Notification that a channel has left a Stasis appliction.
|
||||||
|
*
|
||||||
|
* \param channel The channel to be used to generate this event
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
struct ast_json *stasis_json_event_stasis_end_create(
|
||||||
|
struct ast_channel_snapshot *channel_snapshot
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JSON models
|
||||||
|
*
|
||||||
|
* ChannelSnapshot
|
||||||
|
* ChannelDestroyed
|
||||||
|
* - cause: integer (required)
|
||||||
|
* - cause_txt: string (required)
|
||||||
|
* ChannelCallerId
|
||||||
|
* - caller_presentation_txt: string (required)
|
||||||
|
* - caller_presentation: integer (required)
|
||||||
|
* ChannelHangupRequest
|
||||||
|
* - soft: boolean
|
||||||
|
* - cause: integer
|
||||||
|
* ApplicationReplaced
|
||||||
|
* - application: string (required)
|
||||||
|
* ChannelVarset
|
||||||
|
* - variable: string (required)
|
||||||
|
* - value: string (required)
|
||||||
|
* ChannelUserevent
|
||||||
|
* - eventname: string (required)
|
||||||
|
* ChannelCreated
|
||||||
|
* StasisStart
|
||||||
|
* - args: List[string] (required)
|
||||||
|
* ChannelDialplan
|
||||||
|
* - application: string (required)
|
||||||
|
* - application_data: string (required)
|
||||||
|
* ChannelStateChange
|
||||||
|
* ChannelDtmfReceived
|
||||||
|
* - digit: string (required)
|
||||||
|
* Event
|
||||||
|
* - channel_created: ChannelCreated
|
||||||
|
* - channel_destroyed: ChannelDestroyed
|
||||||
|
* - channel_dialplan: ChannelDialplan
|
||||||
|
* - channel_varset: ChannelVarset
|
||||||
|
* - application_replaced: ApplicationReplaced
|
||||||
|
* - channel_state_change: ChannelStateChange
|
||||||
|
* - stasis_start: StasisStart
|
||||||
|
* - application: string (required)
|
||||||
|
* - channel_hangup_request: ChannelHangupRequest
|
||||||
|
* - channel_userevent: ChannelUserevent
|
||||||
|
* - channel_snapshot: ChannelSnapshot
|
||||||
|
* - channel_dtmf_received: ChannelDtmfReceived
|
||||||
|
* - channel_caller_id: ChannelCallerId
|
||||||
|
* - stasis_end: StasisEnd
|
||||||
|
* StasisEnd
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_RESOURCE_EVENTS_H */
|
47
res/stasis_json/resource_playback.h
Normal file
47
res/stasis_json/resource_playback.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Generated file - declares stubs to be implemented in
|
||||||
|
* res/stasis_json/resource_playback.c
|
||||||
|
*
|
||||||
|
* Playback control resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/stasis_http_resource.h.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_RESOURCE_PLAYBACK_H
|
||||||
|
#define _ASTERISK_RESOURCE_PLAYBACK_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JSON models
|
||||||
|
*
|
||||||
|
* Playback
|
||||||
|
* - id: string (required)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_RESOURCE_PLAYBACK_H */
|
54
res/stasis_json/resource_recordings.h
Normal file
54
res/stasis_json/resource_recordings.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Generated file - declares stubs to be implemented in
|
||||||
|
* res/stasis_json/resource_recordings.c
|
||||||
|
*
|
||||||
|
* Recording resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/stasis_http_resource.h.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_RESOURCE_RECORDINGS_H
|
||||||
|
#define _ASTERISK_RESOURCE_RECORDINGS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JSON models
|
||||||
|
*
|
||||||
|
* Recording
|
||||||
|
* - id: string (required)
|
||||||
|
* StoredRecording
|
||||||
|
* - durationSeconds: int
|
||||||
|
* - time: Date
|
||||||
|
* - id: string (required)
|
||||||
|
* - formats: List[string] (required)
|
||||||
|
* LiveRecording
|
||||||
|
* - id: string (required)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_RESOURCE_RECORDINGS_H */
|
50
res/stasis_json/resource_sounds.h
Normal file
50
res/stasis_json/resource_sounds.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 - 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* David M. Lee, II <dlee@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Generated file - declares stubs to be implemented in
|
||||||
|
* res/stasis_json/resource_sounds.c
|
||||||
|
*
|
||||||
|
* Sound resources
|
||||||
|
*
|
||||||
|
* \author David M. Lee, II <dlee@digium.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* !!!!! DO NOT EDIT !!!!!
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/stasis_http_resource.h.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_RESOURCE_SOUNDS_H
|
||||||
|
#define _ASTERISK_RESOURCE_SOUNDS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JSON models
|
||||||
|
*
|
||||||
|
* Sound
|
||||||
|
* - lang: string (required)
|
||||||
|
* - text: string
|
||||||
|
* - id: string (required)
|
||||||
|
* - formats: List[string] (required)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_RESOURCE_SOUNDS_H */
|
@@ -47,6 +47,12 @@ API_TRANSFORMS = [
|
|||||||
'stasis_http/resource_{{name}}.h'),
|
'stasis_http/resource_{{name}}.h'),
|
||||||
Transform(rel('stasis_http_resource.c.mustache'),
|
Transform(rel('stasis_http_resource.c.mustache'),
|
||||||
'stasis_http/resource_{{name}}.c', False),
|
'stasis_http/resource_{{name}}.c', False),
|
||||||
|
Transform(rel('res_stasis_json_resource.c.mustache'),
|
||||||
|
'res_stasis_json_{{name}}.c'),
|
||||||
|
Transform(rel('res_stasis_json_resource.exports.mustache'),
|
||||||
|
'res_stasis_json_{{name}}.exports.in'),
|
||||||
|
Transform(rel('stasis_json_resource.h.mustache'),
|
||||||
|
'stasis_json/resource_{{name}}.h'),
|
||||||
]
|
]
|
||||||
|
|
||||||
RESOURCES_TRANSFORMS = [
|
RESOURCES_TRANSFORMS = [
|
||||||
|
@@ -49,9 +49,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/stasis_app.h"
|
#include "asterisk/stasis_app.h"
|
||||||
#include "stasis_http/resource_{{name}}.h"
|
#include "stasis_http/resource_{{name}}.h"
|
||||||
{{#has_events}}
|
|
||||||
#include "asterisk/stasis_channels.h"
|
|
||||||
{{/has_events}}
|
|
||||||
|
|
||||||
{{#apis}}
|
{{#apis}}
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
@@ -101,89 +98,6 @@ static void stasis_http_{{c_nickname}}_cb(
|
|||||||
{{> rest_handler}}
|
{{> rest_handler}}
|
||||||
{{/root_path}}
|
{{/root_path}}
|
||||||
|
|
||||||
{{#has_events}}
|
|
||||||
{{#events}}
|
|
||||||
{{> event_function_decl}}
|
|
||||||
)
|
|
||||||
{
|
|
||||||
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
|
||||||
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
|
||||||
{{#has_properties}}
|
|
||||||
struct ast_json *validator;
|
|
||||||
{{/has_properties}}
|
|
||||||
{{#channel}}
|
|
||||||
int ret;
|
|
||||||
{{/channel}}
|
|
||||||
{{#bridge}}
|
|
||||||
{{^channel}}
|
|
||||||
int ret;
|
|
||||||
{{/channel}}
|
|
||||||
{{/bridge}}
|
|
||||||
|
|
||||||
{{#channel}}
|
|
||||||
ast_assert(channel_snapshot != NULL);
|
|
||||||
{{/channel}}
|
|
||||||
{{#bridge}}
|
|
||||||
ast_assert(bridge_snapshot != NULL);
|
|
||||||
{{/bridge}}
|
|
||||||
{{#has_properties}}
|
|
||||||
ast_assert(blob != NULL);
|
|
||||||
{{#channel}}
|
|
||||||
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
|
||||||
{{/channel}}
|
|
||||||
{{#bridge}}
|
|
||||||
ast_assert(ast_json_object_get(blob, "bridge") == NULL);
|
|
||||||
{{/bridge}}
|
|
||||||
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
|
||||||
{{#properties}}
|
|
||||||
|
|
||||||
validator = ast_json_object_get(blob, "{{name}}");
|
|
||||||
if (validator) {
|
|
||||||
/* do validation? XXX */
|
|
||||||
{{#required}}
|
|
||||||
} else {
|
|
||||||
/* fail message generation if the required parameter doesn't exist */
|
|
||||||
return NULL;
|
|
||||||
{{/required}}
|
|
||||||
}
|
|
||||||
{{/properties}}
|
|
||||||
|
|
||||||
event = ast_json_deep_copy(blob);
|
|
||||||
{{/has_properties}}
|
|
||||||
{{^has_properties}}
|
|
||||||
|
|
||||||
event = ast_json_object_create();
|
|
||||||
{{/has_properties}}
|
|
||||||
if (!event) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
{{#channel}}
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/channel}}
|
|
||||||
{{#bridge}}
|
|
||||||
ret = ast_json_object_set(event,
|
|
||||||
"bridge", ast_bridge_snapshot_to_json(bridge_snapshot));
|
|
||||||
if (ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/bridge}}
|
|
||||||
message = ast_json_pack("{s: o}", "{{c_id}}", ast_json_ref(event));
|
|
||||||
if (!message) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ast_json_ref(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/events}}
|
|
||||||
{{/has_events}}
|
|
||||||
static int load_module(void)
|
static int load_module(void)
|
||||||
{
|
{
|
||||||
stasis_app_ref();
|
stasis_app_ref();
|
||||||
|
151
rest-api-templates/res_stasis_json_resource.c.mustache
Normal file
151
rest-api-templates/res_stasis_json_resource.c.mustache
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
{{#api_declaration}}
|
||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* {{{copyright}}}
|
||||||
|
*
|
||||||
|
* {{{author}}}
|
||||||
|
{{! Template Copyright
|
||||||
|
* Copyright (C) 2013, Digium, Inc.
|
||||||
|
*
|
||||||
|
* Kinsey Moore <kmoore@digium.com>
|
||||||
|
}}
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
{{! Template for rendering the res_ module for an HTTP resource. }}
|
||||||
|
/*
|
||||||
|
{{> do-not-edit}}
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/res_stasis_http_resource.c.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief {{{description}}}
|
||||||
|
*
|
||||||
|
* \author {{{author}}}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*** MODULEINFO
|
||||||
|
<support_level>core</support_level>
|
||||||
|
***/
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
|
#include "asterisk/module.h"
|
||||||
|
#include "asterisk/json.h"
|
||||||
|
#include "stasis_json/resource_{{name}}.h"
|
||||||
|
{{#has_events}}
|
||||||
|
#include "asterisk/stasis_channels.h"
|
||||||
|
|
||||||
|
{{#events}}
|
||||||
|
{{> event_function_decl}}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
RAII_VAR(struct ast_json *, message, NULL, ast_json_unref);
|
||||||
|
RAII_VAR(struct ast_json *, event, NULL, ast_json_unref);
|
||||||
|
{{#has_properties}}
|
||||||
|
struct ast_json *validator;
|
||||||
|
{{/has_properties}}
|
||||||
|
{{#channel}}
|
||||||
|
int ret;
|
||||||
|
{{/channel}}
|
||||||
|
{{#bridge}}
|
||||||
|
{{^channel}}
|
||||||
|
int ret;
|
||||||
|
{{/channel}}
|
||||||
|
{{/bridge}}
|
||||||
|
|
||||||
|
{{#channel}}
|
||||||
|
ast_assert(channel_snapshot != NULL);
|
||||||
|
{{/channel}}
|
||||||
|
{{#bridge}}
|
||||||
|
ast_assert(bridge_snapshot != NULL);
|
||||||
|
{{/bridge}}
|
||||||
|
{{#has_properties}}
|
||||||
|
ast_assert(blob != NULL);
|
||||||
|
{{#channel}}
|
||||||
|
ast_assert(ast_json_object_get(blob, "channel") == NULL);
|
||||||
|
{{/channel}}
|
||||||
|
{{#bridge}}
|
||||||
|
ast_assert(ast_json_object_get(blob, "bridge") == NULL);
|
||||||
|
{{/bridge}}
|
||||||
|
ast_assert(ast_json_object_get(blob, "type") == NULL);
|
||||||
|
{{#properties}}
|
||||||
|
|
||||||
|
validator = ast_json_object_get(blob, "{{name}}");
|
||||||
|
if (validator) {
|
||||||
|
/* do validation? XXX */
|
||||||
|
{{#required}}
|
||||||
|
} else {
|
||||||
|
/* fail message generation if the required parameter doesn't exist */
|
||||||
|
return NULL;
|
||||||
|
{{/required}}
|
||||||
|
}
|
||||||
|
{{/properties}}
|
||||||
|
|
||||||
|
event = ast_json_deep_copy(blob);
|
||||||
|
{{/has_properties}}
|
||||||
|
{{^has_properties}}
|
||||||
|
|
||||||
|
event = ast_json_object_create();
|
||||||
|
{{/has_properties}}
|
||||||
|
if (!event) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#channel}}
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"channel", ast_channel_snapshot_to_json(channel_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/channel}}
|
||||||
|
{{#bridge}}
|
||||||
|
ret = ast_json_object_set(event,
|
||||||
|
"bridge", ast_bridge_snapshot_to_json(bridge_snapshot));
|
||||||
|
if (ret) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/bridge}}
|
||||||
|
message = ast_json_pack("{s: o}", "{{c_id}}", ast_json_ref(event));
|
||||||
|
if (!message) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ast_json_ref(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/events}}
|
||||||
|
{{/has_events}}
|
||||||
|
static int load_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int unload_module(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER,
|
||||||
|
"Stasis JSON Generators and Validators - {{{description}}}",
|
||||||
|
.load = load_module,
|
||||||
|
.unload = unload_module,
|
||||||
|
.load_pri = AST_MODPRI_DEFAULT,
|
||||||
|
);
|
||||||
|
{{/api_declaration}}
|
12
rest-api-templates/res_stasis_json_resource.exports.mustache
Normal file
12
rest-api-templates/res_stasis_json_resource.exports.mustache
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
{{#api_declaration}}
|
||||||
|
{{#has_events}}
|
||||||
|
global:
|
||||||
|
{{#events}}
|
||||||
|
LINKER_SYMBOL_PREFIXstasis_json_event_{{c_id}}_create;
|
||||||
|
{{/events}}
|
||||||
|
{{/has_events}}
|
||||||
|
{{/api_declaration}}
|
||||||
|
local:
|
||||||
|
*;
|
||||||
|
};
|
@@ -64,48 +64,5 @@ void stasis_http_{{c_nickname}}(struct ast_variable *headers, struct ast_{{c_nic
|
|||||||
{{/operations}}
|
{{/operations}}
|
||||||
{{/apis}}
|
{{/apis}}
|
||||||
|
|
||||||
{{#has_events}}
|
|
||||||
struct ast_channel_snapshot;
|
|
||||||
struct ast_bridge_snapshot;
|
|
||||||
|
|
||||||
{{#events}}
|
|
||||||
/*!
|
|
||||||
* \brief {{description}}
|
|
||||||
{{#notes}}
|
|
||||||
*
|
|
||||||
* {{{notes}}}
|
|
||||||
{{/notes}}
|
|
||||||
*
|
|
||||||
{{#channel}}
|
|
||||||
* \param channel {{#channel_desc}}{{channel_desc}}{{/channel_desc}}{{^channel_desc}}The channel to be used to generate this event{{/channel_desc}}
|
|
||||||
{{/channel}}
|
|
||||||
{{#bridge}}
|
|
||||||
* \param bridge {{#bridge_desc}}{{bridge_desc}}{{/bridge_desc}}{{^bridge_desc}}The bridge to be used to generate this event{{/bridge_desc}}
|
|
||||||
{{/bridge}}
|
|
||||||
{{#has_properties}}
|
|
||||||
* \param blob JSON blob containing the following parameters:
|
|
||||||
{{/has_properties}}
|
|
||||||
{{#properties}}
|
|
||||||
* - {{name}}: {{type}} {{#description}}- {{description}}{{/description}}{{#required}} (required){{/required}}
|
|
||||||
{{/properties}}
|
|
||||||
*
|
|
||||||
* \retval NULL on error
|
|
||||||
* \retval JSON (ast_json) describing the event
|
|
||||||
*/
|
|
||||||
{{> event_function_decl}}
|
|
||||||
);
|
|
||||||
|
|
||||||
{{/events}}
|
|
||||||
{{/has_events}}
|
|
||||||
/*
|
|
||||||
* JSON models
|
|
||||||
*
|
|
||||||
{{#models}}
|
|
||||||
* {{id}}
|
|
||||||
{{#properties}}
|
|
||||||
* - {{name}}: {{type}}{{#required}} (required){{/required}}
|
|
||||||
{{/properties}}
|
|
||||||
{{/models}} */
|
|
||||||
|
|
||||||
#endif /* _ASTERISK_RESOURCE_{{name_caps}}_H */
|
#endif /* _ASTERISK_RESOURCE_{{name_caps}}_H */
|
||||||
{{/api_declaration}}
|
{{/api_declaration}}
|
||||||
|
82
rest-api-templates/stasis_json_resource.h.mustache
Normal file
82
rest-api-templates/stasis_json_resource.h.mustache
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
{{#api_declaration}}
|
||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* {{{copyright}}}
|
||||||
|
*
|
||||||
|
* {{{author}}}
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
*
|
||||||
|
* \brief Generated file - declares stubs to be implemented in
|
||||||
|
* res/stasis_json/resource_{{name}}.c
|
||||||
|
*
|
||||||
|
* {{{description}}}
|
||||||
|
*
|
||||||
|
* \author {{{author}}}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
{{> do-not-edit}}
|
||||||
|
* This file is generated by a mustache template. Please see the original
|
||||||
|
* template in rest-api-templates/stasis_http_resource.h.mustache
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_RESOURCE_{{name_caps}}_H
|
||||||
|
#define _ASTERISK_RESOURCE_{{name_caps}}_H
|
||||||
|
|
||||||
|
{{#has_events}}
|
||||||
|
struct ast_channel_snapshot;
|
||||||
|
|
||||||
|
{{#events}}
|
||||||
|
/*!
|
||||||
|
* \brief {{description}}
|
||||||
|
{{#notes}}
|
||||||
|
*
|
||||||
|
* {{{notes}}}
|
||||||
|
{{/notes}}
|
||||||
|
*
|
||||||
|
{{#channel}}
|
||||||
|
* \param channel {{#channel_desc}}{{channel_desc}}{{/channel_desc}}{{^channel_desc}}The channel to be used to generate this event{{/channel_desc}}
|
||||||
|
{{/channel}}
|
||||||
|
{{#bridge}}
|
||||||
|
* \param bridge {{#bridge_desc}}{{bridge_desc}}{{/bridge_desc}}{{^bridge_desc}}The bridge to be used to generate this event{{/bridge_desc}}
|
||||||
|
{{/bridge}}
|
||||||
|
{{#has_properties}}
|
||||||
|
* \param blob JSON blob containing the following parameters:
|
||||||
|
{{/has_properties}}
|
||||||
|
{{#properties}}
|
||||||
|
* - {{name}}: {{type}} {{#description}}- {{description}}{{/description}}{{#required}} (required){{/required}}
|
||||||
|
{{/properties}}
|
||||||
|
*
|
||||||
|
* \retval NULL on error
|
||||||
|
* \retval JSON (ast_json) describing the event
|
||||||
|
*/
|
||||||
|
{{> event_function_decl}}
|
||||||
|
);
|
||||||
|
|
||||||
|
{{/events}}
|
||||||
|
{{/has_events}}
|
||||||
|
/*
|
||||||
|
* JSON models
|
||||||
|
*
|
||||||
|
{{#models}}
|
||||||
|
* {{id}}
|
||||||
|
{{#properties}}
|
||||||
|
* - {{name}}: {{type}}{{#required}} (required){{/required}}
|
||||||
|
{{/properties}}
|
||||||
|
{{/models}} */
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_RESOURCE_{{name_caps}}_H */
|
||||||
|
{{/api_declaration}}
|
@@ -157,7 +157,7 @@ AST_TEST_DEFINE(app_replaced)
|
|||||||
|
|
||||||
stasis_app_register(app_name, test_handler, app_data1);
|
stasis_app_register(app_name, test_handler, app_data1);
|
||||||
stasis_app_register(app_name, test_handler, app_data2);
|
stasis_app_register(app_name, test_handler, app_data2);
|
||||||
expected_message1 = ast_json_pack("[{s: {}}]", "application-replaced");
|
expected_message1 = ast_json_pack("[{s: {s: s}}]", "application_replaced", "application", app_name);
|
||||||
message = ast_json_pack("{ s: o }", "test-message", ast_json_null());
|
message = ast_json_pack("{ s: o }", "test-message", ast_json_null());
|
||||||
expected_message2 = ast_json_pack("[o]", ast_json_ref(message));
|
expected_message2 = ast_json_pack("[o]", ast_json_ref(message));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user