[prev in list] [next in list] [prev in thread] [next in thread] 

List:       serusers
Subject:    Re: [SR-Users] Hop by hop CANCEL, wrong to header
From:       Vitaliy Aleksandrov <vitalik.voip () gmail ! com>
Date:       2012-05-25 7:45:15
Message-ID: 4FBF388B.5070302 () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello Daniel,

Thanks for the reply.

Sorry i have made a typo. If E2E_CANCEL_HOP_BY_HOP is defined then 
e2e_cancel() from t_fwd.c calls cancel_branch() function for each branch 
it found at a t_invite transaction.
Then if cfg_get(tm, tm_cfg, reparse_invite) is true cancel_branch() 
calls build_local_reparse() which returns new CANCEL request buffer 
based on outgoing INVITE, but with original To header.

I've searched a bit deeper and found that if E2E_CANCEL_HOP_BY_HOP is 
not defined e2e_cancel() calls e2e_cancel_branch(), which then calls 
build_local_reparse() like in previous description when 
E2E_CANCEL_HOP_BY_HOP was defined.

So the main question is why does kamailio take "To" field from a 
transaction cell and not from outgoing buffer like it does with other 
headers ?

I'm using kamailio-3.0.2, but i have checked 3.2.2 sources and haven't 
found any changes at the functions mentioned above.

Cheers,
Vitaliy Aleksandrov

> Hello,
>
> On 5/23/12 5:22 PM, Vitaliy Aleksandrov wrote:
>> Hi all,
>>
>> I have a question about CANCEL message processing.
>>
>> My call sceraio:
>> 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.
>> 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.
>> To avoid that problem i have tried to move rewriting part(subst from 
>> the textops module) to the branch_route.
>>
>> 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() ).
>> As i understood from the documentation and mailing list kamailio 
>> builds CANCEL based on outgoing INVITE.
>>
>> I did a small research and found that Kamailio really takes outgoing 
>> INVITE from each branch (invite_transaction_cell -> 
>> uac[b_id].request.buffer) and builds CANCEL (build_local_reparse() 
>> from tm/t_msgbuilder.c) based on it.
>> But kamailio does an exception for the To header which is described 
>> below:
>> ***cancel_branch* function (from t_cancel.c) calls 
>> *build_local_reparse*() and fills one of the parameters with a 
>> pointer to unmodified To header.
>> *    build_local_reparse*() uses received To header to construct 
>> outgoing CANCEL.
>>
>> I have changed:
>>     cancel = build_local_reparse(t, branch, &len, CANCEL, CANCEL_LEN, 
>> &t->to, reason);
>> to:
>>     cancel = build_local_reparse(t, branch, &len, CANCEL, CANCEL_LEN, 
>> NULL, reason);
>> and it works for me now.
>>
>> It looks like if E2E_CANCEL_HOP_BY_HOP *e2e_cancel()* (t_fwd.c) will 
>> call *e2e_cancel_branch()* which works as i want instead of 
>> *cancel_branch()*, but it is just my assumption.
>
> do you mean if E2E_CANCEL_HOP_BY_HOP is defined? I quick grep at this 
> time showed it is defined in t_fwd.h...
>
> What is the version you are using?
>
> Cheers,
> Daniel
>
>>
>> Why does kamailio generate CANCEL requests in such a way ? Did i miss 
>> something from the RFC3261 or kamailio documentation ?
>>
>> Thanks in advance for any help !
>>
>>
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users@lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
> -- 
> Daniel-Constantin Mierla -http://www.asipto.com
> http://twitter.com/#!/miconda  -http://www.linkedin.com/in/miconda
>
>


[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hello Daniel, <br>
    <br>
    Thanks for the reply.<br>
    <br>
    Sorry i have made a typo. If E2E_CANCEL_HOP_BY_HOP is defined then
    e2e_cancel() from t_fwd.c calls cancel_branch() function for each
    branch it found at a t_invite transaction.<br>
    Then if cfg_get(tm, tm_cfg, reparse_invite) is true cancel_branch()
    calls build_local_reparse() which returns new CANCEL request buffer
    based on outgoing INVITE, but with original To header.<br>
    <br>
    I've searched a bit deeper and found that if E2E_CANCEL_HOP_BY_HOP
    is not defined e2e_cancel() calls e2e_cancel_branch(), which then
    calls build_local_reparse() like in previous description when
    E2E_CANCEL_HOP_BY_HOP was defined.<br>
    <br>
    So the main question is why does kamailio take "To" field from a
    transaction cell and not from outgoing buffer like it does with
    other headers ?<br>
    <br>
    I'm using kamailio-3.0.2, but i have checked 3.2.2 sources and
    haven't found any changes at the functions mentioned above.<br>
    <br>
    Cheers,<br>
    Vitaliy Aleksandrov<br>
    <br>
    <blockquote cite="mid:4FBEBB5F.8000302@gmail.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      Hello,<br>
      <br>
      <div class="moz-cite-prefix">On 5/23/12 5:22 PM, Vitaliy
        Aleksandrov wrote:<br>
      </div>
      <blockquote cite="mid:4FBD00CB.7050304@gmail.com" type="cite">
        <meta http-equiv="content-type" content="text/html;
          charset=ISO-8859-1">
        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>
      </blockquote>
      <br>
      do you mean if E2E_CANCEL_HOP_BY_HOP is defined? I quick grep at
      this time showed it is defined in t_fwd.h...<br>
      <br>
      What is the version you are using?<br>
      <br>
      Cheers,<br>
      Daniel<br>
      <br>
      <blockquote cite="mid:4FBD00CB.7050304@gmail.com" type="cite"> <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>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" \
href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a> <a \
moz-do-not-send="true" class="moz-txt-link-freetext" \
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
 </pre>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a moz-do-not-send="true" class="moz-txt-link-freetext" \
href="http://www.asipto.com">http://www.asipto.com</a> <a moz-do-not-send="true" \
class="moz-txt-link-freetext" \
href="http://twitter.com/#%21/miconda">http://twitter.com/#!/miconda</a> - <a \
moz-do-not-send="true" class="moz-txt-link-freetext" \
href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
  <br>
      <br>
    </blockquote>
    <br>
  </body>
</html>



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic