diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d913b938d38480569eeb06aa08a4452e505e5ec8..563350cb9b56140a65af36a4fa3e748b51adec35 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10928,10 +10928,9 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, int sipmethod, ui * final response. For a CANCEL or ACK, we have to send to the same destination * as the original INVITE. */ - if (sipmethod == SIP_CANCEL || - (sipmethod == SIP_ACK && (p->invitestate == INV_COMPLETED || p->invitestate == INV_CANCELLED))) { - set_destination(p, ast_strdupa(p->uri)); - } else if (p->route) { + if (p->route && + !(sipmethod == SIP_CANCEL || + (sipmethod == SIP_ACK && (p->invitestate == INV_COMPLETED || p->invitestate == INV_CANCELLED)))) { set_destination(p, p->route->hop); add_route(req, is_strict ? p->route->next : p->route); }