58 #define LINKSYS_MCAST_STARTCMD 6
61 #define LINKSYS_MCAST_STOPCMD 7
118 const char *
type = data;
120 if (!(multicast =
ast_calloc(1,
sizeof(*multicast)))) {
124 if (!strcasecmp(type,
"basic")) {
126 }
else if (!strcasecmp(type,
"linksys")) {
133 if ((multicast->
socket =
socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
166 return (
unsigned int) ms;
173 .command = htonl(command),
189 "remote address.\n");
197 ast_sendto(multicast->
socket, &control_packet,
sizeof(control_packet), 0, &control_address);
198 ast_sendto(multicast->
socket, &control_packet,
sizeof(control_packet), 0, &control_address);
237 int hdrlen = 12, res = 0, codec;
239 unsigned char *rtpheader;
254 if (frame->
offset < hdrlen) {
262 rtpheader = (
unsigned char *)(f->
data.
ptr - hdrlen);
274 multicast->
seqno = 0xFFFF & (multicast->
seqno + 1);
union ast_frame_subclass subclass
static int rtp_get_rate(format_t format)
static int multicast_send_control_packet(struct ast_rtp_instance *instance, struct multicast_rtp *multicast, int command)
Helper function which populates a control packet with useful information and sends it...
Structure for a Linksys control packet.
ssize_t ast_sendto(int sockfd, const void *buf, size_t len, int flags, const struct ast_sockaddr *dest_addr)
Wrapper around sendto(2) that uses ast_sockaddr.
static int unload_module(void)
Asterisk locking-related definitions:
multicast_type
Type of paging to do.
Asterisk main include file. File version handling, generic pbx functions.
#define ast_rtp_engine_register(engine)
struct ast_frame ast_null_frame
static int multicast_rtp_new(struct ast_rtp_instance *instance, struct sched_context *sched, struct ast_sockaddr *addr, void *data)
Function called to create a new multicast instance.
#define ast_test_flag(p, flag)
struct ast_rtp_codecs * ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance)
Get the codecs structure of an RTP instance.
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
static unsigned int calc_txstamp(struct multicast_rtp *rtp, struct timeval *delivery)
static void put_unaligned_uint32(void *p, unsigned int datum)
Configuration File Parser.
uint32_t ast_sockaddr_ipv4(const struct ast_sockaddr *addr)
Get an IPv4 address of an ast_sockaddr.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
static force_inline int ast_format_rate(format_t format)
Get the sample rate for a given format.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Socket address structure.
static int ast_sockaddr_isnull(const struct ast_sockaddr *addr)
Checks if the ast_sockaddr is null. "null" in this sense essentially means uninitialized, or having a 0 length.
#define ast_sockaddr_port(addr)
Get the port number of a socket address.
Structure for a multicast paging instance.
Handle unaligned data access.
General Asterisk PBX channel definitions.
int ast_rtp_engine_unregister(struct ast_rtp_engine *engine)
Unregister an RTP engine.
void ast_rtp_instance_set_data(struct ast_rtp_instance *instance, void *data)
Set the data portion of an RTP instance.
Access Control of various sorts.
Asterisk internal frame definitions.
long int ast_random(void)
#define LINKSYS_MCAST_STARTCMD
Core PBX routines and definitions.
static int multicast_rtp_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Function called to broadcast some audio on a multicast instance.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
static struct ast_rtp_engine multicast_rtp_engine
static int multicast_rtp_activate(struct ast_rtp_instance *instance)
Function called to indicate that audio is now going to flow.
#define LINKSYS_MCAST_STOPCMD
static char * ast_sockaddr_stringify(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() with default format.
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
void * ast_rtp_instance_get_data(struct ast_rtp_instance *instance)
Get the data portion of an RTP instance.
static struct ast_frame * multicast_rtp_read(struct ast_rtp_instance *instance, int rtcp)
Function called to read from a multicast instance.
void ast_rtp_instance_get_remote_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the address of the remote endpoint that we are sending RTP to.
void ast_rtp_instance_get_local_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the local address that we are expecting RTP on.
static int multicast_rtp_destroy(struct ast_rtp_instance *instance)
Function called to destroy a multicast instance.
static int load_module(void)
Standard Command Line Interface.
Data structure associated with a single frame of data.
enum ast_frame_type frametype
#define ASTERISK_GPL_KEY
The text the key() function should return.
Pluggable RTP Architecture.
Asterisk module definitions.
static snd_pcm_format_t format
union ast_frame::@172 data
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const format_t code)
Retrieve a payload based on whether it is an Asterisk format and the code.
int ast_sockaddr_is_ipv6(const struct ast_sockaddr *addr)
Determine if this is an IPv6 address.
struct ast_frame * ast_frdup(const struct ast_frame *fr)
Copies a frame.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.