<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thank you all for the hints.<br>
    </p>
    <p>I ended up using a mix of dialplan to deal with the Local
      channels, and ARI to detect the transfer and redirect. It doesn't
      look like a "clean" solution but I have nothing better for the
      moment :<br>
    </p>
    <p>Dialplan :<br>
    </p>
    <p><tt>exten  =
100,1,GotoIf($[$["${SIPTRANSFER}"="yes"]&$["${CHANNEL(channeltype)}"="Local"]]?waittransfer:)</tt><tt><br>
      </tt><tt>; deal with channel being transfered</tt><tt><br>
      </tt><tt>same  = n,Transfer(100)</tt><tt><br>
      </tt><tt>same  = n,Hangup()</tt><tt><br>
      </tt><tt><br>
      </tt><tt>; deal with Asterisk-managed Local channel</tt><tt><br>
      </tt><tt>same = n(waittransfer),Wait(2)</tt><tt><br>
      </tt><tt>same  = n,Hangup()</tt></p>
    <p>NodeJS :</p>
    <p><tt>bridge.once('BridgeAttendedTransfer', event => {</tt><tt><br>
      </tt><tt>    var transferee = new
        ari.Channel(event.transferee.id);</tt><tt><br>
      </tt><tt>    transferee.continueInDialplan({</tt><tt><br>
      </tt><tt>          context: event.context,</tt><tt><br>
      </tt><tt>          extension: event.exten,</tt><tt><br>
      </tt><tt>          priority: 1</tt><tt><br>
      </tt><tt>    });</tt><tt><br>
      </tt><tt>});</tt><br>
    </p>
    <div class="moz-cite-prefix">Le 23/12/2020 à 19:46, Phil Mickelson a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAHVWxND5ZoqjAYPBiSx5wTcG5uLhztr-hqfcf_UDERkATxRvmw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Unfortunately, I suspect my situation is different
        from yours in that I control everything.  And, when Bob wants to
        transfer the call he clicks a button on the screen, not a button
        on the phone.  I don't use any part of the dialplan except to
        start ARI.
        <div><br>
        </div>
        <div>Sorry.</div>
        <div><br>
        </div>
        <div>Phil</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Dec 23, 2020 at 2:56
          AM Jean Aunis <<a href="mailto:jean.aunis@prescom.fr"
            moz-do-not-send="true">jean.aunis@prescom.fr</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <p>Thanks for the answer.</p>
            <p>Not sure I get the idea : when a SIP phone performs a
              blind-transfer, I have no control over what Asterisk does
              with the channels. During my tests, Bob's channel was
              automatically pulled out of the bridge, and replaced with
              a Local channel whose peer goes through the dialplan to
              the transfer destination.</p>
            <p>How can you link the newly created Local channel with
              Alice's one ?</p>
            <p>For the moment, I have a piece of solution with the
              BridgeBlindTransfer event, but I still have troubles with
              these Local channel issues.<br>
            </p>
            <div>Le 22/12/2020 à 20:13, Phil Mickelson a écrit :<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Not sure if this will help but what I do is
                fairly simple.  A couple of things:
                <div><br>
                </div>
                <div>1.  This is all written in JS using Node.js.</div>
                <div>2.  I use ari-client from npm.</div>
                <div><br>
                </div>
                <div>To me this is very simple.  You already have the
                  bridge and channel setup for Alice.  I create another
                  channel that dials Charlie.  And, as soon as the
                  create channel call comes back I just set the channel
                  id (was Bob) in the bridge to the new channel for
                  Charlie.  That's it.  If it doesn't get answered I
                  hope it goes to VM.  However, that's the downside of a
                  blind transfer.  I have some code in there for what
                  happens if Alice hangs up before Charlie answers, etc
                  but that's because I keep track of every call in my
                  system.</div>
                <div><br>
                </div>
                <div>And I wrote all of this before there were Promises
                  and Async/Await.  Hopefully next year I'll have the
                  time to rewrite the whole thing.</div>
                <div><br>
                </div>
                <div>And, for the people at Asterisk who came up with
                  the idea of ARI.  Thank you soooo much.  Hope everyone
                  has a wonderful holiday and that 2021 is much better
                  than 2020!</div>
                <div><br>
                </div>
                <div>Phil</div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Tue, Dec 22, 2020
                  at 5:38 AM Jean Aunis <<a
                    href="mailto:jean.aunis@prescom.fr" target="_blank"
                    moz-do-not-send="true">jean.aunis@prescom.fr</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">Hello,<br>
                  <br>
                  I'm struggling to find a way to properly handle blind
                  transfers with ARI.<br>
                  <br>
                  This is my use case :<br>
                  <br>
                  - Alice calls Bob through Asterisk<br>
                  <br>
                  - dialing and bridging is done with ARI<br>
                  <br>
                  - when Bob blind-transfers to Charlie, I would like to
                  use the <br>
                  "redirect" ARI operation, or the Transfer application<br>
                  <br>
                  But here is the issue : since the channels are
                  stasis-managed, <br>
                  transferring is done with Local channels which remain
                  in the path, so <br>
                  Transfer and redirect have no effect on them. And
                  Alice's channel is not <br>
                  aware that it is being transferred.<br>
                  <br>
                  Has somebody already dealt with this ?<br>
                  <br>
                  Regards,<br>
                  <br>
                  Jean<br>
                  <br>
                  <br>
                  _______________________________________________<br>
                  asterisk-app-dev mailing list<br>
                  <a href="mailto:asterisk-app-dev@lists.digium.com"
                    target="_blank" moz-do-not-send="true">asterisk-app-dev@lists.digium.com</a><br>
                  <a
                    href="http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev</a><br>
                </blockquote>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
asterisk-app-dev mailing list
<a href="mailto:asterisk-app-dev@lists.digium.com" target="_blank" moz-do-not-send="true">asterisk-app-dev@lists.digium.com</a>
<a href="http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev" target="_blank" moz-do-not-send="true">http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev</a>
</pre>
            </blockquote>
          </div>
          _______________________________________________<br>
          asterisk-app-dev mailing list<br>
          <a href="mailto:asterisk-app-dev@lists.digium.com"
            target="_blank" moz-do-not-send="true">asterisk-app-dev@lists.digium.com</a><br>
          <a
            href="http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev"
            rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
asterisk-app-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:asterisk-app-dev@lists.digium.com">asterisk-app-dev@lists.digium.com</a>
<a class="moz-txt-link-freetext" href="http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev">http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev</a>
</pre>
    </blockquote>
  </body>
</html>