diff options
author | Joshua Colp <jcolp@digium.com> | 2016-10-28 05:33:02 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-10-28 05:33:02 -0500 |
commit | 6012db0e0501a880d4ca770422132dd1d01a8b9b (patch) | |
tree | 30f489848e188074c9935367da9b4152aaf03771 /res/res_pjsip_sdp_rtp.c | |
parent | e8a3af2629ff8668b4ebd78a50bfebdbfaa66a6e (diff) | |
parent | f534f67f520397079f1af54358aa4404403025eb (diff) |
Merge "res_pjsip_sdp_rtp: Fix address family of explicit media_address." into 13
Diffstat (limited to 'res/res_pjsip_sdp_rtp.c')
-rw-r--r-- | res/res_pjsip_sdp_rtp.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 9e9815591..c511e5ce3 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -1035,6 +1035,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 }; pjmedia_sdp_media *media; const char *hostip = NULL; @@ -1098,9 +1099,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; |