<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="monospace">Hi,<br>
      <br>
      So recap'ing the scenario here:<br>
      <br>
      When you get the initial incoming INVITE, you do not send out any
      branch. All the outbound branches are created via the t_inject,
      right ? So INVITE come in, nothing, then the REGISTER triggeres a
      new branch, and this new branch gets replied with 486. And you
      want to stop the waiting at this point, right ?<br>
      <br>
      Best regards,<br>
    </font>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Summit 27-30 Sept 2022, Athens
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2022Athens/">https://www.opensips.org/events/Summit-2022Athens/</a></pre>
    <div class="moz-cite-prefix">On 8/12/22 3:12 PM, Ярослав Нападайло
      via Users wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMf+eNzfZY9MDtu0p2iGL882DZNgqn57h5Wu23sVQjJTLY0vBA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>Hi everybody!<br>
                <br>
              </div>
              I'm writing script with Push Notification mechanism using
              TM module and t_wait_for_new_branches() function and EBR.<br>
            </div>
            <div>Here example in docs <br>
              <a
href="https://opensips.org/docs/modules/3.2.x/event_routing.html#idp5576704"
                moz-do-not-send="true">https://opensips.org/docs/modules/3.2.x/event_routing.html#idp5576704</a></div>
            <div><br>
            </div>
            My  is:<br>
            <br>
          </div>
          route {<br>
                ...<br>
        </div>
        <div>      t_newtran();</div>
        <div>      ....<br>
        </div>
        <div>      create_dialog();<br>
                ...<br>
        </div>
        <div>      t_on_reply("HANDLE_REPLY");<br>
        </div>
        <div>      t_wait_for_new_branches();<br>
                ....<br>
                notify_on_event("E_UL_CONTACT_INSERT", $avp(filter),
          "fork_call", $var(ttl));<br>
        </div>
        <div>}<br>
          <br>
          onreply_route[HANDLE_REPLY] {<br>
            xlog("L_DBG", "received reply $rs $rr");<br>
            switch($rs) {<br>
              case "486":<br>
                xlog("L_DBG", "wait no more branches DLG_DID=$DLG_did");<br>
                t_wait_no_more_branches();<br>
                t_cancel_branch("a");<br>
                break;<br>
              default:<br>
            }<br>
          }<br>
          <br>
          route[fork_call] {<br>
            xlog("L_DBG", "[$ci] user $avp(aor) registered a new contact
          $avp(uri), injecting");<br>
            t_inject_branches("event");<br>
          }<br>
          <br>
        </div>
        <div>First, I create dialog. Then, call
          t_wait_for_new_branches() and set notify_on_event() handler.<br>
        </div>
        <div>Then I'm waiting for new REGISTERs. When new contacts
          register to usrloc, I'm injecting received contacts as new
          branches to current transaction.<br>
        </div>
        <div>I do all things as described in docs.<br>
        </div>
        <div>Now I want to control negative replies from ongoing
          branches. By default, OS ignores negative replies and continue
          waiting for new branches. For example, I want to ignore 480,
          but handle 486.<br>
        </div>
        <div>I try handle 486, calling t_wait_no_more_branches().<br>
        </div>
        <div>I expect that OS will stop waiting for new branches and
          t_inject_branches  will not add anymore.<br>
        </div>
        <div>Also I expect that OS stop PHONY branch, which is created
          first when calling t_wait_for_new_branches(), and sends final
          response (486 in my case) to caller.<br>
        </div>
        <div>But in real next things happen:<br>
        </div>
        <div>1. t_wait_no_more_branches() doesn't affect adding new
          branches. If 1st callee reject call, then 2nd callee register
          new contact, t_inject_branches() adds new branch all the same<br>
        </div>
        <div>2. If no other branches added, caller hears ringing until
          FR_INV_TIMEOUT expires. And only when FR_INV_TIMEOUT expires,
          OS sends final response to caller.<br>
          <br>
        </div>
        <div>WIDW??<br>
          <br>
        </div>
        <div>How to stop transaction immeditially when at least one
          ongoing branch reply 486 code and to wait no more for any
          branches?<br>
        </div>
        <div>Thx for answers<br>
        </div>
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div><br>
                      -- <br>
                      <div dir="ltr" class="gmail_signature"
                        data-smartmail="gmail_signature">
                        <div>Regards,</div>
                        <div>Yaroslav Napadilo<br>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
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>
    <br>
  </body>
</html>