<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi,</p>
    <p>I have to correct myself with regard to my two posts on Aug 21:</p>
    <ol style="margin: 0px 0px 1.4667em 30px; padding: 0px; border: 0px;
      font-style: normal; font-variant-ligatures: normal;
      font-variant-caps: normal; font-variant-numeric: inherit;
      font-variant-east-asian: inherit; font-weight: 400; font-stretch:
      inherit; line-height: inherit; font-family: Arial, "Helvetica
      Neue", Helvetica, sans-serif; font-size: 15px;
      vertical-align: baseline; list-style: decimal; box-sizing:
      inherit; color: rgb(36, 39, 41); letter-spacing: normal; orphans:
      2; text-align: left; text-indent: 0px; text-transform: none;
      white-space: normal; widows: 2; word-spacing: 0px;
      -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
      255); text-decoration-style: initial; text-decoration-color:
      initial;">
      <li style="margin: 0px 0px 0.7em; padding: 0px; border: 0px;
        font-style: inherit; font-variant: inherit; font-weight:
        inherit; font-stretch: inherit; line-height: inherit;
        font-family: inherit; font-size: 15px; vertical-align: baseline;
        box-sizing: inherit; overflow-wrap: break-word;">
        <p style="margin: 0px; padding: 0px; border: 0px; font-style:
          inherit; font-variant: inherit; font-weight: inherit;
          font-stretch: inherit; line-height: inherit; font-family:
          inherit; font-size: 15px; vertical-align: baseline;
          box-sizing: inherit; clear: both;">I was testing with my
          headset and had successful "pa looptest" indicating both indev
          & outdev were working</p>
      </li>
      <li style="margin: 0px 0px 0.7em; padding: 0px; border: 0px;
        font-style: inherit; font-variant: inherit; font-weight:
        inherit; font-stretch: inherit; line-height: inherit;
        font-family: inherit; font-size: 15px; vertical-align: baseline;
        box-sizing: inherit; overflow-wrap: break-word;">
        <p style="margin: 0px; padding: 0px; border: 0px; font-style:
          inherit; font-variant: inherit; font-weight: inherit;
          font-stretch: inherit; line-height: inherit; font-family:
          inherit; font-size: 15px; vertical-align: baseline;
          box-sizing: inherit; clear: both;">Then, when I tested that in
          the context of my application for auto-answering incoming
          calls (I called with my mobile phone while putting it in front
          of a tv so that I can test if I would hear anything on my
          headset), I didn't notice that in that case the mic was not
          working because I had the headset on my ears and was hearing
          the tv (because of successful looptest, I was just assuming
          that the mic would also be working)</p>
      </li>
      <li style="margin: 0px 0px 0.7em; padding: 0px; border: 0px;
        font-style: inherit; font-variant: inherit; font-weight:
        inherit; font-stretch: inherit; line-height: inherit;
        font-family: inherit; font-size: 15px; vertical-align: baseline;
        box-sizing: inherit; overflow-wrap: break-word;">
        <p style="margin: 0px; padding: 0px; border: 0px; font-style:
          inherit; font-variant: inherit; font-weight: inherit;
          font-stretch: inherit; line-height: inherit; font-family:
          inherit; font-size: 15px; vertical-align: baseline;
          box-sizing: inherit; clear: both;">But when I finally got a
          Plantronics Calisto 620-M Bluetooth Speakerphone, even the
          looptest failed. At this moment, I tested more carefully my
          headset again, and there I found out that the mic was not
          working.</p>
      </li>
      <li style="margin: 0px 0px 0.7em; padding: 0px; border: 0px;
        font-style: inherit; font-variant: inherit; font-weight:
        inherit; font-stretch: inherit; line-height: inherit;
        font-family: inherit; font-size: 15px; vertical-align: baseline;
        box-sizing: inherit; overflow-wrap: break-word;">
        <p style="margin: 0px; padding: 0px; border: 0px; font-style:
          inherit; font-variant: inherit; font-weight: inherit;
          font-stretch: inherit; line-height: inherit; font-family:
          inherit; font-size: 15px; vertical-align: baseline;
          box-sizing: inherit; clear: both;">Because it seemed that
          something device-specific should be the reason for failure, I
          also tested with my bluetooth earphones; there the effect was
          equivalent to Calisto speakerphone.</p>
      </li>
      <li style="margin: 0px; padding: 0px; border: 0px; font-style:
        inherit; font-variant: inherit; font-weight: inherit;
        font-stretch: inherit; line-height: inherit; font-family:
        inherit; font-size: 15px; vertical-align: baseline; box-sizing:
        inherit; overflow-wrap: break-word;">
        <p style="margin: 0px; padding: 0px; border: 0px; font-style:
          inherit; font-variant: inherit; font-weight: inherit;
          font-stretch: inherit; line-height: inherit; font-family:
          inherit; font-size: 15px; vertical-align: baseline;
          box-sizing: inherit; clear: both;">I finally got a USB
          speakerphone and tried that one, but in that case I was again
          back to earlier situation where "pa rescan" failed to find any
          devices...</p>
      </li>
    </ol>
    <p style="margin: 0px 0px 1.4667em; padding: 0px; border: 0px;
      font-style: normal; font-variant-ligatures: normal;
      font-variant-caps: normal; font-variant-numeric: inherit;
      font-variant-east-asian: inherit; font-weight: 400; font-stretch:
      inherit; line-height: inherit; font-family: Arial, "Helvetica
      Neue", Helvetica, sans-serif; font-size: 15px;
      vertical-align: baseline; box-sizing: inherit; clear: both; color:
      rgb(36, 39, 41); letter-spacing: normal; orphans: 2; text-align:
      left; text-indent: 0px; text-transform: none; white-space: normal;
      widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
      background-color: rgb(255, 255, 255); text-decoration-style:
      initial; text-decoration-color: initial;">With all four devices,
      always arecord and aplay were working perfectly, and the above
      issues appeared only with mod_portaudio.</p>
    <p style="margin: 0px 0px 1.4667em; padding: 0px; border: 0px;
      font-style: normal; font-variant-ligatures: normal;
      font-variant-caps: normal; font-variant-numeric: inherit;
      font-variant-east-asian: inherit; font-weight: 400; font-stretch:
      inherit; line-height: inherit; font-family: Arial, "Helvetica
      Neue", Helvetica, sans-serif; font-size: 15px;
      vertical-align: baseline; box-sizing: inherit; clear: both; color:
      rgb(36, 39, 41); letter-spacing: normal; orphans: 2; text-align:
      left; text-indent: 0px; text-transform: none; white-space: normal;
      widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
      background-color: rgb(255, 255, 255); text-decoration-style:
      initial; text-decoration-color: initial;">I don't have any idea
      what the issue could be with the usb, but with the three bluetooth
      devices, I still believe that something device-specific should be
      causing the problems here, e.g. the sample rate. But, currently I
      am lacking time to further work on this...</p>
    <p style="margin: 0px 0px 1.4667em; padding: 0px; border: 0px;
      font-style: normal; font-variant-ligatures: normal;
      font-variant-caps: normal; font-variant-numeric: inherit;
      font-variant-east-asian: inherit; font-weight: 400; font-stretch:
      inherit; line-height: inherit; font-family: Arial, "Helvetica
      Neue", Helvetica, sans-serif; font-size: 15px;
      vertical-align: baseline; box-sizing: inherit; clear: both; color:
      rgb(36, 39, 41); letter-spacing: normal; orphans: 2; text-align:
      left; text-indent: 0px; text-transform: none; white-space: normal;
      widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
      background-color: rgb(255, 255, 255); text-decoration-style:
      initial; text-decoration-color: initial;">KR,</p>
    <p style="margin: 0px 0px 1.4667em; padding: 0px; border: 0px;
      font-style: normal; font-variant-ligatures: normal;
      font-variant-caps: normal; font-variant-numeric: inherit;
      font-variant-east-asian: inherit; font-weight: 400; font-stretch:
      inherit; line-height: inherit; font-family: Arial, "Helvetica
      Neue", Helvetica, sans-serif; font-size: 15px;
      vertical-align: baseline; box-sizing: inherit; clear: both; color:
      rgb(36, 39, 41); letter-spacing: normal; orphans: 2; text-align:
      left; text-indent: 0px; text-transform: none; white-space: normal;
      widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
      background-color: rgb(255, 255, 255); text-decoration-style:
      initial; text-decoration-color: initial;">-- Saied<br>
      <br>
    </p>
    <div class="moz-cite-prefix">Tazari, Mohammad Reza wrote on
      21-Aug-20 18:44:<br>
    </div>
    <blockquote type="cite"
      cite="mid:175ee000-d1d7-1eac-7032-da1c1cd6f547@gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="moz-cite-prefix">Tazari, Saied wrote on 21-Aug-20
        03:37:<br>
      </div>
      <blockquote type="cite"
        cite="mid:a0246a22-5d68-5da6-2825-d32ceafd7987@gmail.com">
        <ol start="6">
          <li>
            <meta http-equiv="Content-Type" content="text/html;
              charset=UTF-8">
            <tt><tt><font color="#009959"><font color="#003300"><tt><tt><font
                          color="#009959"><font color="#003300"><font
                              face="Calibri">Created a new file by </font></font></font></tt></tt></font></font></tt></tt><tt><tt><font
                  color="#009959"><font color="#003300"><tt><tt><font
                          color="#009959"><font color="#003300"><font
                              face="Calibri"><u><tt><b><font size="+1"><tt>sudo
                                        vi /etc/asound.conf</tt></font></b></tt></u>
                              and added the following as its sole
                              content (if you know the MAC address of
                              your Bluetooth device, substitute it
                              already now; otherwise you can change it
                              also later in step 9):</font></font></font></tt></tt></font></font></tt></tt></li>
        </ol>
      </blockquote>
      <br>
      <p><tt><font face="Calibri">This was a very important reason why
            "pa rescan " had failed for me previously: I had defined the
            devices in the .asoundrc of the user pi, but freeswitch was
            running with the user "freeswitch" who has no login shell
            and hence cannot have any .asoundrc --> device
            configuration had to go to a user-independent level.</font></tt></p>
      <p><tt><font face="Calibri">The suggested content for this file
            tried to get a better output quality by making use of the
            "a2dp" profile whereas for the mic you have to use the "sco"
            profile. However, in this combination pa is eventually
            working in a pretty unstable way. Therefore, we can simplify
            the content the following way:</font></tt></p>
      <blockquote>
        <p><tt>pcm.btAudioIO {<br>
                    type plug<br>
                    slave.pcm {<br>
                            type bluealsa<br>
                            service "org.bluealsa"<br>
                            device "00:11:09:94:14:3D"<br>
                            profile "sco"<br>
                            delay 10000<br>
                    }<br>
                    hint {<br>
                            show on<br>
                            description "Bluetooth Audio Input/Output
            Dvice"<br>
                    }<br>
            }<br>
            <br>
            ctl.btAudioIO {<br>
                    type bluealsa<br>
                    service "org.bluealsa"<br>
                    battery yes<br>
            }<br>
          </tt></p>
      </blockquote>
      <blockquote type="cite"
        cite="mid:a0246a22-5d68-5da6-2825-d32ceafd7987@gmail.com">
        <ol start="10">
          <li><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font
                          color="#009959"><font color="#003300"><font
                              face="Calibri">Test your device with the
                              following two commands (five seconds
                              recording):<br>
                            </font></font></font></tt></tt></font></font><font
                  color="#009959"><font color="#003300"><tt><tt><font
                          color="#009959"><font color="#003300"><b><font
                                size="+1">arecord -D btAudioIO -d 5
                                test.wav<br>
                                aplay </font></b></font></font></tt></tt></font></font></tt></tt><tt><tt><font
                  color="#009959"><font color="#003300"><tt><tt><font
                          color="#009959"><font color="#003300"><b><font
                                size="+1"><tt><tt><font color="#009959"><font
                                        color="#003300"><tt><tt><font
                                              color="#009959"><font
                                                color="#003300"><b><font
                                                    size="+1">-D
                                                    btAudioIO test.wav<br>
                                                  </font></b></font></font></tt></tt></font></font></tt></tt></font></b></font></font></tt></tt></font></font></tt></tt></li>
        </ol>
      </blockquote>
      <p><font face="Calibri"><tt><font size="+1"><br>
              You may also perform a loop test:</font></tt></font></p>
      <blockquote>
        <p><tt><font size="+1"><b>arecord -D btAudioIO | aplay -D
                btAudioIO</b></font></tt><br>
        </p>
      </blockquote>
      <blockquote type="cite"
        cite="mid:a0246a22-5d68-5da6-2825-d32ceafd7987@gmail.com">
        <ol start="10">
        </ol>
        <p>After a reboot, after which also FreeSwitch and my
          application start, everything was working for me just fine :-)<br>
        </p>
      </blockquote>
      <br>
      <p>I forgot to say that you can test the working of the setup in
        fs_cli the following way:</p>
      <ol>
        <li>"<b><font size="+1"><tt>pa devlist</tt></font></b>" should
          generate an output like "<b><font size="+1"><tt>0;btAudioIO(ALSA);128;128;r,i,o</tt></font></b>"</li>
        <li>Like the test at the level of shell, the actual test can be
          the loop test: "<b><font size="+1"><tt>pa looptest</tt></font></b>"</li>
      </ol>
      <p><br>
        KR,</p>
      <p><br>
        -- Saied</p>
      <p><br>
      </p>
    </blockquote>
  </body>
</html>