Commit c8b49644 authored by François Grisez's avatar François Grisez

Rewrite request URIs only if they are not fully resolved

parent adc9deb1
......@@ -67,7 +67,7 @@ ForwardModule::~ForwardModule() {
void ForwardModule::onDeclare(GenericStruct *module_config) {
ConfigItemDescriptor items[] = {
{String, "route", "A sip uri where to send all requests", ""},
{String, "route", "A sip uri where to send all requests", ""},
{Boolean, "add-path", "Add a path header of this proxy", "true"},
{Boolean, "rewrite-req-uri", "Rewrite request-uri's host and port according to above route", "false"},
config_item_end};
......@@ -98,10 +98,10 @@ url_t *ForwardModule::overrideDest(shared_ptr<RequestSipEvent> &ev, url_t *dest)
}
}
dest = mOutRoute->r_url;
if (mRewriteReqUri) {
sip->sip_request->rq_url->url_host = mOutRoute->r_url->url_host;
sip->sip_request->rq_url->url_port = mOutRoute->r_url->url_port;
}
if(mRewriteReqUri && (!isNumeric(dest->url_host) || !dest->url_port)) {
sip->sip_request->rq_url->url_host = mOutRoute->r_url->url_host;
sip->sip_request->rq_url->url_port = mOutRoute->r_url->url_port;
}
}
return dest;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment