[asterisk-commits] file: branch file/pimp_sip_media r381274 - /team/file/pimp_sip_media/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 12 08:21:41 CST 2013


Author: file
Date: Tue Feb 12 08:21:38 2013
New Revision: 381274

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381274
Log:
For incoming sessions automatically choose IPv4 or IPv6 for RTP. This works nicely for anonymous calls.

Modified:
    team/file/pimp_sip_media/res/res_sip_sdp_audio.c

Modified: team/file/pimp_sip_media/res/res_sip_sdp_audio.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_media/res/res_sip_sdp_audio.c?view=diff&rev=381274&r1=381273&r2=381274
==============================================================================
--- team/file/pimp_sip_media/res/res_sip_sdp_audio.c (original)
+++ team/file/pimp_sip_media/res/res_sip_sdp_audio.c Tue Feb 12 08:21:38 2013
@@ -75,13 +75,13 @@
 };
 
 /*! \brief Internal function which creates an RTP instance */
-static int audio_create_rtp(struct ast_sip_session *session)
+static int audio_create_rtp(struct ast_sip_session *session, unsigned int ipv6)
 {
 	pj_sockaddr addr;
 	char hostip[PJ_INET6_ADDRSTRLEN+2];
 	struct ast_sockaddr tmp;
 
-	if (pj_gethostip(session->endpoint->rtp_ipv6 ? pj_AF_INET6() : pj_AF_INET(), &addr) != PJ_SUCCESS) {
+	if (pj_gethostip(ipv6 ? pj_AF_INET6() : pj_AF_INET(), &addr) != PJ_SUCCESS) {
 		return -1;
 	}
 
@@ -123,8 +123,8 @@
 		return -1;
 	}
 
-	/* If IPv6 is configured but the media stream does not have it reject this stream */
-	if (session->endpoint->rtp_ipv6 && !ast_sockaddr_is_ipv6(addrs)) {
+	/* Using the connection information create an appropriate RTP instance */
+	if (!session->media[AST_SIP_MEDIA_AUDIO].rtp && audio_create_rtp(session, ast_sockaddr_is_ipv6(addrs))) {}
 		return -1;
 	}
 
@@ -152,7 +152,7 @@
 	if (!ast_format_cap_has_type(session->endpoint->codecs, AST_FORMAT_TYPE_AUDIO)) {
 		/* If no audio formats are configured don't add a stream */
 		return 0;
-	} else if (!session->media[AST_SIP_MEDIA_AUDIO].rtp && audio_create_rtp(session)) {
+	} else if (!session->media[AST_SIP_MEDIA_AUDIO].rtp && audio_create_rtp(session, session->endpoint->rtp_ipv6)) {
 		return -1;
 	}
 
@@ -266,7 +266,7 @@
 	struct ast_format fmt;
 
 	/* Create an RTP instance if need be */
-	if (!session->media[AST_SIP_MEDIA_AUDIO].rtp && audio_create_rtp(session)) {
+	if (!session->media[AST_SIP_MEDIA_AUDIO].rtp && audio_create_rtp(session, session->endpoint->rtp_ipv6)) {
 		return -1;
 	}
 




More information about the asterisk-commits mailing list