|
Asterisk - The Open Source Telephony Project GIT-master-27fb039
|
AudioSocket support for Asterisk. More...
#include "asterisk.h"#include "errno.h"#include <uuid/uuid.h>#include <arpa/inet.h>#include "asterisk/file.h"#include "asterisk/res_audiosocket.h"#include "asterisk/channel.h"#include "asterisk/module.h"#include "asterisk/uuid.h"#include "asterisk/format_cache.h"
Go to the source code of this file.
Macros | |
| #define | MAX_CONNECT_TIMEOUT_MSEC 2000 |
| #define | MODULE_DESCRIPTION "AudioSocket support functions for Asterisk" |
Functions | |
| static void | __reg_module (void) |
| static void | __unreg_module (void) |
| const int | ast_audiosocket_connect (const char *server, struct ast_channel *chan) |
| Send the initial message to an AudioSocket server. | |
| const int | ast_audiosocket_init (const int svc, const char *id) |
| Send the initial message to an AudioSocket server. | |
| struct ast_frame * | ast_audiosocket_receive_frame (const int svc) |
| Receive an Asterisk frame from an AudioSocket server. | |
| struct ast_frame * | ast_audiosocket_receive_frame_with_hangup (const int svc, int *const hangup) |
| Receive an Asterisk frame from an AudioSocket server. | |
| const int | ast_audiosocket_send_frame (const int svc, const struct ast_frame *f) |
| Send an Asterisk audio frame to an AudioSocket server. | |
| struct ast_module * | AST_MODULE_SELF_SYM (void) |
| static int | handle_audiosocket_connection (const char *server, const struct ast_sockaddr addr, const int netsockfd) |
| static int | load_module (void) |
| static int | unload_module (void) |
Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "AudioSocket support" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, } |
| static const struct ast_module_info * | ast_module_info = &__mod_info |
AudioSocket support for Asterisk.
Definition in file res_audiosocket.c.
| #define MAX_CONNECT_TIMEOUT_MSEC 2000 |
Definition at line 45 of file res_audiosocket.c.
| #define MODULE_DESCRIPTION "AudioSocket support functions for Asterisk" |
Definition at line 43 of file res_audiosocket.c.
|
static |
Definition at line 439 of file res_audiosocket.c.
|
static |
Definition at line 439 of file res_audiosocket.c.
| const int ast_audiosocket_connect | ( | const char * | server, |
| struct ast_channel * | chan | ||
| ) |
Send the initial message to an AudioSocket server.
| server | The server address, including port. |
| chan | An optional channel which will be put into autoservice during the connection period. If there is no channel to be autoserviced, pass NULL instead. |
| socket | file descriptor for AudioSocket on success |
| -1 | on error |
Definition at line 100 of file res_audiosocket.c.
References AST_AF_UNSPEC, ast_autoservice_start(), ast_autoservice_stop(), ast_channel_name(), ast_connect(), ast_free, ast_log, ast_sockaddr_port, ast_sockaddr_resolve(), ast_sockaddr_stringify(), ast_socket_nonblock, ast_strlen_zero(), end, errno, handle_audiosocket_connection(), LOG_ERROR, LOG_WARNING, NULL, PARSE_PORT_REQUIRE, and ast_sockaddr::ss.
Referenced by audiosocket_exec(), and audiosocket_request().
| const int ast_audiosocket_init | ( | const int | svc, |
| const char * | id | ||
| ) |
Send the initial message to an AudioSocket server.
| svc | The file descriptor of the network socket to the AudioSocket server. |
| id | The UUID to send to the AudioSocket server to uniquely identify this connection. |
| 0 | on success |
| -1 | on error |
Definition at line 189 of file res_audiosocket.c.
References AST_AUDIOSOCKET_KIND_UUID, ast_log, ast_strlen_zero(), buf, errno, LOG_ERROR, and LOG_WARNING.
Referenced by audiosocket_call(), and audiosocket_run().
| struct ast_frame * ast_audiosocket_receive_frame | ( | const int | svc | ) |
Receive an Asterisk frame from an AudioSocket server.
This returned object is a pointer to an Asterisk frame which must be manually freed by the caller.
| svc | The file descriptor of the network socket to the AudioSocket server. |
| A | ast_frame on success |
| NULL | on error |
Definition at line 277 of file res_audiosocket.c.
References ast_audiosocket_receive_frame_with_hangup(), and NULL.
| struct ast_frame * ast_audiosocket_receive_frame_with_hangup | ( | const int | svc, |
| int *const | hangup | ||
| ) |
Receive an Asterisk frame from an AudioSocket server.
This returned object is a pointer to an Asterisk frame which must be manually freed by the caller.
| svc | The file descriptor of the network socket to the AudioSocket server. |
| hangup | Will be true if the AudioSocket server requested the channel be hung up, otherwise false. Used as an out-parameter only, pass NULL if not needed. The function return value will always be NULL when true. |
| A | ast_frame on success |
| NULL | on error or when the hungup parameter is true. |
Definition at line 282 of file res_audiosocket.c.
References AST_AUDIOSOCKET_KIND_AUDIO, AST_AUDIOSOCKET_KIND_AUDIO_SLIN12, AST_AUDIOSOCKET_KIND_AUDIO_SLIN16, AST_AUDIOSOCKET_KIND_AUDIO_SLIN192, AST_AUDIOSOCKET_KIND_AUDIO_SLIN24, AST_AUDIOSOCKET_KIND_AUDIO_SLIN32, AST_AUDIOSOCKET_KIND_AUDIO_SLIN44, AST_AUDIOSOCKET_KIND_AUDIO_SLIN48, AST_AUDIOSOCKET_KIND_AUDIO_SLIN96, AST_AUDIOSOCKET_KIND_HANGUP, ast_debug, ast_format_slin, ast_format_slin12, ast_format_slin16, ast_format_slin192, ast_format_slin24, ast_format_slin32, ast_format_slin44, ast_format_slin48, ast_format_slin96, AST_FRAME_VOICE, ast_free, ast_frisolate, ast_log, ast_malloc, AST_MALLOCD_DATA, ast_wait_for_input(), ast_frame::data, ast_frame::datalen, errno, ast_frame_subclass::format, ast_frame::frametype, hangup(), LOG_ERROR, LOG_WARNING, NULL, ast_frame::ptr, ast_frame::samples, and ast_frame::subclass.
Referenced by ast_audiosocket_receive_frame(), audiosocket_read(), and audiosocket_run().
| const int ast_audiosocket_send_frame | ( | const int | svc, |
| const struct ast_frame * | f | ||
| ) |
Send an Asterisk audio frame to an AudioSocket server.
| svc | The file descriptor of the network socket to the AudioSocket server. |
| f | The Asterisk audio frame to send. |
| 0 | on success |
| -1 | on error |
Definition at line 218 of file res_audiosocket.c.
References AST_AUDIOSOCKET_KIND_AUDIO, AST_AUDIOSOCKET_KIND_AUDIO_SLIN12, AST_AUDIOSOCKET_KIND_AUDIO_SLIN16, AST_AUDIOSOCKET_KIND_AUDIO_SLIN192, AST_AUDIOSOCKET_KIND_AUDIO_SLIN24, AST_AUDIOSOCKET_KIND_AUDIO_SLIN32, AST_AUDIOSOCKET_KIND_AUDIO_SLIN44, AST_AUDIOSOCKET_KIND_AUDIO_SLIN48, AST_AUDIOSOCKET_KIND_AUDIO_SLIN96, AST_AUDIOSOCKET_KIND_DTMF, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_slin, ast_format_slin12, ast_format_slin16, ast_format_slin192, ast_format_slin24, ast_format_slin32, ast_format_slin44, ast_format_slin48, ast_format_slin96, AST_FRAME_DTMF, AST_FRAME_VOICE, ast_log, buf, ast_frame::data, ast_frame::datalen, errno, ast_frame_subclass::format, ast_frame::frametype, ast_frame_subclass::integer, LOG_ERROR, LOG_WARNING, ast_frame::ptr, and ast_frame::subclass.
Referenced by audiosocket_run(), audiosocket_send_dtmf(), and audiosocket_write().
| struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 439 of file res_audiosocket.c.
|
static |
Definition at line 58 of file res_audiosocket.c.
References ast_log, ast_poll, ast_sockaddr_stringify(), errno, LOG_WARNING, and MAX_CONNECT_TIMEOUT_MSEC.
Referenced by ast_audiosocket_connect().
|
static |
Definition at line 422 of file res_audiosocket.c.
References AST_MODULE_LOAD_SUCCESS, and ast_verb.
|
static |
Definition at line 428 of file res_audiosocket.c.
References AST_MODULE_LOAD_SUCCESS, and ast_verb.
|
static |
Definition at line 439 of file res_audiosocket.c.
|
static |
Definition at line 439 of file res_audiosocket.c.