summaryrefslogtreecommitdiff
path: root/channels/chan_rtp.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2016-05-26 15:14:50 -0500
committerRichard Mudgett <rmudgett@digium.com>2016-05-27 11:00:09 -0500
commitbb0f4a6310fecb0f160b9e481fa751de6e35724a (patch)
tree9008fe54580c7a4d0026f72233dd08a4385192c9 /channels/chan_rtp.c
parenta6b16d7029a7a44c6a43b3b0f1cbc74cecd11454 (diff)
multicast RTP: Add dialing options
This adds a new parameter to the end of a multicast RTP dialing string. This parameter defines the following options: * i: Set the interface from which multicast RTP is sent * l: Set whether multicast packets are looped back to the sender * t: Set the TTL for multicast packets * c: Set the codec to use for RTP ASTERISK-26068 #close Reported by Mark Michelson Change-Id: I033b706b533f0aa635c342eb738e0bcefa07e219
Diffstat (limited to 'channels/chan_rtp.c')
-rw-r--r--channels/chan_rtp.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/channels/chan_rtp.c b/channels/chan_rtp.c
index 56705b1f0..093602823 100644
--- a/channels/chan_rtp.c
+++ b/channels/chan_rtp.c
@@ -43,6 +43,7 @@ ASTERISK_REGISTER_FILE()
#include "asterisk/rtp_engine.h"
#include "asterisk/causes.h"
#include "asterisk/format_cache.h"
+#include "asterisk/multicast_rtp.h"
/* Forward declarations */
static struct ast_channel *multicast_rtp_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause);
@@ -132,7 +133,9 @@ static struct ast_channel *multicast_rtp_request(const char *type, struct ast_fo
AST_APP_ARG(type);
AST_APP_ARG(destination);
AST_APP_ARG(control);
+ AST_APP_ARG(options);
);
+ struct ast_multicast_rtp_options *mcast_options = NULL;
if (ast_strlen_zero(data)) {
ast_log(LOG_ERROR, "A multicast type and destination must be given to the 'MulticastRTP' channel\n");
@@ -163,7 +166,15 @@ static struct ast_channel *multicast_rtp_request(const char *type, struct ast_fo
goto failure;
}
- fmt = ast_format_cap_get_format(cap, 0);
+ mcast_options = ast_multicast_rtp_create_options(args.type, args.options);
+ if (!mcast_options) {
+ goto failure;
+ }
+
+ fmt = ast_multicast_rtp_options_get_format(mcast_options);
+ if (!fmt) {
+ fmt = ast_format_cap_get_format(cap, 0);
+ }
if (!fmt) {
ast_log(LOG_ERROR, "No format available for sending RTP to '%s'\n",
args.destination);
@@ -175,7 +186,7 @@ static struct ast_channel *multicast_rtp_request(const char *type, struct ast_fo
goto failure;
}
- instance = ast_rtp_instance_new("multicast", NULL, &control_address, args.type);
+ instance = ast_rtp_instance_new("multicast", NULL, &control_address, mcast_options);
if (!instance) {
ast_log(LOG_ERROR,
"Could not create '%s' multicast RTP instance for sending media to '%s'\n",
@@ -207,12 +218,14 @@ static struct ast_channel *multicast_rtp_request(const char *type, struct ast_fo
ao2_ref(fmt, -1);
ao2_ref(caps, -1);
+ ast_multicast_rtp_free_options(mcast_options);
return chan;
failure:
ao2_cleanup(fmt);
ao2_cleanup(caps);
+ ast_multicast_rtp_free_options(mcast_options);
*cause = AST_CAUSE_FAILURE;
return NULL;
}