summaryrefslogtreecommitdiff
path: root/res/res_pjsip_sdp_rtp.c
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-10-27 22:22:57 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-10-27 22:22:57 -0500
commit0fc942e7cd9c3039cc0f75f5d816eb7f4de1d376 (patch)
tree03222354fa6bc30826c96d0e5a99232d4cc6eb5f /res/res_pjsip_sdp_rtp.c
parent24d0907849d00fd6452818c978dbd2eac13908b9 (diff)
parent7925f60cd96a492bd9d9424fa134ed8087bcb962 (diff)
Merge "res_pjsip_sdp_rtp: Fix address family of explicit media_address."
Diffstat (limited to 'res/res_pjsip_sdp_rtp.c')
-rw-r--r--res/res_pjsip_sdp_rtp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 13a71d478..6d6f3f12f 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1057,6 +1057,7 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
pj_pool_t *pool = session->inv_session->pool_prov;
static const pj_str_t STR_IN = { "IN", 2 };
static const pj_str_t STR_IP4 = { "IP4", 3};
+ static const pj_str_t STR_IP6 = { "IP6", 3};
static const pj_str_t STR_SENDRECV = { "sendrecv", 8 };
static const pj_str_t STR_SENDONLY = { "sendonly", 8 };
pjmedia_sdp_media *media;
@@ -1121,9 +1122,19 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
}
media->conn->net_type = STR_IN;
- /* Connection information will be updated by the multihomed module */
+ /* Assume that the connection will use IPv4 until proven otherwise */
media->conn->addr_type = STR_IP4;
pj_strdup2(pool, &media->conn->addr, hostip);
+
+ if (!ast_strlen_zero(session->endpoint->media.address)) {
+ pj_sockaddr ip;
+
+ if ((pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &media->conn->addr, &ip) == PJ_SUCCESS) &&
+ (ip.addr.sa_family == pj_AF_INET6())) {
+ media->conn->addr_type = STR_IP6;
+ }
+ }
+
ast_rtp_instance_get_local_address(session_media->rtp, &addr);
media->desc.port = direct_media_enabled ? ast_sockaddr_port(&session_media->direct_media_addr) : (pj_uint16_t) ast_sockaddr_port(&addr);
media->desc.port_count = 1;