All pastes #66 Raw Edit

twisted

public text v1 · immutable
#66 ·published 2004-03-31 11:56 UTC
rendered paste body
--- rtp.c	2004-03-31 05:52:25.000000000 -0600
+++ rtp.c	2004-03-31 05:54:24.000000000 -0600
@@ -47,6 +47,9 @@
 
 static int rtpstart = 0;
 static int rtpend = 0;
+static int do_bindaddr = 0;
+
+struct in_addr bindaddr;
 
 // The value of each payload format mapping:
 struct rtpPayloadType {
@@ -756,6 +759,9 @@
 	memset(rtp, 0, sizeof(struct ast_rtp));
 	rtp->them.sin_family = AF_INET;
 	rtp->us.sin_family = AF_INET;
+	if (do_bindaddr) {
+		memcpy(&rtp->us.sin_addr, &bindaddr, sizeof(rtp->us.sin_addr));
+	}
 	rtp->s = socket(AF_INET, SOCK_DGRAM, 0);
 	rtp->ssrc = rand();
 	rtp->seqno = rand() & 0xffff;
@@ -1429,6 +1435,11 @@
 			if (rtpend > 65535)
 				rtpend = 65535;
 		}
+		// get the bind to address... like we should 
+		if ((s = ast_variable_retrieve(cfg, "general", "bindaddr"))) {
+			inet_aton(s, &bindaddr);
+		        do_bindaddr = 1;	
+		}
 		ast_destroy(cfg);
 	}
 	if (rtpstart >= rtpend) {