<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<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 class="moz-txt-link-freetext" href="https://sigmdel.ca/michel/ha/rpi/bluetooth_01_en.html">https://sigmdel.ca/michel/ha/rpi/bluetooth_01_en.html</a><br>
<a class="moz-txt-link-freetext" href="https://sigmdel.ca/michel/ha/rpi/bluetooth_02_en.html">https://sigmdel.ca/michel/ha/rpi/bluetooth_02_en.html</a><br>
<a class="moz-txt-link-freetext" href="https://sigmdel.ca/michel/ha/rpi/bluetooth_n_buster_01_en.html">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:part1.7D012D45.39BCDAA0@gmail.com" alt=""
width="249" height="138"><br>
<br>
+ my FreeSwitch installation based on instructions under <a
href="https://freeswitch.org/confluence/display/FREESWITCH/Raspberry+Pi">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>connect
50:11:2D:06:ED:2F<br>
trust 50:11:2D:06:ED:2F<br>
exit<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"><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 class="mimeAttachmentHeader"><legend
class="mimeAttachmentHeaderName">ForwardedMessage.eml</legend></fieldset>
<table class="header-part1" width="100%" cellspacing="0"
cellpadding="0" border="0">
<tbody>
<tr>
<td>
<div class="headerdisplayname" style="display:inline;">Subject:
</div>
Re: [Freeswitch-users] mod_portaudio on Raspberry Pi
currently broken?</td>
</tr>
<tr>
<td>
<div class="headerdisplayname" style="display:inline;">From:
</div>
Tom Lynn <a class="moz-txt-link-rfc2396E" href="mailto:tom@tomlynn.com"><tom@tomlynn.com></a></td>
</tr>
<tr>
<td>
<div class="headerdisplayname" style="display:inline;">Date:
</div>
27-Jul-20, 07:56</td>
</tr>
</tbody>
</table>
<table class="header-part2" width="100%" cellspacing="0"
cellpadding="0" border="0">
<tbody>
<tr>
<td>
<div class="headerdisplayname" style="display:inline;">To: </div>
FreeSWITCH Users Help
<a class="moz-txt-link-rfc2396E" href="mailto:freeswitch-users@lists.freeswitch.org"><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>
</body>
</html>