|
|
@ -12,6 +12,7 @@
|
|
|
|
#include "poller.h"
|
|
|
|
#include "poller.h"
|
|
|
|
#include "control.h"
|
|
|
|
#include "control.h"
|
|
|
|
#include "control_udp.h"
|
|
|
|
#include "control_udp.h"
|
|
|
|
|
|
|
|
#include "control_ng.h"
|
|
|
|
#include "aux.h"
|
|
|
|
#include "aux.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "call.h"
|
|
|
|
#include "call.h"
|
|
|
@ -67,6 +68,8 @@ static u_int32_t listenp;
|
|
|
|
static u_int16_t listenport;
|
|
|
|
static u_int16_t listenport;
|
|
|
|
static struct in6_addr udp_listenp;
|
|
|
|
static struct in6_addr udp_listenp;
|
|
|
|
static u_int16_t udp_listenport;
|
|
|
|
static u_int16_t udp_listenport;
|
|
|
|
|
|
|
|
static struct in6_addr ng_listenp;
|
|
|
|
|
|
|
|
static u_int16_t ng_listenport;
|
|
|
|
static int tos;
|
|
|
|
static int tos;
|
|
|
|
static int table;
|
|
|
|
static int table;
|
|
|
|
static int no_fallback;
|
|
|
|
static int no_fallback;
|
|
|
@ -198,16 +201,17 @@ fail:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void options(int *argc, char ***argv) {
|
|
|
|
static void options(int *argc, char ***argv) {
|
|
|
|
static char *ipv4s;
|
|
|
|
char *ipv4s;
|
|
|
|
static char *adv_ipv4s;
|
|
|
|
char *adv_ipv4s;
|
|
|
|
static char *ipv6s;
|
|
|
|
char *ipv6s;
|
|
|
|
static char *adv_ipv6s;
|
|
|
|
char *adv_ipv6s;
|
|
|
|
static char *listenps;
|
|
|
|
char *listenps;
|
|
|
|
static char *listenudps;
|
|
|
|
char *listenudps;
|
|
|
|
static char *redisps;
|
|
|
|
char *listenngs;
|
|
|
|
static int version;
|
|
|
|
char *redisps;
|
|
|
|
|
|
|
|
int version;
|
|
|
|
static GOptionEntry e[] = {
|
|
|
|
|
|
|
|
|
|
|
|
GOptionEntry e[] = {
|
|
|
|
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Print build time and exit", NULL },
|
|
|
|
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Print build time and exit", NULL },
|
|
|
|
{ "table", 't', 0, G_OPTION_ARG_INT, &table, "Kernel table to use", "INT" },
|
|
|
|
{ "table", 't', 0, G_OPTION_ARG_INT, &table, "Kernel table to use", "INT" },
|
|
|
|
{ "no-fallback",'F', 0, G_OPTION_ARG_NONE, &no_fallback, "Only start when kernel module is available", NULL },
|
|
|
|
{ "no-fallback",'F', 0, G_OPTION_ARG_NONE, &no_fallback, "Only start when kernel module is available", NULL },
|
|
|
@ -217,6 +221,7 @@ static void options(int *argc, char ***argv) {
|
|
|
|
{ "advertised-ip6",'A',0,G_OPTION_ARG_STRING, &adv_ipv6s, "IPv6 address to advertise", "IP6" },
|
|
|
|
{ "advertised-ip6",'A',0,G_OPTION_ARG_STRING, &adv_ipv6s, "IPv6 address to advertise", "IP6" },
|
|
|
|
{ "listen-tcp", 'l', 0, G_OPTION_ARG_STRING, &listenps, "TCP port to listen on", "[IP:]PORT" },
|
|
|
|
{ "listen-tcp", 'l', 0, G_OPTION_ARG_STRING, &listenps, "TCP port to listen on", "[IP:]PORT" },
|
|
|
|
{ "listen-udp", 'u', 0, G_OPTION_ARG_STRING, &listenudps, "UDP port to listen on", "[IP46:]PORT" },
|
|
|
|
{ "listen-udp", 'u', 0, G_OPTION_ARG_STRING, &listenudps, "UDP port to listen on", "[IP46:]PORT" },
|
|
|
|
|
|
|
|
{ "listen-ng", 'n', 0, G_OPTION_ARG_STRING, &listenngs, "UDP port to listen on, NG protocol", "[IP46:]PORT" },
|
|
|
|
{ "tos", 'T', 0, G_OPTION_ARG_INT, &tos, "TOS value to set on streams", "INT" },
|
|
|
|
{ "tos", 'T', 0, G_OPTION_ARG_INT, &tos, "TOS value to set on streams", "INT" },
|
|
|
|
{ "timeout", 'o', 0, G_OPTION_ARG_INT, &timeout, "RTP timeout", "SECS" },
|
|
|
|
{ "timeout", 'o', 0, G_OPTION_ARG_INT, &timeout, "RTP timeout", "SECS" },
|
|
|
|
{ "silent-timeout",'s',0,G_OPTION_ARG_INT, &silent_timeout,"RTP timeout for muted", "SECS" },
|
|
|
|
{ "silent-timeout",'s',0,G_OPTION_ARG_INT, &silent_timeout,"RTP timeout for muted", "SECS" },
|
|
|
@ -243,8 +248,8 @@ static void options(int *argc, char ***argv) {
|
|
|
|
|
|
|
|
|
|
|
|
if (!ipv4s)
|
|
|
|
if (!ipv4s)
|
|
|
|
die("Missing option --ip\n");
|
|
|
|
die("Missing option --ip\n");
|
|
|
|
if (!listenps && !listenudps)
|
|
|
|
if (!listenps && !listenudps && !listenngs)
|
|
|
|
die("Missing option --listen-tcp or --listen-udp\n");
|
|
|
|
die("Missing option --listen-tcp, --listen-udp or --listen-ng\n");
|
|
|
|
|
|
|
|
|
|
|
|
ipv4 = inet_addr(ipv4s);
|
|
|
|
ipv4 = inet_addr(ipv4s);
|
|
|
|
if (ipv4 == -1)
|
|
|
|
if (ipv4 == -1)
|
|
|
@ -273,6 +278,10 @@ static void options(int *argc, char ***argv) {
|
|
|
|
if (parse_ip6_port(&udp_listenp, &udp_listenport, listenudps))
|
|
|
|
if (parse_ip6_port(&udp_listenp, &udp_listenport, listenudps))
|
|
|
|
die("Invalid IP or port (--listen-udp)\n");
|
|
|
|
die("Invalid IP or port (--listen-udp)\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (listenngs) {
|
|
|
|
|
|
|
|
if (parse_ip6_port(&ng_listenp, &ng_listenport, listenngs))
|
|
|
|
|
|
|
|
die("Invalid IP or port (--listen-ng)\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (tos < 0 || tos > 255)
|
|
|
|
if (tos < 0 || tos > 255)
|
|
|
|
die("Invalid TOS value\n");
|
|
|
|
die("Invalid TOS value\n");
|
|
|
@ -364,6 +373,7 @@ void create_everything(struct main_context *ctx) {
|
|
|
|
struct callmaster_config mc;
|
|
|
|
struct callmaster_config mc;
|
|
|
|
struct control *c;
|
|
|
|
struct control *c;
|
|
|
|
struct control_udp *cu;
|
|
|
|
struct control_udp *cu;
|
|
|
|
|
|
|
|
struct control_ng *cn;
|
|
|
|
int kfd = -1;
|
|
|
|
int kfd = -1;
|
|
|
|
void *dlh;
|
|
|
|
void *dlh;
|
|
|
|
const char **strp;
|
|
|
|
const char **strp;
|
|
|
@ -422,6 +432,13 @@ void create_everything(struct main_context *ctx) {
|
|
|
|
die("Failed to open UDP control connection port\n");
|
|
|
|
die("Failed to open UDP control connection port\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cn = NULL;
|
|
|
|
|
|
|
|
if (ng_listenport) {
|
|
|
|
|
|
|
|
cn = control_ng_new(ctx->p, ng_listenp, ng_listenport, ctx->m);
|
|
|
|
|
|
|
|
if (!cn)
|
|
|
|
|
|
|
|
die("Failed to open UDP control connection port\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (redis_ip) {
|
|
|
|
if (redis_ip) {
|
|
|
|
dlh = dlopen(MP_PLUGIN_DIR "/mediaproxy-redis.so", RTLD_NOW | RTLD_GLOBAL);
|
|
|
|
dlh = dlopen(MP_PLUGIN_DIR "/mediaproxy-redis.so", RTLD_NOW | RTLD_GLOBAL);
|
|
|
|
if (!dlh && errno == ENOENT)
|
|
|
|
if (!dlh && errno == ENOENT)
|
|
|
|