[LAU] Service/user not using PulseAudio

Iain Mott mott at escuta.org
Wed Apr 8 13:49:58 CEST 2020


I suppose a likely cause for the problem is that the asterisk user has 
no ~.config/pulse directory. How can I get around that?


Em 08/04/2020 08:38, Iain Mott escreveu:
> Hi,
>
> Another Asterisk PBX related question. I have the Asterisk service 
> periodically sending System commands on the host machine when 
> particular phone extensions are called. The Asterisk service is run by 
> the user asterisk. I made asterisk a member of the 'audio' group so 
> that it can use 'aplay' with the System command. eg.
>
> System(aplay -c 1 -D pulse /home/iain/sounds/line1.wav)
>
> This plays OK but plays on the laptop's internal hardware rather via 
> PulseAudio. Jack is running and is configured to use an external USB 
> sound card and the PulseAudio Jack Sink.
>
> If I run the following as user iain, it plays correctly through the USB:
>
> aplay -c 1 -D pulse /home/iain/sounds/line1.wav
>
> However via the Aterisk service, or by running the command in a 
> console as asterisk, it plays through the internal speakers. eg.
>
> sudo -H -u asterisk bash -c 'aplay -c 1 -D pulse 
> /home/iain/sounds/line1.wav'
>
> I don't know if the "-D pulse" option is necessary, I'm trying lots of 
> things...
>
> As well as the audio group, I've tried adding asterisk to the pulse 
> and pulse-access groups, but it doesn't help (and yes, I logged out 
> and in again).
>
> If i run the last code given above with aplay in verbose mode (-vvv), 
> it throws the error:
>
> xcb_connection_has_error() returned true
>
> But this Is not error because adding "unset DISPLAY ; " to the start 
> of the command removes the error but it continues to play through the 
> external speakers. Here is the print for the command:
>
> iain at samsung:~$ sudo -H -u asterisk bash -c 'unset DISPLAY ; aplay 
> -vvvv -c 1 -D pulse /home/iain/sounds/line1.wav'
> Tocando WAVE '/home/iain/sounds/line1.wav' : Signed 16 bit Little 
> Endian, Taxa 48000 Hz, Mono
> ALSA <-> PulseAudio PCM I/O Plugin
> Its setup is:
>   stream       : PLAYBACK
>   access       : RW_INTERLEAVED
>   format       : S16_LE
>   subformat    : STD
>   channels     : 1
>   rate         : 48000
>   exact rate   : 48000 (48000/1)
>   msbits       : 16
>   buffer_size  : 24000
>   period_size  : 6000
>   period_time  : 125000
>   tstamp_mode  : NONE
>   tstamp_type  : GETTIMEOFDAY
>   period_step  : 1
>   avail_min    : 6000
>   period_event : 0
>   start_threshold  : 24000
>   stop_threshold   : 24000
>   silence_threshold: 0
>   silence_size : 0
>   boundary     : 6755399441055744000
> iain at samsung:~$
>
> Any suggestions please?
>
> Thanks,
>
> Iain
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user at lists.linuxaudio.org
> https://lists.linuxaudio.org/listinfo/linux-audio-user


More information about the Linux-audio-user mailing list