41 #define CATEGORY "/res/websocket/" 42 #define REMOTE_URL "ws://127.0.0.1:8088/ws" 49 const char write_buf[] =
"this is only a test";
54 info->name = __func__;
55 info->explicit_only = 1;
57 info->summary =
"test creation and connection of a client websocket";
58 info->description =
"test creation and connection of a client websocket";
69 ast_test_validate(
test, !strcmp(write_buf, read_buf));
81 info->name = __func__;
83 info->summary =
"websocket client - test bad url";
84 info->description =
"pass a bad url and make sure it fails";
102 info->name = __func__;
104 info->summary =
"websocket client - unsupported protocol";
105 info->description =
"fails on an unsupported protocol";
119 const char *accept_protocol;
124 info->name = __func__;
126 info->summary =
"websocket client - test multiple protocols";
127 info->description =
"test multi-protocol client";
137 ast_test_validate(
test, accept_protocol && !strcmp(accept_protocol,
"echo"));
164 .requires =
"res_http_websocket",
AST_TEST_DEFINE(websocket_client_create_and_connect)
Asterisk main include file. File version handling, generic pbx functions.
ast_websocket_result
Result code for a websocket client.
static int load_module(void)
#define AST_TEST_REGISTER(cb)
int AST_OPTIONAL_API_NAME() ast_websocket_write_string(struct ast_websocket *ws, const char *buf)
int AST_OPTIONAL_API_NAME() ast_websocket_read_string(struct ast_websocket *ws, char **buf)
static int unload_module(void)
const char *AST_OPTIONAL_API_NAME() ast_websocket_client_accept_protocol(struct ast_websocket *ws)
void write_buf(int file, char *buffer, int num)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Support for WebSocket connections within the Asterisk HTTP server and client WebSocket connections to...
Core PBX routines and definitions.
#define AST_TEST_UNREGISTER(cb)
Structure definition for session.
struct ast_websocket *AST_OPTIONAL_API_NAME() ast_websocket_client_create(const char *uri, const char *protocols, struct ast_tls_config *tls_cfg, enum ast_websocket_result *result)
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.