Asterisk - The Open Source Telephony Project
21.4.1
|
Asterisk External Application Protocol API. More...
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | ast_aeap_message_handler |
An Asterisk external application message handler. More... | |
struct | ast_aeap_params |
Callbacks and other parameters used by an Asterisk external application object. More... | |
struct | ast_aeap_tsx_params |
Parameters to be used when sending a transaction based message. More... | |
Macros | |
#define | AEAP_CONFIG_CLIENT "client" |
Typedefs | |
typedef int(* | ast_aeap_on_message) (struct ast_aeap *aeap, struct ast_aeap_message *message, void *obj) |
Event raised when a message is received. More... | |
typedef void(* | ast_aeap_on_timeout) (struct ast_aeap *aeap, struct ast_aeap_message *message, void *obj) |
Event raised when a sent message does not receive a reply within a specified time interval. More... | |
typedef void(* | ast_aeap_user_obj_cleanup) (void *obj) |
Callback to cleanup a user object. More... | |
Enumerations | |
enum | AST_AEAP_DATA_TYPE { AST_AEAP_DATA_TYPE_NONE, AST_AEAP_DATA_TYPE_BINARY, AST_AEAP_DATA_TYPE_STRING } |
Supported Asterisk external application data types. | |
Functions | |
const struct ast_format_cap * | ast_aeap_client_config_codecs (const struct ast_aeap_client_config *cfg) |
Retrieve codec capabilities from the configuration. More... | |
int | ast_aeap_client_config_has_protocol (const struct ast_aeap_client_config *cfg, const char *protocol) |
Check a given protocol against that in an Asterisk external application configuration. More... | |
struct ao2_container * | ast_aeap_client_configs_get (const char *protocol) |
Retrieve a listing of all client configuration objects by protocol. More... | |
int | ast_aeap_connect (struct ast_aeap *aeap, const char *url, const char *protocol, int timeout) |
Connect to an external application. More... | |
struct ast_aeap * | ast_aeap_create (const char *type, const struct ast_aeap_params *params) |
Create an Asterisk external application object. More... | |
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. More... | |
struct ast_aeap * | ast_aeap_create_and_connect_by_id (const char *id, const struct ast_aeap_params *params, int timeout) |
Create and connect to an Asterisk external application by sorcery id. More... | |
struct ast_aeap * | ast_aeap_create_by_id (const char *id, const struct ast_aeap_params *params) |
Create an Asterisk external application object by sorcery id. More... | |
struct ast_variable * | ast_aeap_custom_fields_get (const char *id) |
Retrieve a list of custom configuration fields. More... | |
int | ast_aeap_disconnect (struct ast_aeap *aeap) |
Disconnect an Asterisk external application object. More... | |
int | ast_aeap_send_binary (struct ast_aeap *aeap, const void *buf, uintmax_t size) |
Send a binary data to an external application. More... | |
int | ast_aeap_send_msg (struct ast_aeap *aeap, struct ast_aeap_message *msg) |
Send a message to an external application. More... | |
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. More... | |
struct ast_sorcery * | ast_aeap_sorcery (void) |
Retrieve the AEAP sorcery object. More... | |
void * | ast_aeap_user_data_object_by_id (struct ast_aeap *aeap, const char *id) |
Retrieve a registered user data object by its id. More... | |
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. More... | |
void | ast_aeap_user_data_unregister (struct ast_aeap *aeap, const char *id) |
Un-register a user data object. More... | |
Asterisk External Application Protocol API.
Definition in file res_aeap.h.
typedef int(* ast_aeap_on_message) (struct ast_aeap *aeap, struct ast_aeap_message *message, void *obj) |
Event raised when a message is received.
aeap | An Asterisk external application object |
message | The received message |
obj | Associated user object |
Definition at line 101 of file res_aeap.h.
typedef void(* ast_aeap_on_timeout) (struct ast_aeap *aeap, struct ast_aeap_message *message, void *obj) |
Event raised when a sent message does not receive a reply within a specified time interval.
aeap | An Asterisk external application object |
message | The message sent that received no response |
obj | Associated user object |
Definition at line 123 of file res_aeap.h.
typedef void(* ast_aeap_user_obj_cleanup) (void *obj) |
Callback to cleanup a user object.
obj | The user object |
Definition at line 130 of file res_aeap.h.
const struct ast_format_cap* ast_aeap_client_config_codecs | ( | const struct ast_aeap_client_config * | cfg | ) |
Retrieve codec capabilities from the configuration.
cfg | A configuration object |
Definition at line 131 of file res_aeap.c.
References ast_aeap_client_config::codecs.
int ast_aeap_client_config_has_protocol | ( | const struct ast_aeap_client_config * | cfg, |
const char * | protocol | ||
) |
Check a given protocol against that in an Asterisk external application configuration.
cfg | A configuration object |
protocol | The protocol to check |
Definition at line 136 of file res_aeap.c.
References ast_aeap_client_config::protocol.
struct ao2_container* ast_aeap_client_configs_get | ( | const char * | protocol | ) |
Retrieve a listing of all client configuration objects by protocol.
protocol | An optional protocol to filter on (if NULL returns all client configs) |
Definition at line 142 of file res_aeap.c.
References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), ast_variables_destroy(), and container.
int ast_aeap_connect | ( | struct ast_aeap * | aeap, |
const char * | url, | ||
const char * | protocol, | ||
int | timeout | ||
) |
Connect to an external application.
aeap | An Asterisk external application object |
url | The url to connect to |
protocol | A protocol to use |
timeout | How long (in milliseconds) to attempt to connect (-1 equals infinite) |
Definition at line 338 of file aeap.c.
References ast_aeap_disconnect(), lock, ast_aeap::read_thread_id, SCOPED_AO2LOCK, and ast_aeap::transport.
Referenced by ast_aeap_create_and_connect().
struct ast_aeap* ast_aeap_create | ( | const char * | type, |
const struct ast_aeap_params * | params | ||
) |
Create an Asterisk external application object.
type | The type of underlying transport |
params | Callbacks and other parameters to use |
Definition at line 88 of file aeap.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_ref, ast_aeap::params, ast_aeap::read_thread_id, ast_aeap::transactions, ast_aeap::transport, and ast_aeap::user_data.
Referenced by ast_aeap_create_and_connect().
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.
type | The type of client connection to make |
params | Callbacks and other parameters to use |
url | The url to connect to |
protocol | A protocol to use |
timeout | How long (in milliseconds) to attempt to connect (-1 equals infinite) |
Definition at line 363 of file aeap.c.
References ao2_ref, ast_aeap_connect(), and ast_aeap_create().
struct ast_aeap* ast_aeap_create_and_connect_by_id | ( | const char * | id, |
const struct ast_aeap_params * | params, | ||
int | timeout | ||
) |
Create and connect to an Asterisk external application by sorcery id.
id | The sorcery id to lookup |
params | Callbacks and other parameters to use |
timeout | How long (in milliseconds) to attempt to connect (-1 equals infinite) |
Definition at line 322 of file res_aeap.c.
struct ast_aeap* ast_aeap_create_by_id | ( | const char * | id, |
const struct ast_aeap_params * | params | ||
) |
Create an Asterisk external application object by sorcery id.
id | The sorcery id to lookup |
params | Callbacks and other parameters to use |
Definition at line 317 of file res_aeap.c.
struct ast_variable* ast_aeap_custom_fields_get | ( | const char * | id | ) |
Retrieve a list of custom configuration fields.
id | configuration id/sorcery lookup key |
Definition at line 328 of file res_aeap.c.
References ao2_ref, and ast_sorcery_objectset_create.
int ast_aeap_disconnect | ( | struct ast_aeap * | aeap | ) |
Disconnect an Asterisk external application object.
aeap | An Asterisk external application object |
Definition at line 381 of file aeap.c.
References ast_aeap::read_thread_id, and ast_aeap::transport.
Referenced by ast_aeap_connect().
int ast_aeap_send_binary | ( | struct ast_aeap * | aeap, |
const void * | buf, | ||
uintmax_t | size | ||
) |
Send a binary data to an external application.
aeap | An Asterisk external application object |
buf | Binary data to send |
size | The size of the binary data |
int ast_aeap_send_msg | ( | struct ast_aeap * | aeap, |
struct ast_aeap_message * | msg | ||
) |
Send a message to an external application.
aeap | An Asterisk external application object |
msg | The message to send |
Definition at line 439 of file aeap.c.
References ao2_ref, ast_aeap_message_serialize(), ast_aeap_message_type::serial_type, and ast_aeap_message::type.
Referenced by ast_aeap_send_msg_tsx().
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.
aeap | An Asterisk external application object |
params | (optional) Additional parameters to consider when sending. Heap allocation not required. |
Definition at line 464 of file aeap.c.
References ao2_bump, ao2_ref, ast_aeap_message_id(), ast_aeap_send_msg(), ast_aeap_tsx_params::msg, and ast_aeap::transactions.
struct ast_sorcery* ast_aeap_sorcery | ( | void | ) |
Retrieve the AEAP sorcery object.
Definition at line 67 of file res_aeap.c.
void* ast_aeap_user_data_object_by_id | ( | struct ast_aeap * | aeap, |
const char * | id | ||
) |
Retrieve a registered user data object by its id.
aeap | An Asterisk external application object |
id | The look up id for the object |
Definition at line 174 of file aeap.c.
References ao2_ref, aeap_user_data::obj, OBJ_SEARCH_KEY, and ast_aeap::user_data.
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.
aeap | An Asterisk external application object |
id | The look up id for the object |
obj | The user object to register |
cleanup | Optional user object clean up callback |
Definition at line 150 of file aeap.c.
References ao2_link, ao2_ref, and ast_aeap::user_data.
void ast_aeap_user_data_unregister | ( | struct ast_aeap * | aeap, |
const char * | id | ||
) |
Un-register a user data object.
aeap | An Asterisk external application object |
id | The look up id for the object |
Definition at line 169 of file aeap.c.
References OBJ_NODATA, OBJ_SEARCH_KEY, OBJ_UNLINK, and ast_aeap::user_data.