Index: main/rtp.c =================================================================== --- main/rtp.c (revision 152803) +++ main/rtp.c (working copy) @@ -65,6 +65,8 @@ #define RTP_MTU 1200 #define DEFAULT_DTMF_TIMEOUT 3000 /*!< samples */ +#define DEFAULT_RTP_START 5000 /*!< Default first RTP port. */ +#define DEFAULT_RTP_END 31000 /*!< Default last RTP port. */ static int dtmftimeout = DEFAULT_DTMF_TIMEOUT; @@ -4696,12 +4698,17 @@ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; cfg = ast_config_load2("rtp.conf", "rtp", config_flags); - if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) { + if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_WARNING, "Missing or invalid 'rtp.conf' file, defaulting port range to %d-%d\n", DEFAULT_RTP_START, DEFAULT_RTP_END); + rtpstart = DEFAULT_RTP_START; + rtpend = DEFAULT_RTP_END; return 0; + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { + return 0; } - rtpstart = 5000; - rtpend = 31000; + rtpstart = DEFAULT_RTP_START; + rtpend = DEFAULT_RTP_END; dtmftimeout = DEFAULT_DTMF_TIMEOUT; strictrtp = STRICT_RTP_OPEN; if (cfg) { @@ -4754,8 +4761,8 @@ } if (rtpstart >= rtpend) { ast_log(LOG_WARNING, "Unreasonable values for RTP start/end port in rtp.conf\n"); - rtpstart = 5000; - rtpend = 31000; + rtpstart = DEFAULT_RTP_START; + rtpend = DEFAULT_RTP_END; } ast_verb(2, "RTP Allocating from port range %d -> %d\n", rtpstart, rtpend); return 0;