Asterisk - The Open Source Telephony Project GIT-master-1f1c5bb
res_audiosocket.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2019, CyCore Systems, Inc
5 *
6 * Seán C McCord <scm@cycoresys.com
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*!
20 * \file
21 * \brief AudioSocket support functions
22 *
23 * \author Seán C McCord <scm@cycoresys.com>
24 *
25 */
26
27#ifndef _ASTERISK_RES_AUDIOSOCKET_H
28#define _ASTERISK_RES_AUDIOSOCKET_H
29
30#if defined(__cplusplus) || defined(c_plusplus)
31extern "C" {
32#endif
33
34#include <uuid/uuid.h>
35
36#include "asterisk/frame.h"
37#include "asterisk/uuid.h"
38
39/*!
40 * \brief Send the initial message to an AudioSocket server
41 *
42 * \param server The server address, including port.
43 * \param chan An optional channel which will be put into autoservice during
44 * the connection period. If there is no channel to be autoserviced, pass NULL
45 * instead.
46 *
47 * \retval socket file descriptor for AudioSocket on success
48 * \retval -1 on error
49 */
50const int ast_audiosocket_connect(const char *server, struct ast_channel *chan);
51
52/*!
53 * \brief Send the initial message to an AudioSocket server
54 *
55 * \param svc The file descriptor of the network socket to the AudioSocket server.
56 * \param id The UUID to send to the AudioSocket server to uniquely identify this connection.
57 *
58 * \retval 0 on success
59 * \retval -1 on error
60 */
61const int ast_audiosocket_init(const int svc, const char *id);
62
63/*!
64 * \brief Send an Asterisk audio frame to an AudioSocket server
65 *
66 * \param svc The file descriptor of the network socket to the AudioSocket server.
67 * \param f The Asterisk audio frame to send.
68 *
69 * \retval 0 on success
70 * \retval -1 on error
71 */
72const int ast_audiosocket_send_frame(const int svc, const struct ast_frame *f);
73
74/*!
75 * \brief Receive an Asterisk frame from an AudioSocket server
76 *
77 * This returned object is a pointer to an Asterisk frame which must be
78 * manually freed by the caller.
79 *
80 * \param svc The file descriptor of the network socket to the AudioSocket server.
81 *
82 * \retval A \ref ast_frame on success
83 * \retval NULL on error
84 */
85struct ast_frame *ast_audiosocket_receive_frame(const int svc);
86
87#endif /* _ASTERISK_RES_AUDIOSOCKET_H */
Asterisk internal frame definitions.
const int ast_audiosocket_init(const int svc, const char *id)
Send the initial message to 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_frame * ast_audiosocket_receive_frame(const int svc)
Receive an Asterisk frame from an AudioSocket server.
const int ast_audiosocket_connect(const char *server, struct ast_channel *chan)
Send the initial message to an AudioSocket server.
Main Channel structure associated with a channel.
Data structure associated with a single frame of data.
Universally unique identifier support.