Browse Source

Merge branch 'add-ToS-to-control-ng' of https://github.com/1and1/rtpengine

Change-Id: I217e772f79a1e1147ceced418020513fe277055f
changes/75/17475/5
Richard Fuchs 8 years ago
parent
commit
77de3d06ea
9 changed files with 31 additions and 12 deletions
  1. +6
    -0
      README.md
  2. +1
    -0
      daemon/call.h
  3. +2
    -2
      daemon/cli.c
  4. +9
    -4
      daemon/control_ng.c
  5. +1
    -1
      daemon/control_ng.h
  6. +7
    -1
      daemon/main.c
  7. +1
    -3
      daemon/media_socket.h
  8. +3
    -1
      daemon/socket.h
  9. +1
    -0
      etc/rtpengine.sample.conf

+ 6
- 0
README.md View File

@ -169,6 +169,7 @@ option and which are reproduced below:
-G, --graphite-interval=INT Graphite data statistics send interval
--graphite-prefix=STRING Graphite prefix for every line
-T, --tos=INT TOS value to set on streams
--control-tos=INT TOS value to set on control-ng interface
-o, --timeout=SECS RTP timeout
-s, --silent-timeout=SECS RTP timeout for muted
-a, --final-timeout=SECS Call timeout
@ -308,6 +309,11 @@ The options are described in more detail below.
Takes an integer as argument and if given, specifies the TOS value that should be set in outgoing
packets. The default is to leave the TOS field untouched. A typical value is 184 (*Expedited Forwarding*).
* --control-tos
Takes an integer as argument and if given, specifies the TOS value that should be set in the control-ng
interface packets. The default is to leave the TOS field untouched.
* -o, --timeout
Takes the number of seconds as argument after which a media stream should be considered dead if no media


+ 1
- 0
daemon/call.h View File

