<div dir="ltr">Saied,<div>You are a very determined man!  I followed your instructions and yes, this works when I run it from the command line as root.  Again, when launched by systemd I come up with no reply when I run pa devlist in fs_cli.</div><div><br></div><div>When free time is more plentiful, I will investigate trying to run this as a different user.  I think I just need to be in the proper group.  I will also need to adapt this to use the 3.5mm output of the pi. Where do you see the device names, in the alsa mixer?<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">---------- Forwarded message ---------<br>From: <strong class="gmail_sendername" dir="auto">Tazari, Mohammad Reza</strong> <span dir="auto"><<a href="mailto:saied.tazari@gmail.com" target="_blank">saied.tazari@gmail.com</a>></span><br>Date: Wed, Aug 26, 2020 at 11:01 AM<br>Subject: Re: [Freeswitch-users] mod_portaudio on Raspberry Pi currently broken?<br>To:  <<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>><br></div><br><br>
  
    
  
  <div>
    <p>Tom, other interested people,<br>
    </p>
    <p>I finally got it working on a raspberry pi-4 with buster lite,
      mostly thanks to the following articles:</p>
    <blockquote>
      <p><a href="https://sigmdel.ca/michel/ha/rpi/bluetooth_01_en.html" target="_blank">https://sigmdel.ca/michel/ha/rpi/bluetooth_01_en.html</a><br>
        <a href="https://sigmdel.ca/michel/ha/rpi/bluetooth_02_en.html" target="_blank">https://sigmdel.ca/michel/ha/rpi/bluetooth_02_en.html</a><br>
        <a href="https://sigmdel.ca/michel/ha/rpi/bluetooth_n_buster_01_en.html" target="_blank">https://sigmdel.ca/michel/ha/rpi/bluetooth_n_buster_01_en.html</a><br>
      </p>
    </blockquote>
    <p><br>
      The exact reproducible  steps have been:</p>
    <ol>
      <li>Started on the basis of<br>
        <img src="cid:174673e20c1e16858721" alt="" width="249" height="138"><br>
        <br>
        + my FreeSwitch installation based on instructions under <a href="https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi" target="_blank">https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi<br>
          <br>
        </a></li>
      <li><b><font size="+1"><tt><u>sudo apt-get update  && 
                sudo apt-get install -y bluealsa</u><br>
              <br>
            </tt></font></b></li>
      <li><u><b><font size="+1"><tt>sudo vi
                /lib/systemd/system/bluealsa.service</tt></font></b></u><br>
        --> substituted <strike><font size="+1" color="#e80074"><tt>ExecStart=/usr/bin/bluealsa</tt></font></strike>
        with<br>
        --><font size="-2">  </font><tt><font size="+1" color="#009959">Environment=LIBASOUND_THREAD_SAFE=0<br>
               ExecStart=/usr/bin/bluealsa -p hfp-hf -p hsp-hs -p hfp-ag
            -p hsp-ag -p a2dp-source -p a2dp-sink</font><br>
          <br>
        </tt></li>
      <li><tt><u><b><font size="+1"><tt>sudo vi
                  /lib/systemd/system/bluetooth.service</tt></font></b></u><br>
          <font face="Calibri">--> Added</font><font size="+1"> <font color="#009959">--noplugin=sap</font></font></tt><tt><font size="+1"><font color="#009959"> </font></font><font color="#009959"><font face="Calibri" color="#003300">to the
              end of the following line</font></font><tt><font size="+1" color="#009959"><br>
                 <font color="#003300">ExecStart=/usr/lib/bluetooth/bluetoothd<br>
                <br>
              </font></font></tt></tt></li>
      <li><tt><tt><font size="+1" color="#009959"><font color="#003300"><tt><u><b><font size="+1"><tt>sudo vi
                          /lib/systemd/system/bthelper@.service</tt></font></b></u><br>
                </tt></font></font><font color="#009959"><font color="#003300"><tt><font face="Calibri">--> </font></tt></font></font><font color="#009959"><font color="#003300"><tt><font face="Calibri">Added</font></tt></font></font><font size="+1" color="#009959"><font color="#003300"><tt><font size="+1"> <font color="#009959">ExecStartPre=/bin/sleep
                      2</font></font></tt><tt><font size="+1"><font color="#009959"> </font></font></tt></font></font><font color="#009959"><font color="#003300"><tt><font color="#009959"><font face="Calibri" color="#003300">in
                      a new line after</font></font></tt></font></font><font size="+1" color="#009959"><font color="#003300"><tt><tt><font size="+1" color="#009959"><br>
                         <font color="#003300">Type=simple<br>
                        <br>
                      </font></font></tt></tt></font></font></tt></tt></li>
      <li><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):<br>
                        </font></font></font></tt></tt></font></font><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font size="+1">pcm.btAudioIO {<br>
                                  type asym<br>
                                  playback.pcm {<br>
                                          type plug<br>
                                          slave.pcm {<br>
                                                  type bluealsa<br>
                                                  service "org.bluealsa"<br>
                                                  device
                          "00:11:09:94:14:3D"<br>
                                                  profile "a2dp"<br>
                                                  delay 10000<br>
                                          }<br>
                                  }<br>
                                  capture.pcm {<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>
                                  }<br>
                                  hint {<br>
                                          show on<br>
                                          description "Bluetooth Audio
                          Input/Output Dvice"<br>
                                  }<br>
                          }<br>
                        </font></font></font></tt></tt></font></font><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"><br>
                        </font></font></font></tt></tt></font></font></tt></tt></li>
      <li><b><font size="+1"><tt>sudo adduser freeswitch audio<br>
              sudo adduser </tt></font></b><b><font size="+1"><tt><b><font size="+1"><tt>freeswitch </tt></font></b>bluetooth<br>
              sudo reboot<br>
            </tt></font></b><br>
      </li>
      <li><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri">After reboot, run </font></font></font></tt></tt></font></font><u><b><font size="+1" color="#009959"><font color="#003300"><font color="#009959"><font color="#003300">sudo
                        bluetoothctl</font></font></font></font></b></u><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"> and then find, pair, connect
                          and trust your Bluetooth device with the
                          following control commands of this program:<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">agent on<br>
                            scan on</font></b></font></font></tt></tt></font></font></tt></tt><br>
        <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">        </font></b></font></font></tt></tt></font></font></tt></tt></font></b><font size="+1" color="#804040"><tt><tt><tt><tt><font size="+1"><-- find the MAC
                                    address of your device in the scan
                                    outputs</font></tt></tt></tt></tt></font><b><font size="+1"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><b><font size="+1"><br>
                                              </font></b></font></font></tt></tt></font></font></tt></tt>pair
                            50:11:2D:06:ED:2F<br>
                          </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"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><b><font size="+1">scan off<br>
                                                          </font></b></font></font></tt></tt></font></font></tt></tt></font></b></font></font></tt></tt></font></font></tt></tt></font></b></font></font></tt></tt></font></font></tt></tt><b>connect
                            50:11:2D:06:ED:2F<br>
                            trust 50:11:2D:06:ED:2F<br>
                            exit<br>
                          </b><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri">--> from now on, your device
                                                          should
                                                          automatically
                                                          reconnect to
                                                          the pi each
                                                          time after the
                                                          pi is
                                                          rebooted; if,
                                                          however, this
                                                          is not the
                                                          case, you will
                                                          have to redo
                                                          this step
                                                          after each
                                                          reboot.<br>
                                                          </font></font></font></tt></tt></font></font></tt></tt></font></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font></font><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><br>
                      </font></font></tt></tt></font></font><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"></font></font></font></tt></tt></font></font></tt></tt></li>
      <li><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri">In this example, the device
                          that I have paired and trusted has a different
                          MAC address as the one in /etc/asound.conf;
                          therefore we must edit the file and set the
                          right MAC address. If you already had the
                          right MAC address, you may go to the next step
                          without reboot; but, if you had to change the
                          file /etc/asound.conf, then you will have to
                          reboot before going to the next step.<br>
                          <br>
                        </font></font></font></tt></tt></font></font></tt></tt></li>
      <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><br>
                      </font></font></tt></tt></font></font><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"></font></font></font></tt></tt></font></font></tt></tt></li>
      <li><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri">Assuming that the above test is
                          successful, you now <br>
                          - edit <font size="-1"><FreeSwitch-Config-Home></font>/autoload_configs/modules.conf.xml
                          and un-comment the loading of mod_portaudio<br>
                          - edit </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"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"><font size="-1"><FreeSwitch-Config-Home></font>/autoload_configs/portaudio.conf.xml
                                            and substitute the whole
                                            content with the following
                                            new content:<br>
                                          </font></font></font></tt></tt></font></font></tt></tt></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"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font size="+1"><configuration
                                          name="portaudio.conf"
                                          description="Soundcard
                                          Endpoint"><br>
                                            <settings><br>
                                              <param name="indev"
                                          value="btAudioIO"/><br>
                                              <param name="outdev"
                                          value="btAudioIO"/><br>
                                              <param name="ringdev"
                                          value="btAudioIO"/><br>
                                              <param name="hold-file"
                                          value="$${hold_music}"/><br>
                                              <param name="dialplan"
                                          value="XML"/><br>
                                              <param name="cid-name"
