<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    iirc, the to-tag is set in the dialog structure when the 200ok is
    processed. During the call setup, there can be many outgoing
    branches, therefore many 'early' to-tags, but only one will be
    final, once the call is answered.<br>
    <br>
    On the other hand, there is a C function that returns the local
    generated To-tag. It is in sl module, named get_reply_totag(...). It
    is not available in the config file, not being needed so far.<br>
    <br>
    Anyhow, in your case, might be better to add a function
    dlg_get_early(callid, ftag), because to-tag of the dialog is not
    really known at that moment.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 14/07/15 17:14, Joao Alves wrote:<br>
    </div>
    <blockquote
cite="mid:BE9CCC3E59E41A43B74480AD128661E80114A95035@ILRAADAGBE3.corp.amdocs.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">Hi,<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">I’m trying to restore a SIP session
          dialogue context and  found dlg_get(callid, ftag, ttag)
          function for that.
          <o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">However, I cannot access the To tag. I
          noticed on the 180 RINGING there was already an self-generated
          included on this response, but I also could not access its
          value.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">When receiving the SIP INVITE request I
          used the dlg_manage() and the context was initially stored.
          <o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">if(is_known_dlg()) {</span><span
            style="font-size:12.0pt;font-family:"Times New
            Roman",serif"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">                xlog("Request $rm from
            $ci is in-dialog\n");<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">                xlog(">>From tag is
            $ft and To tag is $tt\n");<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">                # Needed to later restore
            the dialog
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">                $shv(ftag)=$ft;<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">                $shv(ttag)=$tt;<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">        }<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) ERROR: <script>: Request
            INVITE from 76589ZWQ5NzIyYjMzNDI1YjVjM2E5ZWU5NjhkYzEyNjE3MzQ
            is in-dialog</span><span
            style="font-size:12.0pt;font-family:"Times New
            Roman",serif"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) exec: ***
            cfgtrace:request_route=[MATRIX]
            c=[/etc/kamailio/kamailio.cfg] l=1021 a=25 n=xlog<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: pv [pv_core.c:376]:
            pv_get_xto_attr(): no Tag parameter<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) ERROR: <script>:
            >>From tag is 8fd06474 and To tag is <null><o:p></o:p></span></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Since there was a self-generated one (after
          the 180 RINGING being sent), I rechecked the $tt and
          $dlg(to_tag) values and both still returned null values.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: tm [t_lookup.c:1083]:
            t_check_msg(): DEBUG: t_check_msg: T already found!<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: <core>
            [tcp_main.c:2196]: tcpconn_send_put(): send from reader
            (49100 (15)), reusing fd<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: <core>
            [tcp_main.c:2430]: tcpconn_do_send(): sending...<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: <core>
            [tcp_main.c:2464]: tcpconn_do_send(): after real write: c=
            0x7effdf7da860 n=396 fd=5<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: <core>
            [tcp_main.c:2465]: tcpconn_do_send(): buf=<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">SIP/2.0 180 ringing<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">Via: SIP/2.0/TCP
192.168.1.5:58751;branch=z9hG4bK-524287-1---a64e0a42199ee419;rport=61134;received=85.138.200.8<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">To:
<a class="moz-txt-link-rfc2396E" href="sip:1001@decasa.website"><sip:1001@decasa.website></a>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-f6a3<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">From:
            "1000"<a class="moz-txt-link-rfc2396E" href="sip:1000@decasa.website"><sip:1000@decasa.website></a>;tag=8fd06474<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">Call-ID:
            76589ZWQ5NzIyYjMzNDI1YjVjM2E5ZWU5NjhkYzEyNjE3MzQ<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">CSeq: 1 INVITE<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">Server: kamailio (4.3.0 (x86_64/linux))<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">Content-Length: 0<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">..., shmem=0x7effdf7e1e00: SIP/2.0 180
            ringingght(): DEBUG: reply sent out. buf=0x7effec023bf8:
            SIP/2.0 180 ringing<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: tm [t_reply.c:657]:
            _reply_light(): DEBUG: _reply_light: finished<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: sl [sl.c:272]:
            send_reply(): reply in stateful mode (tm)<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) exec: ***
            cfgtrace:request_route=[MATRIX]
            c=[/etc/kamailio/kamailio.cfg] l=1031 a=25 n=xlog<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: dialog [dlg_hash.c:640]:
            dlg_lookup(): ref dlg 0x7effdf7e1bf0 with 1 -> 2<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: dialog [dlg_hash.c:642]:
            dlg_lookup(): dialog id=5769 found on entry 128<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: dialog [dlg_hash.c:858]:
            dlg_unref(): unref dlg 0x7effdf7e1bf0 with 1 -> 1<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) ERROR: <script>: Dialog
            To Tag: <null>  
                                                                       
                                                <==
          </span><span style="font-family:"Times New
            Roman",serif">xlog("</span><span
            style="font-family:"Times New Roman",serif">Dialog
            To Tag:</span><span style="font-family:"Times New
            Roman",serif"> $dlg(to_tag)\n");</span><span
            style="font-size:12.0pt;font-family:"Times New
            Roman",serif"><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) exec: ***
            cfgtrace:request_route=[MATRIX]
            c=[/etc/kamailio/kamailio.cfg] l=1033 a=25 n=xlog<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) DEBUG: pv [pv_core.c:376]:
            pv_get_xto_attr(): no Tag parameter<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-family:"Times New
            Roman",serif">15(49100) ERROR: <script>:
            >>From2 tag is 8fd06474 and To tag is <null><o:p></o:p></span></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Many thanks,<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><b><span
              style="font-size:9.0pt;font-family:"Verdana",sans-serif">Joao
              Alves</span></b><b><span
              style="font-size:9.0pt;font-family:"Verdana",sans-serif"><o:p></o:p></span></b></p>
        <p class="MsoNormal"><span
style="font-size:7.5pt;font-family:"Verdana",sans-serif;color:black">Solution
            Architect, Unified Communications</span><span
            style="font-size:7.5pt;font-family:"Verdana",sans-serif"
            lang="EN-GB"><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:7.5pt;font-family:"Verdana",sans-serif"
            lang="EN-GB"><o:p> </o:p></span></p>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
      This message and the information contained herein is proprietary
      and confidential and subject to the Amdocs policy statement,
      you may review at <a class="moz-txt-link-freetext" href="http://www.amdocs.com/email_disclaimer.asp">http://www.amdocs.com/email_disclaimer.asp</a>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a 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 class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>