Asterisk - The Open Source Telephony Project
21.4.1
|
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 = "da6642af068ee5e6490c5b1d2cc1d238" , .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.
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_autoservice_start(), ast_autoservice_stop(), ast_connect(), ast_sockaddr_port, ast_sockaddr_resolve(), ast_sockaddr_stringify(), and ast_socket_nonblock.
Referenced by 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.
Referenced by audiosocket_call().
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_frisolate, ast_malloc, AST_MALLOCD_DATA, ast_null_frame, ast_frame::data, ast_frame::datalen, ast_frame::frametype, ast_frame::len, and ast_frame::samples.
Referenced by audiosocket_read().
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_frame::data, and ast_frame::datalen.
Referenced by audiosocket_write().