Asterisk - The Open Source Telephony Project
18.5.0
|
AudioSocket support for Asterisk. More...
#include "asterisk.h"
#include "errno.h"
#include <uuid/uuid.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. More... | |
const int | ast_audiosocket_init (const int svc, const char *id) |
Send the initial message to an AudioSocket server. More... | |
struct ast_frame * | ast_audiosocket_receive_frame (const int svc) |
Receive an Asterisk frame from an AudioSocket server. More... | |
const int | ast_audiosocket_send_frame (const int svc, const struct ast_frame *f) |
Send an Asterisk audio frame to an AudioSocket server. More... | |
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 = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .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 44 of file res_audiosocket.c.
Referenced by handle_audiosocket_connection().
#define MODULE_DESCRIPTION "AudioSocket support functions for Asterisk" |
Definition at line 42 of file res_audiosocket.c.
|
static |
Definition at line 344 of file res_audiosocket.c.
|
static |
Definition at line 344 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 99 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 180 of file res_audiosocket.c.
References ast_log, ast_strlen_zero, buf, 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 231 of file res_audiosocket.c.
References ast_format_slin, AST_FRAME_VOICE, ast_free, ast_frisolate, ast_log, ast_malloc, AST_MALLOCD_DATA, ast_null_frame, ast_frame::data, ast_frame::datalen, errno, ast_frame::frametype, len(), LOG_ERROR, LOG_WARNING, NULL, ast_frame::ptr, and ast_frame::samples.
Referenced by 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 209 of file res_audiosocket.c.
References ast_log, buf, ast_frame::data, ast_frame::datalen, LOG_WARNING, and ast_frame::ptr.
Referenced by audiosocket_run(), and audiosocket_write().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 344 of file res_audiosocket.c.
|
static |
Definition at line 57 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 327 of file res_audiosocket.c.
References AST_MODULE_LOAD_SUCCESS, and ast_verb.
Referenced by unload_module().
|
static |
Definition at line 333 of file res_audiosocket.c.
References AST_MODFLAG_GLOBAL_SYMBOLS, AST_MODFLAG_LOAD_ORDER, AST_MODPRI_CHANNEL_DEPEND, AST_MODULE_INFO(), AST_MODULE_LOAD_SUCCESS, AST_MODULE_SUPPORT_EXTENDED, ast_verb, ASTERISK_GPL_KEY, and load_module().
|
static |
Definition at line 344 of file res_audiosocket.c.
|
static |
Definition at line 344 of file res_audiosocket.c.