<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@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:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Times New Roman \,serif";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        color:black;}
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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@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]-->
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi Daniel,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">If I remember correctly the To-tag would be needed prior to 200 OK do to “early dialogs”. Which in a way is supported by the 180 Ringing where the To-tag was self-generated by kamailio when building the response.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">So I was not sure was a “bug” not updating the $tt accordingly or, whether there would be a need for a new function dlg_get_early(callid, ftag) as you suggested.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">But both would work for me. If this could be done, appreciated</span><span style="font-family:Wingdings;color:#1F497D">J</span><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Many Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Joao <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> Daniel-Constantin Mierla [mailto:miconda@gmail.com]
<br>
<b>Sent:</b> quinta-feira, 16 de Julho de 2015 10:38<br>
<b>To:</b> Kamailio (SER) - Users Mailing List; Joao Alves<br>
<b>Subject:</b> Re: [SR-Users] Dialogue restore after initial processing<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">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<span style="font-size:12.0pt"><o:p></o:p></span></p>
<div>
<p class="MsoNormal">On 14/07/15 17:14, Joao Alves wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<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",serif">if(is_known_dlg()) {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">                xlog("Request $rm from $ci is in-dialog\n");</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">                xlog(">>From tag is $ft and To tag is $tt\n");</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">                # Needed to later restore the dialog
</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">                $shv(ftag)=$ft;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">                $shv(ttag)=$tt;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">        }</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) ERROR: <script>: Request INVITE from 76589ZWQ5NzIyYjMzNDI1YjVjM2E5ZWU5NjhkYzEyNjE3MzQ is in-dialog</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) exec: *** cfgtrace:request_route=[MATRIX] c=[/etc/kamailio/kamailio.cfg] l=1021 a=25 n=xlog</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: pv [pv_core.c:376]: pv_get_xto_attr(): no Tag parameter</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) ERROR: <script>: >>From tag is 8fd06474 and To tag is <null></span><o:p></o:p></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",serif">15(49100) DEBUG: tm [t_lookup.c:1083]: t_check_msg(): DEBUG: t_check_msg: T already found!</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: <core> [tcp_main.c:2196]: tcpconn_send_put(): send from reader (49100 (15)), reusing fd</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: <core> [tcp_main.c:2430]: tcpconn_do_send(): sending...</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: <core> [tcp_main.c:2464]: tcpconn_do_send(): after real write: c= 0x7effdf7da860 n=396 fd=5</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: <core> [tcp_main.c:2465]: tcpconn_do_send(): buf=</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">SIP/2.0 180 ringing</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">Via: SIP/2.0/TCP 192.168.1.5:58751;branch=z9hG4bK-524287-1---a64e0a42199ee419;rport=61134;received=85.138.200.8</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">To:
</span><a href="sip:1001@decasa.website"><span style="font-family:"Times New Roman ,serif",serif"><sip:1001@decasa.website></span></a><span style="font-family:"Times New Roman ,serif",serif">;tag=a6a1c5f60faecf035a1ae5b6e96e979a-f6a3</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">From: "1000"</span><a href="sip:1000@decasa.website"><span style="font-family:"Times New Roman ,serif",serif"><sip:1000@decasa.website></span></a><span style="font-family:"Times New Roman ,serif",serif">;tag=8fd06474</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">Call-ID: 76589ZWQ5NzIyYjMzNDI1YjVjM2E5ZWU5NjhkYzEyNjE3MzQ</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">CSeq: 1 INVITE</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">Server: kamailio (4.3.0 (x86_64/linux))</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">Content-Length: 0</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">..., shmem=0x7effdf7e1e00: SIP/2.0 180 ringingght(): DEBUG: reply sent out. buf=0x7effec023bf8: SIP/2.0 180 ringing</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: tm [t_reply.c:657]: _reply_light(): DEBUG: _reply_light: finished</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: sl [sl.c:272]: send_reply(): reply in stateful mode (tm)</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) exec: *** cfgtrace:request_route=[MATRIX] c=[/etc/kamailio/kamailio.cfg] l=1031 a=25 n=xlog</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: dialog [dlg_hash.c:640]: dlg_lookup(): ref dlg 0x7effdf7e1bf0 with 1 -> 2</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: dialog [dlg_hash.c:642]: dlg_lookup(): dialog id=5769 found on entry 128</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: dialog [dlg_hash.c:858]: dlg_unref(): unref dlg 0x7effdf7e1bf0 with 1 -> 1</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) ERROR: <script>: Dialog To Tag: <null>                                                                                                   <== xlog("</span><span style="font-family:"Times New Roman",serif">Dialog
 To Tag:</span><span style="font-family:"Times New Roman ,serif",serif"> $dlg(to_tag)\n");</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) exec: *** cfgtrace:request_route=[MATRIX] c=[/etc/kamailio/kamailio.cfg] l=1033 a=25 n=xlog</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) DEBUG: pv [pv_core.c:376]: pv_get_xto_attr(): no Tag parameter</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman ,serif",serif">15(49100) ERROR: <script>: >>From2 tag is 8fd06474 and To tag is <null></span><o:p></o:p></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><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Verdana",sans-serif">Solution Architect, Unified Communications</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="font-size:7.5pt;font-family:"Verdana",sans-serif"> </span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif">This message and the information contained herein is proprietary and confidential and subject to the Amdocs policy statement, you may review at
</span><a href="http://www.amdocs.com/email_disclaimer.asp"><span style="font-size:12.0pt;font-family:"Times New Roman",serif">http://www.amdocs.com/email_disclaimer.asp</span></a><span style="font-size:12.0pt;font-family:"Times New Roman",serif">
<br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<o:p></o:p></pre>
<pre><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><o:p></o:p></pre>
<pre><a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman",serif"><br>
<br>
<o:p></o:p></span></p>
<pre>-- <o:p></o:p></pre>
<pre>Daniel-Constantin Mierla<o:p></o:p></pre>
<pre><a href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a><o:p></o:p></pre>
<pre>Book: SIP Routing With Kamailio - <a href="http://www.asipto.com">http://www.asipto.com</a><o:p></o:p></pre>
</div>
</body>
</html>