Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (Revision 355573) +++ channels/chan_sip.c (Arbeitskopie) @@ -1280,7 +1280,7 @@ static struct sip_pvt *find_call(struct sip_request *req, struct ast_sockaddr *addr, const int intended_method); static void free_old_route(struct sip_route *route); static void list_route(struct sip_route *route); -static void build_route(struct sip_pvt *p, struct sip_request *req, int backwards); +static void build_route(struct sip_pvt *p, struct sip_request *req, int backwards, int persistentroute); static enum check_auth_result register_verify(struct sip_pvt *p, struct ast_sockaddr *addr, struct sip_request *req, const char *uri); static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *totag, const char *fromtag); @@ -14152,7 +14152,7 @@ } /*! \brief Build route list from Record-Route header */ -static void build_route(struct sip_pvt *p, struct sip_request *req, int backwards) +static void build_route(struct sip_pvt *p, struct sip_request *req, int backwards, int persistentroute) { struct sip_route *thishop, *head, *tail; int start = 0; @@ -14171,7 +14171,9 @@ } /* We only want to create the route set the first time this is called */ - p->route_persistent = 1; + if (persistentroute) { + p->route_persistent = 1; + } /* Build a tailq, then assign it to p->route when done. * If backwards, we add entries from the head so they end up @@ -19969,7 +19971,7 @@ * */ parse_ok_contact(p, req); if (!reinvite) { - build_route(p, req, 1); + build_route(p, req, 1, 0); } if (!req->ignore && p->owner) { if (get_rpid(p, req)) { @@ -20019,7 +20021,7 @@ * */ parse_ok_contact(p, req); if (!reinvite) { - build_route(p, req, 1); + build_route(p, req, 1, 0); } if (!req->ignore && p->owner) { struct ast_party_redirecting redirecting; @@ -20045,7 +20047,7 @@ * */ parse_ok_contact(p, req); if (!reinvite) { - build_route(p, req, 1); + build_route(p, req, 1, 0); } if (!req->ignore && p->owner) { if (get_rpid(p, req)) { @@ -20145,7 +20147,7 @@ parse_ok_contact(p, req); /* Save Record-Route for any later requests we make on this dialogue */ if (!reinvite) - build_route(p, req, 1); + build_route(p, req, 1, 1); if(set_address_from_contact(p)) { /* Bad contact - we don't know how to reach this device */ @@ -22649,7 +22651,7 @@ *recount = 1; /* Save Record-Route for any later requests we make on this dialogue */ - build_route(p, req, 0); + build_route(p, req, 0, 1); if (c) { ast_party_redirecting_init(&redirecting); @@ -24531,7 +24533,7 @@ if (sipdebug) ast_debug(4, "Initializing initreq for method %s - callid %s\n", sip_methods[req->method].text, p->callid); check_via(p, req); - build_route(p, req, 0); + build_route(p, req, 0, 1); } else if (req->debug && req->ignore) ast_verbose("Ignoring this SUBSCRIBE request\n");