@ -405,6 +405,7 @@ struct callmaster_config {
unsigned int redis_expires_secs;
char *b2b_url;
unsigned char default_tos;
unsigned char control_tos;
enum xmlrpc_format fmt;
endpoint_t graphite_ep;
int graphite_interval;


+ 2
- 2
daemon/cli.c View File

@ -172,8 +172,8 @@ static void cli_incoming_list_totals(char* buffer, int len, struct callmaster* m
printlen = snprintf(replybuffer,(outbufend-replybuffer), "Control statistics:\n\n");
ADJUSTLEN(printlen,outbufend,replybuffer);
printlen = snprintf(replybuffer,(outbufend-replybuffer), " %20s | %10s | %10s | %10s | %10s | %10s | %10s | %10s | %10s \n",
"Proxy", "Offer", "Answer", "Delete", "Ping", "List", "Query", "StartRec", "Errors");
printlen = snprintf(replybuffer,(outbufend-replybuffer), " %20s | %10s | %10s | %10s | %10s | %10s | %10s | %10s | %10s | %10s \n",
"Proxy", "Offer", "Answer", "Delete", "Ping", "List", "Query", "StartRec", "StopRec", "Errors");
ADJUSTLEN(printlen,outbufend,replybuffer);
mutex_lock(&m->cngs_lock);


+ 9
- 4
daemon/control_ng.c View File

@ -305,7 +305,7 @@ out:
struct control_ng *control_ng_new(struct poller *p, endpoint_t *ep, struct callmaster *m) {
struct control_ng *control_ng_new(struct poller *p, endpoint_t *ep, struct callmaster *m, unsigned char tos) {
struct control_ng *c;
if (!p || !m)
@ -318,9 +318,14 @@ struct control_ng *control_ng_new(struct poller *p, endpoint_t *ep, struct callm
if (udp_listener_init(&c->udp_listeners[0], p, ep, control_ng_incoming, &c->obj))
goto fail2;
if (ipv46_any_convert(ep) && udp_listener_init(&c->udp_listeners[1], p, ep, control_ng_incoming, &c->obj))
goto fail2;
if (tos)
set_tos(&c->udp_listeners[0].sock,tos);
if (ipv46_any_convert(ep)) {
if (udp_listener_init(&c->udp_listeners[1], p, ep, control_ng_incoming, &c->obj))
goto fail2;
if (tos)
set_tos(&c->udp_listeners[1].sock,tos);
}
return c;
fail2:


+ 1
- 1
daemon/control_ng.h View File

@ -30,6 +30,6 @@ struct control_ng {
struct udp_listener udp_listeners[2];
};
struct control_ng *control_ng_new(struct poller *, endpoint_t *, struct callmaster *);
struct control_ng *control_ng_new(struct poller *, endpoint_t *, struct callmaster *, unsigned char);
#endif

+ 7
- 1
daemon/main.c View File

@ -58,6 +58,7 @@ static endpoint_t homer_ep;
static int homer_protocol = SOCK_DGRAM;
static int homer_id = 2001;
static int tos;
static int control_tos;
static int table = -1;
static int no_fallback;
static unsigned int timeout;
@ -268,6 +269,7 @@ static void options(int *argc, char ***argv) {
{ "graphite-interval", 'G', 0, G_OPTION_ARG_INT, &graphite_interval, "Graphite send interval in seconds", "INT" },
{ "graphite-prefix",0, 0, G_OPTION_ARG_STRING, &graphite_prefix_s, "Prefix for graphite line", "STRING"},
{ "tos", 'T', 0, G_OPTION_ARG_INT, &tos, "Default TOS value to set on streams", "INT" },
{ "control-tos",0 , 0, G_OPTION_ARG_INT, &control_tos, "Default TOS value to set on control-ng", "INT" },
{ "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" },
{ "final-timeout",'a',0,G_OPTION_ARG_INT, &final_timeout, "Call timeout", "SECS" },
@ -371,6 +373,9 @@ static void options(int *argc, char ***argv) {
if (tos < 0 || tos > 255)
die("Invalid TOS value");
if (control_tos < 0 || control_tos > 255)
die("Invalid control-ng TOS value");
if (timeout <= 0)
timeout = 60;
@ -528,6 +533,7 @@ no_kernel:
mc.final_timeout = final_timeout;
mc.delete_delay = delete_delay;
mc.default_tos = tos;
mc.control_tos = control_tos;
mc.b2b_url = b2b_url;
mc.fmt = xmlrpc_fmt;
mc.graphite_ep = graphite_ep;
@ -562,7 +568,7 @@ no_kernel:
cn = NULL;
if (ng_listen_ep.port) {
interfaces_exclude_port(ng_listen_ep.port);
cn = control_ng_new(ctx->p, &ng_listen_ep, ctx->m);
cn = control_ng_new(ctx->p, &ng_listen_ep, ctx->m, control_tos);
if (!cn)
die("Failed to open UDP control connection port");
}


+ 1
- 3
daemon/media_socket.h View File

@ -78,9 +78,7 @@ int is_local_endpoint(const struct intf_address *addr, unsigned int port);
//int get_port(socket_t *r, unsigned int port, const struct local_intf *lif, const struct call *c);
//void release_port(socket_t *r, const struct local_intf *);
INLINE void set_tos(socket_t *s, unsigned int tos) {
s->family->tos(s, tos);
}
int __get_consecutive_ports(GQueue *out, unsigned int num_ports, unsigned int wanted_start_port,
struct intf_spec *spec, const str *);
int get_consecutive_ports(GQueue *out, unsigned int num_ports, const struct logical_intf *log, const str *);


+ 3
- 1
daemon/socket.h View File

@ -261,7 +261,9 @@ INLINE int ipv46_any_convert(endpoint_t *ep) {
#define endpoint_packet_header(o, src, dst, len) (dst)->address.family->packet_header(o, src, dst, len)
INLINE void set_tos(socket_t *s, unsigned int tos) {
s->family->tos(s, tos);
}
socktype_t *get_socket_type(const str *s);
socktype_t *get_socket_type_c(const char *s);


+ 1
- 0
etc/rtpengine.sample.conf View File

@ -21,6 +21,7 @@ listen-ng = 127.0.0.1:2223
timeout = 60
silent-timeout = 3600
tos = 184
#control-tos = 184
# delete-delay = 30
# final-timeout = 10800


Loading…
Cancel
Save