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.
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?
---------- Forwarded message --------- From: Tazari, Mohammad Reza<saied.tazari@gmail.com> Date: Wed, Aug 26, 2020 at 11:01 AM Subject: Re: [Freeswitch-users] mod_portaudio on Raspberry Pi currently broken? To: <freeswitch-users@lists.freeswitch.org>
Tom, other interested people,
I finally got it working on a raspberry pi-4 with buster lite,
mostly thanks to the following articles:
sudo vi
/lib/systemd/system/bluetooth.service
--> Added --noplugin=sap to the
end of the following line
ExecStart=/usr/lib/bluetooth/bluetoothd
sudo vi
/lib/systemd/system/bthelper@.service --> Added ExecStartPre=/bin/sleep
2in
a new line after
Type=simple
Created a new file by sudo
vi /etc/asound.conf
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): pcm.btAudioIO {
type asym
playback.pcm {
type plug
slave.pcm {
type bluealsa
service "org.bluealsa"
device
"00:11:09:94:14:3D"
profile "a2dp"
delay 10000
}
}
capture.pcm {
type plug
slave.pcm {
type bluealsa
service "org.bluealsa"
device
"00:11:09:94:14:3D"
profile "sco"
delay 10000
}
}
hint {
show on
description "Bluetooth Audio
Input/Output Dvice"
}
}
sudo adduser freeswitch audio
sudo adduser freeswitch bluetooth
sudo reboot
After reboot, run sudo
bluetoothctl and then find, pair, connect
and trust your Bluetooth device with the
following control commands of this program: agent on
scan on <-- find the MAC
address of your device in the scan
outputs pair
50:11:2D:06:ED:2F scan off connect
50:11:2D:06:ED:2F
trust 50:11:2D:06:ED:2F
exit --> 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.
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.
Test your device with the
following two commands (five seconds
recording): arecord -D btAudioIO -d 5 test.wav
aplay -D btAudioIO
test.wav
Assuming that the above test is
successful, you now
- edit <FreeSwitch-Config-Home>/autoload_configs/modules.conf.xml
and un-comment the loading of mod_portaudio
- edit <FreeSwitch-Config-Home>/autoload_configs/portaudio.conf.xml
and substitute the whole
content with the following
new content: <configuration
name="portaudio.conf"
description="Soundcard
Endpoint">
<settings>
<param name="indev"
value="btAudioIO"/>
<param name="outdev"
value="btAudioIO"/>
<param name="ringdev"
value="btAudioIO"/>
<param name="hold-file"
value="$${hold_music}"/>
<param name="dialplan"
value="XML"/>
<param name="cid-name"
value="$${outbound_caller_name}"/>
<param name="cid-num"
value="$${outbound_caller_id}"/>
<param
name="sample-rate"
value="48000"/>
<param name="codec-ms"
value="20"/>
</settings>
</configuration>c
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 is never
supposed to make calls but
is called for making
announcements or invited to
a running call 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: sudo sed -i
's#user/000@[0-9.]+#portaudio/auto_answer#g'
dial.py
After a reboot, after which also FreeSwitch and my application
start, everything was working for me just fine :-)
Cheers,
-- Saied
Subject:
Re: [Freeswitch-users] mod_portaudio on Raspberry Pi
currently broken?
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.
Lesley Pervis wrote
> Sorry for the spam, but I thought I'd mention that I can aplay
no problem
> from the command line as the 'freeswitch' user, and yet when FS
is running
> as that user, no luck.
Exactly seven years after your last post here, I'm there to ask if
you
finally succeeded to resolve the issue?
My case:
1. Pi-4 with Raspbian buster und latest related FreeSwitch
distribution,
apt-upgraded and updated just yesterday
2. aplay is working both with the audio jack and with bluetooth
(although
not simultaneously: as soon as I have a bluetooth audio connection,
the
audio jack stops to work, and I cannot switch back to it with
"amixer cset
numid=3 1", but aplay can continue to use the bluetooth connection
again
after I issue "amixer cset numid=3 65536")
3. it seems that I do not have any permission issue as both pi and
freeswitch are in the audio group and related devices under /dev/snd
are in
that group
4. I have already installed alsaoss, libasound2 and libasound2-dev
5. The output of "pa rescan" in fs_cli is the following:
2020-06-19 06:55:18.803478 [INFO] mod_portaudio.c:3186 Looking for
new
devices.
2020-06-19 06:55:18.803478 [INFO] mod_portaudio.c:2102 PortAudio
version
number = 1246720
PortAudio version text = 'PortAudio V19.6.0-devel, revision
396fe4b6699ae929d3a685b3ef8a7e97396139a4'
2020-06-19 06:55:18.943433 [DEBUG] mod_portaudio.c:1773 global indev
[-1]
2020-06-19 06:55:18.943433 [ERR] mod_portaudio.c:1777 Cannot find an
input
device
2020-06-19 06:55:18.943433 [DEBUG] mod_portaudio.c:1786 global
outdev [-1]
2020-06-19 06:55:18.943433 [ERR] mod_portaudio.c:1790 Cannot find an
output
device
2020-06-19 06:55:18.943433 [INFO] mod_portaudio.c:2125 Number of
devices = 0
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.