summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-01-12 19:45:27 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-01-12 19:45:28 -0600
commit9a13df1b3c2c924dc4016a14eeadc254e5a7504b (patch)
tree1bd20289a896f85e9c70ea60e2ade74f5f7ba0a6 /res
parentd8f8cf54622b5519c894cf3a0e1a4fc7ab1c7f77 (diff)
parenta41aab477ac317f9d973db253b4c30cd6a6db5b8 (diff)
Merge "pjsip_sdp_rtp: Add option endpoint/bind_rtp_to_media_address"
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip.c8
-rw-r--r--res/res_pjsip/pjsip_configuration.c1
-rw-r--r--res/res_pjsip_sdp_rtp.c9
3 files changed, 17 insertions, 1 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index bf26fca8c..90be734e6 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -233,6 +233,14 @@
</para></note>
</description>
</configOption>
+ <configOption name="bind_rtp_to_media_address">
+ <synopsis>Bind the RTP instance to the media_address</synopsis>
+ <description><para>
+ If media_address is specified, this option causes the RTP instance to be bound to the
+ specified ip address which causes the packets to be sent from that address.
+ </para>
+ </description>
+ </configOption>
<configOption name="force_rport" default="yes">
<synopsis>Force use of return port</synopsis>
</configOption>
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 72f896ad0..926bf3793 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -1847,6 +1847,7 @@ int ast_res_pjsip_initialize_configuration(void)
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "outbound_auth", "", outbound_auth_handler, outbound_auths_to_str, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "aors", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, aors));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "media_address", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.address));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "bind_rtp_to_media_address", "no", OPT_BOOL_T, 1, STRFLDSET(struct ast_sip_endpoint, media.bind_rtp_to_media_address));
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "identify_by", "username", ident_handler, ident_to_str, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "direct_media", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.enabled));
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_method", "invite", direct_media_method_handler, direct_media_method_to_str, NULL, 0, 0);
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 1f2f21d73..2a1f56ed4 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -175,8 +175,15 @@ static int rtp_check_timeout(const void *data)
static int create_rtp(struct ast_sip_session *session, struct ast_sip_session_media *session_media, unsigned int ipv6)
{
struct ast_rtp_engine_ice *ice;
+ struct ast_sockaddr temp_media_address;
+ struct ast_sockaddr *media_address = ipv6 ? &address_ipv6 : &address_ipv4;
- if (!(session_media->rtp = ast_rtp_instance_new(session->endpoint->media.rtp.engine, sched, ipv6 ? &address_ipv6 : &address_ipv4, NULL))) {
+ if (session->endpoint->media.bind_rtp_to_media_address && !ast_strlen_zero(session->endpoint->media.address)) {
+ ast_sockaddr_parse(&temp_media_address, session->endpoint->media.address, 0);
+ media_address = &temp_media_address;
+ }
+
+ if (!(session_media->rtp = ast_rtp_instance_new(session->endpoint->media.rtp.engine, sched, media_address, NULL))) {
ast_log(LOG_ERROR, "Unable to create RTP instance using RTP engine '%s'\n", session->endpoint->media.rtp.engine);
return -1;
}