36#define CATEGORY "/res/aeap/"
38#define ADDR "127.0.0.1:8088"
39#define AEAP_TRANSPORT_TYPE "ws"
40#define AEAP_REMOTE_URL "ws://" ADDR "/ws"
41#define AEAP_REMOTE_PROTOCOL "echo"
42#define AEAP_MESSAGE_ID "foo"
43#define AEAP_CONNECTION_TIMEOUT 2000
51 info->name = __func__;
52 info->explicit_only = 0;
54 info->summary =
"test creating and connecting to an AEAP application";
94 info->name = __func__;
95 info->explicit_only = 0;
97 info->summary =
"test an AEAP application string handler";
152 info->name = __func__;
153 info->explicit_only = 0;
155 info->summary =
"test an AEAP application response handler";
192 info->name = __func__;
193 info->explicit_only = 0;
195 info->summary =
"test an AEAP application request handler";
223 if (!(
http_server = ast_http_test_server_get(
"aeap transport http server",
NULL))) {
251 .
requires =
"res_aeap",
Asterisk main include file. File version handling, generic pbx functions.
Generic File Format Support. Should be included by clients of the file handling routines....
Support for WebSocket connections within the Asterisk HTTP server and client WebSocket connections to...
Asterisk JSON abstraction layer.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Asterisk External Application Protocol API.
int ast_aeap_user_data_register(struct ast_aeap *aeap, const char *id, void *obj, ast_aeap_user_obj_cleanup cleanup)
Register a user data object.
void * ast_aeap_user_data_object_by_id(struct ast_aeap *aeap, const char *id)
Retrieve a registered user data object by its id.
int ast_aeap_send_msg_tsx(struct ast_aeap *aeap, struct ast_aeap_tsx_params *params)
Send a transaction based message to an external application using the given parameters.
void ast_aeap_user_data_unregister(struct ast_aeap *aeap, const char *id)
Un-register a user data object.
struct ast_aeap * ast_aeap_create_and_connect(const char *type, const struct ast_aeap_params *params, const char *url, const char *protocol, int timeout)
Create and connect to an Asterisk external application.
Asterisk External Application Protocol Message API.
const char * ast_aeap_message_id(const struct ast_aeap_message *message)
Retrieve a message id.
struct ast_aeap_message * ast_aeap_message_create_request(const struct ast_aeap_message_type *type, const char *name, const char *id, const void *params)
Create an Asterisk external application request object.
const char * ast_aeap_message_name(const struct ast_aeap_message *message)
Retrieve a message name.
const struct ast_aeap_message_type * ast_aeap_message_type_json
Asterisk external application JSON message type.
struct ast_aeap_message * ast_aeap_message_create_response(const struct ast_aeap_message_type *type, const char *name, const char *id, const void *params)
Create an Asterisk external application response object.
int ast_aeap_message_is_named(const struct ast_aeap_message *message, const char *name)
Check whether or not a message's name matches the given one.
An Asterisk external application message handler.
Asterisk external application base message.
Callbacks and other parameters used by an Asterisk external application object.
const struct ast_aeap_message_type * msg_type
void(* on_string)(struct ast_aeap *aeap, const char *buf, intmax_t size)
Raised when string data is received.
const struct ast_aeap_message_handler * response_handlers
const struct ast_aeap_message_handler * request_handlers
Parameters to be used when sending a transaction based message.
struct ast_aeap_message * msg
ast_aeap_on_timeout on_timeout
#define AST_TEST_REGISTER(cb)
#define AST_TEST_UNREGISTER(cb)
static int handle_msg(struct ast_aeap *aeap, struct ast_aeap_message *message, void *data)
#define AEAP_TRANSPORT_TYPE
#define AEAP_REMOTE_PROTOCOL
static const struct ast_aeap_message_handler handlers[]
#define AEAP_CONNECTION_TIMEOUT
AST_TEST_DEFINE(create_and_connect)
static int load_module(void)
static int unload_module(void)
static struct ast_http_server * http_server
static void handle_timeout(struct ast_aeap *aeap, struct ast_aeap_message *message, void *data)
static void handle_string(struct ast_aeap *aeap, const char *buf, intmax_t size)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.