[asterisk-commits] twilson: branch group/srtp r165396 - /team/group/srtp/main/rtp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 17 17:09:53 CST 2008


Author: twilson
Date: Wed Dec 17 17:09:53 2008
New Revision: 165396

URL: http://svn.digium.com/view/asterisk?view=rev&rev=165396
Log:
There were some sendto() calls that needed to be changed to rtp_sendto() where the check for the need to encrypt/decrypt is done to get audio to be encrypted when Asterisk sends it out.

Modified:
    team/group/srtp/main/rtp.c

Modified: team/group/srtp/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/group/srtp/main/rtp.c?view=diff&rev=165396&r1=165395&r2=165396
==============================================================================
--- team/group/srtp/main/rtp.c (original)
+++ team/group/srtp/main/rtp.c Wed Dec 17 17:09:53 2008
@@ -1120,11 +1120,15 @@
 int ast_rtp_register_srtp(struct ast_srtp_res *srtp_res,
 			   struct ast_srtp_policy_res *policy_res)
 {
-	if (g_srtp_res || g_policy_res)
+	if (g_srtp_res || g_policy_res) {
+		ast_log(LOG_WARNING, "Unable to register SRTP\n");
 		return -1;
-
-	if (!srtp_res || !policy_res)
+	}
+
+	if (!srtp_res || !policy_res) {
+		ast_log(LOG_WARNING, "Unable to register SRTP\n");
 		return -1;
+	}
 
 	g_srtp_res = srtp_res;
 	g_policy_res = policy_res;
@@ -3326,7 +3330,7 @@
 	rtpheader[0] = htonl((2 << 30) | (rtp->send_payload << 16) | (rtp->seqno));
 	
 	/* Transmit */
-	res = sendto(rtp->s, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, sizeof(rtp->them));
+	res = rtp_sendto(rtp, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, sizeof(rtp->them));
 	if (res < 0)
 		ast_log(LOG_ERROR, "RTP Transmission error to %s:%d: %s\n",
 			ast_inet_ntoa(rtp->them.sin_addr),
@@ -3382,7 +3386,7 @@
 	/* Send 3 termination packets */
 	for (i = 0; i < 3; i++) {
 		rtpheader[0] = htonl((2 << 30) | (rtp->send_payload << 16) | (rtp->seqno));
-		res = sendto(rtp->s, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, sizeof(rtp->them));
+		res = rtp_sendto(rtp, (void *) rtpheader, hdrlen + 4, 0, (struct sockaddr *) &rtp->them, sizeof(rtp->them));
 		rtp->seqno++;
 		if (res < 0)
 			ast_log(LOG_ERROR, "RTP Transmission error to %s:%d: %s\n",
@@ -3795,7 +3799,7 @@
 	put_unaligned_uint32(rtpheader + 8, htonl(rtp->ssrc)); 
 
 	if (rtp->them.sin_port && rtp->them.sin_addr.s_addr) {
-		res = sendto(rtp->s, (void *)rtpheader, f->datalen + hdrlen, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
+		res = rtp_sendto(rtp, (void *)rtpheader, f->datalen + hdrlen, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
 		if (res < 0) {
 			if (!rtp->nat || (rtp->nat && (ast_test_flag(rtp, FLAG_NAT_ACTIVE) == FLAG_NAT_ACTIVE))) {
 				ast_debug(1, "RTP Transmission error of packet %d to %s:%d: %s\n", rtp->seqno, ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port), strerror(errno));




More information about the asterisk-commits mailing list