<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi all,<br>
    <br>
    I have a question about CANCEL message processing.<br>
    <br>
    My call sceraio:<br>
    When an INVITE request comes I need to rewrite a domain part of the
    several headers(to, from, contact, SDP ip) according to the outgoing
    interface.<br>
    I can do it before t_relay(), but when destination user has more
    then one locations and they are reachable through different
    interfaces all forked INVITEs will have the same domain.<br>
    To avoid that problem i have tried to move rewriting part(subst from
    the textops module) to the branch_route.<br>
    <br>
    Unfortunately that solution didn't helped me, because "To" header of
    the outgoing CANCEL messages is wrong (unchanged. as it was at the
    moment when transaction was created by the t_relay() ).<br>
    As i understood from the documentation and mailing list kamailio
    builds CANCEL based on outgoing INVITE.<br>
    <br>
    I did a small research and found that Kamailio really takes outgoing
    INVITE from each branch (invite_transaction_cell -&gt;
    uac[b_id].request.buffer) and builds CANCEL (build_local_reparse()
    from tm/t_msgbuilder.c) based on it.<br>
    But kamailio does an exception for the To header which is described
    below:<br>
    <b>&nbsp;&nbsp;&nbsp; </b><b>cancel_branch</b> function (from t_cancel.c) calls <b>build_local_reparse</b>()
    and fills one of the parameters with a pointer to unmodified To
    header.<br>
    <b>&nbsp;&nbsp;&nbsp; build_local_reparse</b>() uses received To header to
    construct outgoing CANCEL.<br>
    <br>
    I have changed:<br>
    &nbsp;&nbsp;&nbsp; cancel = build_local_reparse(t, branch, &amp;len, CANCEL,
    CANCEL_LEN, &amp;t-&gt;to, reason);<br>
    to:<br>
    &nbsp;&nbsp;&nbsp; cancel = build_local_reparse(t, branch, &amp;len, CANCEL,
    CANCEL_LEN, NULL, reason);<br>
    and it works for me now.<br>
    <br>
    It looks like if E2E_CANCEL_HOP_BY_HOP <b>e2e_cancel()</b>
    (t_fwd.c) will call <b>e2e_cancel_branch()</b> which works as i
    want instead of <b>cancel_branch()</b>, but it is just my
    assumption.<br>
    <br>
    Why does kamailio generate CANCEL requests in such a way ? Did i
    miss something from the RFC3261 or kamailio documentation ?<br>
    <br>
    Thanks in advance for any help !<br>
    <br>
    <br>
  </body>
</html>