<!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 text="#000000" bgcolor="#ffffff">
    Hi Bobby,<br>
    <br>
    The $DLG_flags or a $dlg_var(name) are the pseudo variables that
    should help you. In order to use them, you must use create_dialog()
    [1] for the Initial INVITE.<br>
    In the sequential requests, you should read the values only after
    loose_route() [2] is called, because there's where the dialog is
    matched.<br>
    Please try again and let us know your results.<br>
    <br>
    [1] <a
href="http://www.opensips.org/html/docs/modules/devel/dialog.html#id293854">http://www.opensips.org/html/docs/modules/devel/dialog.html#id293854</a><br>
    [2]
    <a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/devel/rr.html#loose-route-id">http://www.opensips.org/html/docs/modules/devel/rr.html#loose-route-id</a><br>
    <br>
    Regards,<br>
    <pre class="moz-signature" cols="72">Razvan Crainea
OpenSIPS Developer</pre>
    <br>
    On 05.08.2011 07:14, Bobby Smith wrote:
    <blockquote
cite="mid:CAJQeEgtoE__7HOoZEhUKdC0g9XQ-5LZLBtGSszBfN1S+nYPfRg@mail.gmail.com"
      type="cite">Thanks for the suggestion -- unfortunately I saw this
      previously in a thread and thought that'd be the key, but the
      results from cranking debug up the same show it to be a different
      transaction on receiving the ACK and thus the value is null. :(
      <div>
        <br>
      </div>
      <div>I've played around with this just a little bit more and by
        modifying the localcache key to be $fU_$ci (from user / callid
        pair, or some tag, or something related to the initial request
        that's available in the script context) I can get it to work how
        I want, but this really just doesn't seem like the right way to
        do it.</div>
      <div><br>
      </div>
      <div><br>
        <div class="gmail_quote">On Fri, Aug 5, 2011 at 12:08 AM, Brett
          Nemeroff <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:brett@nemeroff.com">brett@nemeroff.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <div bgcolor="#FFFFFF">
              <div>See if setting this param on helps.</div>
              <div><br>
                <a moz-do-not-send="true"
                  href="http://www.opensips.org/html/docs/modules/devel/tm.html#id293118"
                  target="_blank">http://www.opensips.org/html/docs/modules/devel/tm.html#id293118</a><br>
                -Brett</div>
              <div>
                <div class="h5">
                  <div><br>
                    On Aug 4, 2011, at 7:48 PM, Bobby Smith &lt;<a
                      moz-do-not-send="true"
                      href="mailto:bobby.smith@gmail.com"
                      target="_blank">bobby.smith@gmail.com</a>&gt;
                    wrote:<br>
                    <br>
                  </div>
                  <blockquote type="cite">
                    <div>All,
                      <div><br>
                        Here's why I'm trying to accomplish:</div>
                      <div><br>
                      </div>
                      <div>route [subsequent_request] {</div>
                      <div>&nbsp; &nbsp;if (has_totag &amp;&amp; is_method("ACK")
                        {</div>
                      <div>&nbsp; &nbsp; &nbsp;if (MY_VAR = "cisco") {</div>
                      <div>&nbsp; &nbsp; &nbsp; &nbsp; lookup("location");</div>
                      <div>&nbsp; &nbsp; &nbsp; &nbsp; ... relay and exit</div>
                      <div>&nbsp; &nbsp; &nbsp;}</div>
                      <div>&nbsp; &nbsp; &nbsp;else {</div>
                      <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ... relay and exit lr</div>
                      <div>&nbsp; &nbsp; &nbsp;}</div>
                      <div>&nbsp; &nbsp;}</div>
                      <div>}</div>
                      <div><br>
                      </div>
                      <div>onreply_route [foo] {</div>
                      <div>&nbsp; &nbsp; &nbsp;....</div>
                      <div>&nbsp; &nbsp; &nbsp;if($ua =~ "Cisco-CP79") {</div>
                      <div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MY_VAR = "cisco"</div>
                      <div>&nbsp; &nbsp; &nbsp;}</div>
                      <div>}</div>
                      <div><br>
                      </div>
                      <div>The reasons are not really relevant (it's to
                        get rid of a really poor UA implementation on
                        older Cisco 79XX firmwares), but my intent is:</div>
                      <div><br>
                      </div>
                      <div>1) Set a transaction-visible-only value in
                        onreply_route [foo] &nbsp;</div>
                      <div>2) Retrieve it on the ACK that completes the
                        initial invite transaction.</div>
                      <div><br>
                        My problems:</div>
                      <div><br>
                      </div>
                      <div>
                        1) if MY_VAR is an $avp, it returns null on
                        retrieving it in the route[subsequent_request],
                        even with the onreply flag for tm set.</div>
                      <div>2) if MY_VAR is a $var, it's process global
                        and so, the next transaction that comes in could
                        share the same state (race)</div>
                      <div>3) if MY_VAR is a flag, I can't retrieve it
                        in the route [subsequent request]</div>
                      <div>4) if MY_VAR is a dlg_flag or a dlg_var, I
                        can't retrieve it in the subsequent request even
                        if invoking create_dialog as the first action in
                        the routing script (if it's an initial invite).</div>
                      <div>5) The only thing I've been able to do is
                        create a unique key via localcache (with
                        $fU_useragent = myvalue) and fetch it, but this
                        does not allow multiple UA's to register with
                        the same fU</div>
                      <div><br>
                      </div>
                      <div>My question is, is there any way to set a
                        transaction state only value in an onreply hook,
                        and retrieve it on the ACK?<br>
                        <br>
                        I know according to the RFC:</div>
                      <div><br>
                      </div>
                      <div><span style="font-family: 'Times New Roman';">
                          <pre style="font-size: medium;">      The reason for this separation is rooted in the <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-importance.html" name="1319820bcee901dd_d4e475468" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">importance</a> of
      delivering all 200 (OK) responses to an <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-invite.html" name="1319820bcee901dd_d4e475473" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">INVITE</a> to the <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-uac.html" name="1319820bcee901dd_d4e475476" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">UAC</a>.  To
      deliver them all to the <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-uac.html" name="1319820bcee901dd_d4e475481" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">UAC</a>, the <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-uas.html" name="1319820bcee901dd_d4e475485" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">UAS</a> alone takes responsibility

      for retransmitting them (see Section 13.3.1.4), and the <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-uac.html" name="1319820bcee901dd_d4e475492" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">UAC</a> alone
      takes responsibility for acknowledging them with <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-ack.html" name="1319820bcee901dd_d4e475497" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">ACK</a> (see Section
      13.2.2.4).  Since this <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-ack.html" name="1319820bcee901dd_d4e475503" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">ACK</a> is retransmitted only by the <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-uac.html" name="1319820bcee901dd_d4e475506" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">UAC</a>, it is
      effectively considered its own <a moz-do-not-send="true" href="http://rfc-ref.org/RFC-TEXTS/3261/kw-transaction.html" name="1319820bcee901dd_d4e475511" style="font-family: tahoma,verdana,sans-serif; font-weight: normal;" target="_blank">transaction</a>.
