Jibri can not hear audio from remote sip

Hi, I’m building my custom docker-jitsi-meet from the official repo to implement the multiple jibri sip gateway.
I can invite multiple sip video clients in the meet and see them in the chrome.

The problem is

  1. My sip client can hear the audio from meet, but the meet cannot hear the audio from remote sip client. I captured the audio stream use tcpdump, the audio acturely transported to the jibri as video does.
  2. I want to know how the audio stream be transported in the jibri sip archtecture. About pulseaudio , ALSA, and ffmpeg and the config in the pjsua.conf.
  3. I could only set --capture-dev=17(the alsa [default]) then the remote sip client can hear the audio. But how to set the --playback-dev ? I tried almost all 32 devices and cannot hear it.
  4. The jibri instance always muted in the meet, jicofo log shows the AudioMuted=true&IsJibri=true…when jibri joined. Is it the same problem?
#The jibri.conf(default one) shows the ffmpeg audiosource is pulse, the command is 
ffmpeg -re -f x11grab -r 60 -s 1920x1080 -i :0 -f x11grab -r 60 -s 1280x720 -i :1 -map 0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video1 -map 1 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0`
#Audio Device List
Found 32 devices
  0: ALSA [lavrate] (1/1)
  1: ALSA [samplerate] (1/1)
  2: ALSA [speexrate] (1/1)
  3: ALSA [jack] (0/0)
  4: ALSA [oss] (0/0)
  5: ALSA [pulse] (1/1)
  6: ALSA [upmix] (1/1)
  7: ALSA [vdownmix] (1/1)
  8: ALSA [amix] (0/1)
  9: ALSA [asnoop] (1/0)
 10: ALSA [aduplex] (1/1)
 11: ALSA [bmix] (0/1)
 12: ALSA [bsnoop] (1/0)
 13: ALSA [bduplex] (1/1)
 14: ALSA [pjsua] (1/1)
 15: ALSA [pjcap] (1/1)
 16: ALSA [pjply] (1/1)
 17: ALSA [default] (1/1)
 18: ALSA [hw:CARD=Loopback,DEV=0] (1/1)
 19: ALSA [hw:CARD=Loopback,DEV=1] (1/1)
 20: ALSA [plughw:CARD=Loopback,DEV=0] (1/1)
 21: ALSA [plughw:CARD=Loopback,DEV=1] (1/1)
 22: ALSA [sysdefault:CARD=Loopback] (1/1)
 23: ALSA [front:CARD=Loopback,DEV=0] (1/1)
 24: ALSA [surround21:CARD=Loopback,DEV=0] (1/1)
 25: ALSA [surround40:CARD=Loopback,DEV=0] (1/1)
 26: ALSA [surround41:CARD=Loopback,DEV=0] (1/1)
 27: ALSA [surround50:CARD=Loopback,DEV=0] (1/1)
 28: ALSA [surround51:CARD=Loopback,DEV=0] (1/1)
 29: ALSA [surround71:C
1:OK
# my .asoundrc
pcm.amix {                                                                                                                                                                                                                          [0/4993]
  type dmix
  ipc_key 219345
  slave.pcm "hw:0,0,0"
}

pcm.asnoop {
  type dsnoop
  ipc_key 219346
  slave.pcm "hw:1,1,0"
}

pcm.aduplex {
  type asym
  playback.pcm "amix"
  capture.pcm "asnoop"
}

pcm.bmix {
  type dmix
  ipc_key 219347
  slave.pcm "hw:1,0,0"
}

pcm.bsnoop {
  type dsnoop
  ipc_key 219348
  slave.pcm "hw:0,1,0"
}

pcm.bduplex {
  type asym
  playback.pcm "bmix"
  capture.pcm "bsnoop"
}

pcm.pjsua {
  type plug
  slave.pcm "bduplex"
}

pcm.pjcap {
   type plug
   slave.pcm "hw:0,1,0"
}

pcm.pjply {
   type plug
   slave.pcm "hw:1,0,0"
}
pcm.!default {
  type plug
  slave.pcm "aduplex"
}
#pulse audio (the default, I never change )

.include /etc/pulse/default.pa                                                                                                                                                                                                      [0/5000]

# Load the virtual sink and set it as default
load-module module-virtual-sink sink_name=jibri-loop
set-default-sink jibri-loop

# set the monitor of the jibri-loop sink to be the default source
set-default-source jibri-loop.monitor
# my pjsua.conf
--capture-dev=17                                                                                                                                                                                                                    
--playback-dev=16
--video
--vcapture-dev=1
#--rec-file /config/out.wav
#--no-color
--color
--log-level=5
--app-log-level=6
--auto-update-nat 0
--disable-stun
#--stun-srv=rcs.runaiot.sh
#--proxy
--no-tcp
--dis-codec GSM
--dis-codec H263
--dis-codec iLBC
--dis-codec G722
--dis-codec speex
--dis-codec pcmu
--dis-codec pcma
--dis-codec opus
#--add-codec pcmu
#--add-codec pcma
#--add-codec speex
--add-codec G722
#--add-codec opus
--add-codec H264
--no-vad
--ec-tail 0
--quality 10
--max-calls=1
--auto-keyframe=30
#--no-stderr
--rtp-port=19900
--log-file /config/logs/pjsua.log
--id xxxxx
--registrar xxxxx
--realm *
--username xxxx
--password xxxxx

@emrah Could you please explain this, thanks a lot. :smiling_face:

You have only one loopback device in your device list. There should be two

I think I have 2 loopback service.
I followed this repo

which did a

# hw:Loopback,0,0 -> hw:0,0,0
# hw:Loopback,1,0 -> hw:0,1,0
# hw:Loopback_1,0,0 -> hw:1,0,0
# hw:Loopback_1,1,0 -> hw:1,1,0
sed -i "s/hw:Loopback_1/hw:$((i+1))/g" /home/jibri/.asoundrc # i+1 is odd-numbered
sed -i "s/hw:Loopback/hw:${i}/g" /home/jibri/.asoundrc # i is even-numbered

to this file, when i=0,
the file is
hw:0 = loopback
hw:1 = loopback_1

Am I right? Or what should I change to this file to get it work?

You noticed the the devices list, I always get 32 devices and never show the full list (about 21 up to 29, I don’t know why),
but the asnoop, aduplex, bmix, pjply… is the second loopback device. So I had never cared about it. Is it the problem?

pjsua device list is created while building the executable. So the buildtime environment should match to the runtime environment.

And I’m not familiar with Docker setup. Maybe the issue is related with Docker.

The device list is printed at runtime environment, and what the devices id and name the runtime pjsua.log printed is absolutely equal to my pjsystest showed above, I’m sure about it.

By the way, My server is a vmware esxi host with debian 11, I used your non-docker installer, and the device ids is also different from what I thought, I changed it one by one, it finally worked with cature-id=xx, playback-id=xx (sorry I can’t find it, I remember one of them is 26 ALSA[sysdefault].

Found 32 devices
  0: ALSA [hw:CARD=Loopback,DEV=0] (1/1)
  1: ALSA [hw:CARD=Loopback,DEV=1] (1/1)
  2: ALSA [plughw:CARD=Loopback,DEV=0] (1/1)
  3: ALSA [plughw:CARD=Loopback,DEV=1] (1/1)
  4: ALSA [default:CARD=Loopback] (1/1)
  5: ALSA [sysdefault:CARD=Loopback] (1/1)
  6: ALSA [front:CARD=Loopback,DEV=0] (1/1)
  7: ALSA [surround21:CARD=Loopback,DEV=0] (1/1)
  8: ALSA [surround40:CARD=Loopback,DEV=0] (1/1)
  9: ALSA [surround41:CARD=Loopback,DEV=0] (1/1)
 10: ALSA [surround50:CARD=Loopback,DEV=0] (1/1)
 11: ALSA [surround51:CARD=Loopback,DEV=0] (1/1)
 12: ALSA [surround71:CARD=Loopback,DEV=0] (1/1)
 13: ALSA [dmix:CARD=Loopback,DEV=0] (0/1)
 14: ALSA [dmix:CARD=Loopback,DEV=1] (0/1)
 15: ALSA [dsnoop:CARD=Loopback,DEV=0] (1/0)
 16: ALSA [dsnoop:CARD=Loopback,DEV=1] (1/0)
 17: ALSA [hw:CARD=Loopback_1,DEV=0] (1/1)
 18: ALSA [hw:CARD=Loopback_1,DEV=1] (1/1)
 19: ALSA [plughw:CARD=Loopback_1,DEV=0] (1/1)
 20: ALSA [plughw:CARD=Loopback_1,DEV=1] (1/1)
 21: ALSA [default:CARD=Loopback_1]
1:OK  

I found a image described this, but it is not right in my situation, nether host machine or docker.

I set HW by using its name in .asoundrc, not by using the device id… Otherwise the order may change if there is a physical card.

I directly used your asoundrc, the only difference I see is

15 pjcap to 15 pjsua_capture
16 pjply to 16 pjsua_playback

The capture-dev can only set to 17 ALSA[default] as usual.

Audio Device List
Found 32 devices
  0: ALSA [lavrate] (1/1)
  1: ALSA [samplerate] (1/1)
  2: ALSA [speexrate] (1/1)
  3: ALSA [jack] (0/0)
  4: ALSA [oss] (0/0)
  5: ALSA [pulse] (1/1)
  6: ALSA [upmix] (1/1)
  7: ALSA [vdownmix] (1/1)
  8: ALSA [amix] (0/1)
  9: ALSA [asnoop] (1/0)
 10: ALSA [aduplex] (1/1)
 11: ALSA [bmix] (0/1)
 12: ALSA [bsnoop] (1/0)
 13: ALSA [bduplex] (1/1)
 14: ALSA [pjsua] (1/1)
 15: ALSA [pjsua_capture] (1/1)
 16: ALSA [pjsua_playback] (1/1)
 17: ALSA [default] (1/1)
 18: ALSA [hw:CARD=Loopback,DEV=0] (1/1)
 19: ALSA [hw:CARD=Loopback,DEV=1] (1/1)
 20: ALSA [plughw:CARD=Loopback,DEV=0] (1/1)
 21: ALSA [plughw:CARD=Loopback,DEV=1] (1/1)
 22: ALSA [sysdefault:CARD=Loopback] (1/1)
 23: ALSA [front:CARD=Loopback,DEV=0] (1/1)
 24: ALSA [surround21:CARD=Loopback,DEV=0] (1/1)
 25: ALSA [surround40:CARD=Loopback,DEV=0] (1/1)
 26: ALSA [surround41:CARD=Loopback,DEV=0] (1/1)
 27: ALSA [surround50:CARD=Loopback,DEV=0] (1/1)
 28: ALSA [surround51:CARD=Loopback,DEV=0] (1/1)
 29: A
1:OK

I didn’t mean that. You have sed commands which updates this file at the runtime

sed -i "s/hw:Loopback_1/hw:$((i+1))/g" /home/jibri/.asoundrc # i+1 is odd-numbered
sed -i "s/hw:Loopback/hw:${i}/g" /home/jibri/.asoundrc # i is even-numbered

So, it uses the numerical order by selecting the devices.

Maybe you can test your setup after temporary disabling these sed commands. It should work for one call

Yes, I operate directly in the running container, the the sed only executes at the container start time. It is your .asoundrc at running time

@saghul Do you have any idea? Please help, thank you !

Please, don’t tag people unless they’re already helping you in the thread.

Sorry, it’s my fault. I’m very appreciate to your great job to the project and patiently reply in the community.
My repo is build from saghul’s repo , I saw the community that someone tag saghul about the .asoundrc and saghul is a very kind of person.
I stucked at it for some times and had no idea about it. Sorry for bothering again.

Without docker, I tested in a VirtualBox machine and ESXi machine. The ESXi works well, and VirtualBox one had the same problem before reboot. After the host be rebooted, I saw the pjsua printed the Loopback_1 device which the command aplay -l always shows

So I think it is the pjsip in docker with ALSA problem, It always print 32 devices and not work when you can’t see it in the list.( for this case, pjsua could only access hw:0,0, but aplay/arecord can access all)

Hope it would help some people who got the same error.

Because pjsua creates the device list at build time.

Add PJMEDIA_AUDIO_DEV_HAS_ALSA option to pjsip srouce, It could add ALSA support in docker image and detect in container running, otherwise it can not detect any devices.

I tried to direct build pjsip in a running container, The devices list is no difference from building in the dockerfile.

1 Like