<div><div>Hi Razvan, this is the code from SER 2.0. There is no equivalent for "s:digest_challenge" or "s:contact" AVPs as far as I can tell looking to the code in question in OpenSIPS.</div></div><div><br></div><div>-Max</div><div><br><div class="gmail_quote"><div>On Mon, Feb 20, 2017 at 12:25 AM Răzvan Crainea <<a href="mailto:razvan@opensips.org">razvan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
    <tt class="gmail_msg">Hi, Maxim!<br class="gmail_msg">
      <br class="gmail_msg">
      The code you are using now should do what you request. t_newtran()
      returns 0 for retransmissions, therefore for the second message
      (retransmission) that will run the script, t_newtran() will
      immediately absorb the message and return without executing any
      further instructions.<br class="gmail_msg">
      <br class="gmail_msg">
      Best regards,<br class="gmail_msg">
    </tt>
    <pre class="m_7848483611393678603moz-signature gmail_msg" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="m_7848483611393678603moz-txt-link-abbreviated gmail_msg" href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre></div><div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
    <div class="m_7848483611393678603moz-cite-prefix gmail_msg">On 02/17/2017 09:15 PM, Maxim Sobolev
      wrote:<br class="gmail_msg">
    </div>
    <blockquote type="cite" class="gmail_msg">
      <div class="gmail_msg">P.S. <span style="font-size:12.8px" class="gmail_msg">python_exec("www_</span><span style="font-size:12.8px" class="gmail_msg">authenticate")
          does not do any magic here, it's just figures out the right
          domain to use based on some business rules and then calls
          www_authenticate() with that parameter.</span></div>
      <div class="gmail_extra gmail_msg"><br class="gmail_msg">
        <div class="gmail_quote gmail_msg">On Fri, Feb 17, 2017 at 11:12 AM, Maxim
          Sobolev <span class="gmail_msg"><<a href="mailto:sobomax@sippysoft.com" class="gmail_msg" target="_blank">sobomax@sippysoft.com</a>></span>
          wrote:<br class="gmail_msg">
          <blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div class="gmail_msg">
              <div class="m_7848483611393678603m_6911824313400074143gmail_signature gmail_msg">
                <div class="gmail_msg">Hi guys,</div>
                <div class="gmail_msg"><br class="gmail_msg">
                </div>
                <div class="gmail_msg">We are underway to migrate from ancient SER-2.0.0
                  to more modern OpenSIPS and one of the question that
                  is still in my TODO list is implementing transactional
                  processing of the REGISTER requests. In the old SER we
                  had something along those lines:</div>
                <div class="gmail_msg"><br class="gmail_msg">
                </div>
                <div class="gmail_msg">
                  <div class="gmail_msg">route[3] {</div>
                  <div class="gmail_msg">        # Ensure that all incoming messages
                    contain auth info</div>
                  <div class="gmail_msg">        xlog("L_INFO", "processing %rm received
                    from %si:%sp");</div>
                  <div class="gmail_msg">        if (!t_newtran()) {</div>
                  <div class="gmail_msg">                sl_send_reply("500", "could not
                    create transaction");</div>
                  <div class="gmail_msg">                break;</div>
                  <div class="gmail_msg">        };</div>
                  <div class="gmail_msg">        if (!python_exec("www_authenticate"))
                    {</div>
                  <div class="gmail_msg">                xlog("L_INFO", "challenging
                    %ct");</div>
                  <div class="gmail_msg">                if (is_avp_set("s:digest_challenge"))
                    {</div>
                  <div class="gmail_msg">                       
                    append_to_reply("%$digest_challenge");</div>
                  <div class="gmail_msg">                };</div>
                  <div class="gmail_msg">                t_reply("401", "Unauthorized");</div>
                  <div class="gmail_msg">                break;</div>
                  <div class="gmail_msg">        };</div>
                  <div class="gmail_msg">       [....some more unrelated processing and
                    checks...]</div>
                  <div class="gmail_msg">        xlog("L_INFO", "saving contact %ct into
                    the database");<br class="gmail_msg">
                  </div>
                  <div class="gmail_msg">        save_noreply("location");</div>
                  <div class="gmail_msg">        if (is_avp_set("s:contact")) {</div>
                  <div class="gmail_msg">                append_to_reply("%$contact");</div>
                  <div class="gmail_msg">        };</div>
                  <div class="gmail_msg">        t_reply("$code", "$reason");</div>
                  <div class="gmail_msg">}</div>
                </div>
                <div class="gmail_msg"><br class="gmail_msg">
                </div>
                <div class="gmail_msg">The idea here is to avoid possibly costly DB lookup
                  and other checks on each possible re-transmit. What
                  would be the proper way of doing this with the
                  OpenSIPS 2.1? Or if it's not possible to replicate
                  such scheme, what would be the best way to implement
                  this which to get the change accepted into the
                  OpenSIPS mainline?</div>
                <div class="gmail_msg"><br class="gmail_msg">
                </div>
                <div class="gmail_msg">Any ideas, pointers, hints are greatly appreciated.
                  Thanks in advance!</div>
                <span class="m_7848483611393678603HOEnZb gmail_msg"><font color="#888888" class="gmail_msg">
                    <div class="gmail_msg"><br class="gmail_msg">
                    </div>
                    <div class="gmail_msg">-Maxim</div>
                  </font></span></div>
            </div>
          </blockquote>
        </div>
        <br class="gmail_msg">
        <br clear="all" class="gmail_msg">
        <div class="gmail_msg"><br class="gmail_msg">
        </div>
        -- <br class="gmail_msg">
        <div class="m_7848483611393678603gmail_signature gmail_msg" data-smartmail="gmail_signature">
          <div class="gmail_msg">Maksym Sobolyev<br class="gmail_msg">
            Sippy Software, Inc.<br class="gmail_msg">
            Internet Telephony (VoIP) Experts<br class="gmail_msg">
            Tel (Canada): +1-778-783-0474<br class="gmail_msg">
            Tel (Toll-Free): +1-855-747-7779<br class="gmail_msg">
            Fax: +1-866-857-6942<br class="gmail_msg">
            Web: <a href="http://www.sippysoft.com" class="gmail_msg" target="_blank">http://www.sippysoft.com</a><br class="gmail_msg">
            MSN: <a href="mailto:sales@sippysoft.com" class="gmail_msg" target="_blank">sales@sippysoft.com</a><br class="gmail_msg">
            Skype: SippySoft<br class="gmail_msg">
          </div>
        </div>
      </div>
    </blockquote>
    <br class="gmail_msg">
  </div></blockquote></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Maksym Sobolyev<br>Sippy Software, Inc.<br>Internet Telephony (VoIP) Experts<br>Tel (Canada): +1-778-783-0474<br>Tel (Toll-Free): +1-855-747-7779<br>Fax: +1-866-857-6942<br>Web: <a href="http://www.sippysoft.com" target="_blank">http://www.sippysoft.com</a><br>MSN: <a href="mailto:sales@sippysoft.com" target="_blank">sales@sippysoft.com</a><br>Skype: SippySoft<br></div></div>