value="$${outbound_caller_name}"/><br>
                                              <param name="cid-num"
                                          value="$${outbound_caller_id}"/><br>
                                              <param
                                          name="sample-rate"
                                          value="48000"/><br>
                                              <param name="codec-ms"
                                          value="20"/><br>
                                            </settings><br>
                                          </configuration></font></font></font></tt></tt></font></font></tt></tt><font face="Calibri"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri">c<br>
                                          </font></font></font></tt></tt></font></font></tt></tt></font></font><font color="#003300"></font></font><font color="#009959"></font></tt><tt></tt></tt><tt></tt></font><font color="#003300"></font></font><font color="#009959"></font></tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font size="+1"></font><br>
                                      </font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font></font><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"></font></font></font></tt></tt></font></font></tt></tt></font></font></font></tt></tt></font></font></tt></tt><tt></tt></li>
      <li><font face="Calibri"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri">In my case, I
                                            didn't need to do anything
                                            for dial plans because in my
                                            system both the in- and
                                            outbound calls are first
                                            handled by my python
                                            scripts; in particular, the
                                            BT handsfree device </font></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font><font face="Calibri"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri">is never
                                            supposed to make calls but
                                            is called for making
                                            announcements or invited to
                                            a running call </font></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font><font face="Calibri"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"><tt><font face="Calibri">as the
                                                third leg. So far, I was
                                                using an IP telephone
                                                with auto-answering
                                                capability as extension
                                                000 of my FreeSwitch for
                                                this purpose. To
                                                substitute that phone
                                                with the BT handsfree
                                                device, I just needed to
                                                update my related python
                                                script with the
                                                following command:<br>
                                              </font></tt></font></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><b><font size="+1">sudo sed -i
                                              's#user/000@[0-9.]+#portaudio/auto_answer#g'
                                              dial.py</font></b><br>
                                        </tt></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt><font face="Calibri"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font face="Calibri"><tt><font face="Calibri"></font></tt></font></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font><font face="Calibri"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><tt><tt><font color="#009959"><font color="#003300"><font size="+1"><br>
                                          </font></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font></font></tt></tt></font></li>
    </ol>
    <p>After a reboot, after which also FreeSwitch and my application
      start, everything was working for me just fine :-)</p>
    <p>Cheers,</p>
    <p>-- Saied</p>
    <p><br>
    </p>
    <fieldset><legend>ForwardedMessage.eml</legend></fieldset>
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
      <tbody>
        <tr>
          <td>
            <div style="display:inline">Subject:
            </div>
            Re: [Freeswitch-users] mod_portaudio on Raspberry Pi
            currently broken?</td>
        </tr>
        <tr>
          <td>
            <div style="display:inline">From:
            </div>
            Tom Lynn <a href="mailto:tom@tomlynn.com" target="_blank"><tom@tomlynn.com></a></td>
        </tr>
        <tr>
          <td>
            <div style="display:inline">Date:
            </div>
            27-Jul-20, 07:56</td>
        </tr>
      </tbody>
    </table>
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
      <tbody>
        <tr>
          <td>
            <div style="display:inline">To: </div>
            FreeSWITCH Users Help
            <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank"><freeswitch-users@lists.freeswitch.org></a></td>
        </tr>
      </tbody>
    </table>
    <br>
    <div dir="ltr">I'm in the same boat with portaudio when it's started
      with systemd.  When I disable it as a service and start it from
      the command line, pa devlist does return a list of devices.  Still
      workingon getting a call from portaudio to a station and vice
      versa.  Calling a station from portaudio device goes to voicemail
      and in reverse direction I never get a ring indication, just music
      on hold.</div>
    <br>
    <div dir="ltr" class="gmail_attr">On Tue, Jun 30, 2020 at 8:21 PM
      saiedt <<a href="mailto:saied.tazari@gmail.com" target="_blank">saied.tazari@gmail.com</a>>
      wrote:<br>
    </div>
    Lesley Pervis wrote<br>
    > Sorry for the spam, but I thought I'd mention that I can aplay
    no problem<br>
    > from the command line as the 'freeswitch' user, and yet when FS
    is running<br>
    > as that user, no luck.<br>
    <br>
    Exactly seven years after your last post here, I'm there to ask if
    you<br>
    finally succeeded to resolve the issue?<br>
    My case:<br>
    <br>
    1. Pi-4 with Raspbian buster und latest related FreeSwitch
    distribution,<br>
    apt-upgraded and updated just yesterday<br>
    <br>
    2. aplay is working both with the audio jack and with bluetooth
    (although<br>
    not simultaneously: as soon as I have a bluetooth audio connection,
    the<br>
    audio jack stops to work, and I cannot switch back to it with
    "amixer cset<br>
    numid=3 1", but aplay can continue to use the bluetooth connection
    again<br>
    after I issue "amixer cset numid=3 65536")<br>
    <br>
    3. it seems that I do not have any permission issue as both pi and<br>
    freeswitch are in the audio group and related devices under /dev/snd
    are in<br>
    that group<br>
    <br>
    4. I have already installed alsaoss, libasound2 and libasound2-dev<br>
    <br>
    5. The output of "pa rescan" in fs_cli is the following:<br>
    <br>
    2020-06-19 06:55:18.803478 [INFO] mod_portaudio.c:3186 Looking for
    new<br>
    devices.<br>
    2020-06-19 06:55:18.803478 [INFO] mod_portaudio.c:2102 PortAudio
    version<br>
    number = 1246720<br>
    PortAudio version text = 'PortAudio V19.6.0-devel, revision<br>
    396fe4b6699ae929d3a685b3ef8a7e97396139a4'<br>
    2020-06-19 06:55:18.943433 [DEBUG] mod_portaudio.c:1773 global indev
    [-1]<br>
    2020-06-19 06:55:18.943433 [ERR] mod_portaudio.c:1777 Cannot find an
    input<br>
    device<br>
    2020-06-19 06:55:18.943433 [DEBUG] mod_portaudio.c:1786 global
    outdev [-1]<br>
    2020-06-19 06:55:18.943433 [ERR] mod_portaudio.c:1790 Cannot find an
    output<br>
    device<br>
    2020-06-19 06:55:18.943433 [INFO] mod_portaudio.c:2125 Number of
    devices = 0<br>
    <br>
    Any clue, what could be wrong on my side?<br>
    <br>
    Thanks!<br>
    <br>
  </div>

_________________________________________________________________________<br>
<br>
The FreeSWITCH project is sponsored by SignalWire <a href="https://signalwire.com" rel="noreferrer" target="_blank">https://signalwire.com</a><br>
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.<br>
Build your next product on our scalable cloud platform.<br>
<br>
Join our online community to chat in real time <a href="https://signalwire.community" rel="noreferrer" target="_blank">https://signalwire.community</a><br>
<br>
Professional FreeSWITCH Services<br>
<a href="mailto:sales@freeswitch.com" target="_blank">sales@freeswitch.com</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="https://freeswitch.com/oss" rel="noreferrer" target="_blank">https://freeswitch.com/oss</a><br>
<a href="https://freeswitch.org/confluence" rel="noreferrer" target="_blank">https://freeswitch.org/confluence</a><br>
<a href="https://cluecon.com" rel="noreferrer" target="_blank">https://cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a></div></div></div>