From: Mark Michelson Date: Fri, 10 Jul 2009 15:51:36 +0000 (+0000) Subject: Ensure that outbound NOTIFY requests are properly routed through stateful proxies. X-Git-Tag: 1.4.26-rc6~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43a5245325cb5af071232ac52b779f2042926e5a;p=thirdparty%2Fasterisk.git Ensure that outbound NOTIFY requests are properly routed through stateful proxies. With this change, we make note of Record-Route headers present in any SUBSCRIBE request that we receive so that our outbound NOTIFY requests will have the proper Route headers in them. (closes issue #14725) Reported by: ibc git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@205775 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index df825e7da8..132899f341 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -7314,8 +7314,11 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, int sipmetho snprintf(tmp, sizeof(tmp), "%d %s", ++p->ocseq, sip_methods[sipmethod].text); add_header(req, "Via", p->via); - /* SLD: FIXME?: do Route: here too? I think not cos this is the first request. - * OTOH, then we won't have anything in p->route anyway */ + /* This will be a no-op most of the time. However, under certain circumstances, + * NOTIFY messages will use this function for preparing the request and should + * have Route headers present. + */ + add_route(req, p->route); /* Build Remote Party-ID and From */ if (ast_test_flag(&p->flags[0], SIP_SENDRPID) && (sipmethod == SIP_INVITE)) { build_rpid(p); @@ -15768,6 +15771,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, copy_request(&p->initreq, req); check_via(p, req); + build_route(p, req, 0); } else if (ast_test_flag(req, SIP_PKT_DEBUG) && ast_test_flag(req, SIP_PKT_IGNORE)) ast_verbose("Ignoring this SUBSCRIBE request\n");