Problem with multiple processes sending to PulseAudio Jack sink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have several soft-phone (VoIP) daemons (linphone-daemon) running at the same time on the same machine and connecting to the same audio card via PulseAudio Jack sink. They each connect to an Asterisk server on different ports and do their SIP registrations with Asterisk under different user names. While the daemons start together with no problems and with their corresponing SIP phones registered properly, when I start sending call messages to them, the results can be unpredictable. Sometimes I can hear concurrent calls together, other times one call will block the other, and other times all calls will be blocked.

If I have 2 calls running on 2 daemons with one call blocking the other and I terminate the call that was unblocked and playing through the speakers, the blocked calls resumes playing but at the point in time where it should have been playing if it were not blocked. This makes me think that there might be a problem with PulseAudio Jack sink, but I don't know.

All concurrent daemons on a call show up in pavucontrol named "linphone-daemon" and connected to  Jack sink in the pull down menu. If i change the device in pavucontrol of a blocked call to the internal sound card (from the sink, which is connected to a USB card via Jack), it does not stop the blockage.

In one attempt to fix, I tried giving each process a different name with, for example:

bash -c "exec -a linphone-daemon1 linphone-daemon --config /home/iain/.config/linphone/linphonerc1 --pipe linphone-daemon1.soc" )&

but this didn't change the way each process was named in pavucontrol, with each process still named linphone-daemon rather than linphone-daemon1, linphone-daemon2 and linphone-daemon3. The blocks continue as well.

Might there be some port issue with the sink?

It could of course be a problem relating to my Asterisk configuration, but I thought i'd ask this question here about the sink in case there are issues running multiple processes of the same type. I've posted a related question to a linphone list as well.

Hope someone can help. Thanks, all the best,

Iain

PS. Here's the message I posted to the linphone-users list. It gives more details. I said in this message that i didn't think the problem is related to the Jack sink, but i don't know:

Hello,

I need to run several linphone-daemons at once on the one Linux machine with an Asterisk server. I have set this up so that each daemon loads a separate config file with a unique UDP/TCP port and SIP username and corresponding entries in Asterisk's sip.conf. All the daemons use the PulseAudio Jack sink to enable audio to be played concurrently with that of other processes.

While each daemon works successfully on its own, the daemons only sometimes work properly when run together. For example if daemon 1 is on a call and I send a call message through to daemon 2 to make another call, the outcome is unpredictable, sometimes both can be heard, other times the sound of one is blocked and yet other times both audio streams get jittery.

There are no problems with CPU or memory. Also, i don't believe it is a problem with the Jack sink as i can run multiple other audio programs concurrently through the sink successfully, including ones in addition to the linphone-daemon itself. Also, if i call in from several different Android phones with SIP software (again Linphone) to extensions in Asterisk (but not the server-based phones), the sound streams with no problems.

One difference I see is that the SIP phones all have different IPs, whereas all the server-based phones are on the same IP. Might this be it?

Can anyone please offer some suggestions?

I'll paste below the script that I use to launch the daemons, a script to send call messages to the servers and also the entries in Asterisk's sip.conf.

I've also uploaded a log file of one of the daemons here which includes log info of an event where the audio stopped (towards the end):

https://ufile.io/088vjf45

Relevant looking messages include:

mediastreamer-message-MSAudio_stream_iterate[0x55d89bd96ff0], local statistics available:
    Local current jitter buffer size:   0.0ms

ortp-warning-ortp_loss_rate_estimator_process 0x55d89bd5c1d0: Suspected discontinuity in sequence numbering from 503 to 250

ortp-warning-Receiving packet with unknown payload type 0

Hope someone can help,

Iain


#!/bin/bash

# startlinphones.sh

# Start 3 linphone-daemons

process=$(pgrep linphone-daemon)
set -- $process
process=$1

if [ -z $process ]; # to check if at least one daemon is already running

then

    echo "Starting linphone-daemon 1. Please wait a few seconds."
$(/home/iain/linphone-desktop/build/OUTPUT/bin/linphone-daemon \
      --config /home/iain/.config/linphone/linphonerc1 \
      --disable-stats-events \
      --log /home/iain/tmp/daemon1.log \
      --pipe linphone-daemon1.soc)&

    echo "Starting linphone-daemon 1. Please wait a few seconds."
$(/home/iain/linphone-desktop/build/OUTPUT/bin/linphone-daemon \
      --config /home/iain/.config/linphone/linphonerc2 \
      --disable-stats-events \
      --log /home/iain/tmp/daemon2.log \
      --pipe linphone-daemon2.soc)&

    echo "Starting linphone-daemon 3. Please wait a few seconds."
    $(/home/iain/linphone-desktop/build/OUTPUT/bin/linphone-daemon \
      --config /home/iain/.config/linphone/linphonerc3 \
      --disable-stats-events \
      --log /home/iain/tmp/daemon3.log \
      --pipe linphone-daemon3.soc)&

else
   echo "linphone-daemons already running"
fi
exit 0

--------------------------------------------

#!/bin/bash

# callnumber.sh

# call number on  a linphone-daemon

daemonnum=$1
phonenum=$2

if ( [ -z $phonenum ] || [ -z $daemonnum ] );
then
    echo "Requires both daemon number and phone number as arguments"
else
    process=$(pgrep linphone-daemon)
    set -- $process
    process=$1 # the 1st number in list
    if [ -z $process ];
    then
    echo "Starting linphone-daemons"
    startlinphones.sh
    sleep 5
    fi
    echo "Calling"
    $(echo "call sip:$phonenum@127.0.0.1" | \
      socat STDIN UNIX-CONNECT:/tmp/linphone-daemon$daemonnum.soc)

fi
exit 0

--------------------------------------------------

excerpt from sip.conf


[daemon1]
type=friend
context=outgoing
host=dynamic
username=daemon1
secret=mypassword
disallow=all
;allow=opus
allow=gsm
allow=ulaw
;direct_media=true
direct_media=false
language=pt_BR

[daemon2]
type=friend
context=outgoing
host=dynamic
username=daemon2
secret=mypassword
disallow=all
;allow=opus
allow=ulaw
;direct_media=true
language=pt_BR

[daemon3]
type=friend
context=outgoing
host=dynamic
username=daemon3
secret=mypassword
disallow=all
;allow=opus
allow=gsm
allow=ulaw
;direct_media=true
direct_media=false
language=pt_BR

----------------------------------

The conf files for each daemon specify unique port numbers
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
https://lists.linuxaudio.org/listinfo/linux-audio-user




[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux