added the max_forwards configuration option.

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1835 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Raphael Coeffic 16 years ago
parent 94d697dd4e
commit c4c926bd69

@ -59,6 +59,7 @@ string AmConfig::LocalSIPIP = "";
string AmConfig::OutboundProxy = "";
bool AmConfig::ForceOutboundProxy = false;
string AmConfig::Signature = "";
unsigned int AmConfig::MaxForwards = MAX_FORWARDS;
bool AmConfig::SingleCodecInOK = false;
unsigned int AmConfig::DeadRtpTime = DEAD_RTP_TIME;
bool AmConfig::IgnoreRTPXHdrs = false;
@ -243,6 +244,16 @@ int AmConfig::readConfiguration()
else
Signature = cfg.getParameter("signature");
if (cfg.hasParameter("max_forwards")) {
unsigned int mf=0;
if(str2i(cfg.getParameter("max_forwards"), mf)) {
ERROR("invalid max_forwards specified\n");
}
else {
MaxForwards = mf;
}
}
// log_level
if(cfg.hasParameter("loglevel")){
if(!setLoglevel(cfg.getParameter("loglevel"))){

@ -91,6 +91,8 @@ struct AmConfig
static bool ForceOutboundProxy;
/** Server/User-Agent header (optional) */
static string Signature;
/** Value of Max-Forward header field for new requests */
static unsigned int MaxForwards;
/** If 200 OK reply should be limited to preferred codec only */
static bool SingleCodecInOK;
static vector <string> CodecOrder;

@ -585,7 +585,7 @@ int AmSipDialog::sendRequest(const string& method,
if (AmConfig::Signature.length())
req.hdrs += SIP_HDR_COLSP(SIP_HDR_USER_AGENT) + AmConfig::Signature + CRLF;
req.hdrs += SIP_HDR_COLSP(SIP_HDR_MAX_FORWARDS) /*TODO: configurable?!*/ MAX_FORWARDS CRLF;
req.hdrs += SIP_HDR_COLSP(SIP_HDR_MAX_FORWARDS) + int2str(AmConfig::MaxForwards) + CRLF;
}
@ -686,12 +686,11 @@ int AmSipDialog::send_200_ack(const AmSipTransaction& t,
if (AmConfig::Signature.length())
req.hdrs += SIP_HDR_COLSP(SIP_HDR_USER_AGENT) + AmConfig::Signature + CRLF;
req.hdrs += SIP_HDR_COLSP(SIP_HDR_MAX_FORWARDS) /*TODO: configurable?!*/MAX_FORWARDS CRLF;
req.hdrs += SIP_HDR_COLSP(SIP_HDR_MAX_FORWARDS) + int2str(AmConfig::MaxForwards) + CRLF;
}
if(!route.empty())
req.route = route; //getRoute();
req.route = route;
if(!body.empty()) {
req.content_type = content_type;

@ -39,7 +39,7 @@
#define PREFIX_SEPARATOR ""
#define RTP_LOWPORT 1024
#define RTP_HIGHPORT 0xffff
#define MAX_FORWARDS "70"
#define MAX_FORWARDS 70
#define DEFAULT_SIGNATURE "Sip Express Media Server " \
"(" SEMS_VERSION " (" ARCH "/" OS"))"

Loading…
Cancel
Save