</pre>
                        </span>
                        <div style="font-size: medium; font-family:
                          'Times New Roman';"><br>
                        </div>
                        <div style="font-size: medium; font-family:
                          'Times New Roman';"><br>
                        </div>
                        <div style="font-family: 'Times New Roman';">
                          Is there a way to get this associated with the
                          right dialog or something? &nbsp;I've tried setting
                          a dialog profile on initial invite, storing a
                          value in the 200 OK onreply, and retrieving it
                          as well in the ACK, but I get no dialog has
                          been created (I guess because the dialog is
                          early or something).</div>
                        <span style="font-family: 'Times New Roman';">
                        </span>
                        <div style="font-family: 'Times New Roman';"><br>
                        </div>
                        <div style="font-family: 'Times New Roman';"><br>
                          Thanks for the ideas,</div>
                        <div style="font-family: 'Times New Roman';"><br>
                          BobbyS</div>
                      </div>
                    </div>
                  </blockquote>
                </div>
              </div>
              <blockquote type="cite">
                <div><span>_______________________________________________</span><br>
                  <span>Users mailing list</span><br>
                  <span><a moz-do-not-send="true"
                      href="mailto:Users@lists.opensips.org"
                      target="_blank">Users@lists.opensips.org</a></span><br>
                  <span><a moz-do-not-send="true"
                      href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                      target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a></span><br>
                </div>
              </blockquote>
            </div>
            <br>
            _______________________________________________<br>
            Users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
              target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </body>
</html>