--- rtp.c 2006-05-24 15:14:42.000000000 +0200 +++ rtp_patched.c 2006-05-24 15:28:50.000000000 +0200 -66,6 +66,15 @@ static int rtpend = 0; static int rtpdebug = 0; /* Are we debugging? */ static struct sockaddr_in rtpdebugaddr; /* Debug packets to/from this host */ + + +/* *** PATCHED *** */ +static struct in_addr rtp_bindaddr; +/* ************** */ + + + + #ifdef SO_NO_CHECK static int nochecksums = 0; #endif -958,7 +967,11 @@ for (;;) { /* Must be an even port number by RTP spec */ rtp->us.sin_port = htons(x); - rtp->us.sin_addr = addr; + + + //PATCHED ->>> rtp->us.sin_addr = addr; + rtp->us.sin_addr = (rtp_bindaddr.s_addr != 0 ? rtp_bindaddr : addr); + /* If there's rtcp, initialize it as well. */ if (rtp->rtcp) rtp->rtcp->us.sin_port = htons(x + 1); -1825,6 +1838,12 @@ struct ast_config *cfg; char *s; +// PATCHED + struct ast_hostent ahp; + struct hostent *hp; + + + rtpstart = 5000; rtpend = 31000; dtmftimeout = DEFAULT_DTMF_TIMEOUT; -1844,7 +1863,21 @@ if (rtpend > 65535) rtpend = 65535; } - if ((s = ast_variable_retrieve(cfg, "general", "rtpchecksums"))) { + + + /* *** PATCHED *** */ + if ((s = ast_variable_retrieve(cfg, "general", "rtp_bindaddr"))) { + if (!(hp = ast_gethostbyname(s, &ahp))) { + ast_log(LOG_WARNING, "Invalid address: %s\n", s); + } else { + memcpy(&rtp_bindaddr, hp->h_addr, sizeof(rtp_bindaddr)); + } + } + /* ************** */ + + + + if ((s = ast_variable_retrieve(cfg, "general", "rtpchecksums"))) { #ifdef SO_NO_CHECK if (ast_false(s)) nochecksums = 1;