pjsip new-call error ... Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV)
Asked Answered
C

5

5

I get this error when I try to establish a new call from pjsip:

pjsua_aud.c ..Error retrieving default audio device parameters: Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV) [status=420006] Exception: Object: {Account <sip:192.168.0.2:54496>}, operation=make_call(), error=Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV)

I installed libasound2-dev: sudo apt-get install libasound2-dev, and recompiled pjsip, but still, it gives me the same result .. Am I missing something here?

N.B. I use Ubuntu 11.10 and the sound works fine with no problems, so please don't tell me I have problems in the sound card


Update

I configured and compiled the pjsip like this:

$ ./configure

$ make && make install

And like this:

$ ./configure --enable-shared --disable-static --enable-memalign-hack

$ make && make install

And also like this:

$ ./configure

$ make dep && make clean && make

And all ways gave me the same results.


Update 2

I made sure that all of below are installed, and still the problem persists:

sudo apt-get install portaudio19-dev libportaudio2 pulseaudio alsa-utils liboss4-salsa-dev alsa-base alsa-tools libasound2-plugins libasound2 libasound2-dev binutils binutils-dev libasound-dev pulseaudio-dev


Update 3

I ran it like below, and it worked:

pjproject-2.1.0/pjsip-apps/bin/pjsua-i686-pc-linux-gnu --capture-dev=-1 --playback-dev=-1

It can call the other party. But when I run it from a python script it gives me an error, even when I set the sound device like this:

lib.init(log_cfg = pj.LogConfig(level=LOG_LEVEL, callback=log_cb))
snd_dev = lib.get_snd_dev()
print snd_dev ## returns (-1,-2)
lib.set_snd_dev(0,0)

Error is:

12:39:55.753 os_core_unix.c !pjlib 2.1 for POSIX initialized 12:39:55.754 sip_endpoint.c .Creating endpoint instance... 12:39:55.754 pjlib .select() I/O Queue created (0x93f1a80) 12:39:55.754 sip_endpoint.c .Module "mod-msg-print" registered 12:39:55.754 sip_transport. .Transport manager created. 12:39:55.754 pjsua_core.c .PJSUA state changed: NULL --> CREATED 12:39:55.769
pjsua_core.c .pjsua version 2.1 for Linux-3.0.0.17/i686/glibc-2.13 initialized (-1, -2) 12:39:55.770 pjsua_aud.c .Error retrieving default audio device parameters: Invalid audio device (PJMEDIA_EAUD_INVDEV) [status=420004] Exception: Object: Lib, operation=set_current_sound_devices(), error=Invalid audio device (PJMEDIA_EAUD_INVDEV)

But weirdly worked, when I replaced the lib.set_snd_dev(0,0) with this line lib.set_null_snd_dev(), but of course the sound is not working, as I'm setting the sound device to null !!!

Culture answered 10/5, 2013 at 13:39 Comment(2)
I don't know the software you mentioned, but just googling that error it seems pretty common, looks like you missed something in configuration. Did you try looking at the pjsip resources? There's one on compiling for Linux, and another for troubleshooting. They look helpful.Chromatography
Not sure what exactly you are talking about, I tried what in the pages you referred to thankfully, but nothing works .. please see my update in the questionCulture
H
13

This happens when the development packages are not installed. From your error message i can tell that libasound-development-package is not installed. Do as following:

sudo apt-get install libasound2-dev

Pay attention that pjsip would still fail to set the default audio device since you have done the make as this package was missing. So you need to build Pjsip once again

at pjsip directory do the following respectively :

./configure
make dep 
make clean
make
make install

that'd do it.

Heathcote answered 7/1, 2014 at 16:45 Comment(3)
+1 Thank you. The outbound call would fail because it didn't detect audio device. This now works on Ubuntu 12.04Anderlecht
Having the Same issue in Ubuntu 18.04.Earlier by using the same steps the system was working earlier but now idk why but even after doing the same steps it's not working.Vanadous
I am facing same issues, I am using Mac OS. As per pjsip.org follow all the instructions. When ever I trigger call from my sample app got same issue. But I am unable to install libasound2-dev in my Mac OS system. Please help me to resolve this issue. Thank youCrowning
B
0

From an additional post I found you might want to also check that you have these packages and do a rebuild. Let me know how that goes for you.

  1. install the required development packages! like pulseaudio-dev, alsa-dev, portaudio-dev or whatever you desire (in dubio all!)
  2. restart configuration and building again! (aconfigure, make...)
  3. go again to pjsip-apps/src/python and do make / make all, same in ../py_pjsua

the pa_dev.c ..Sound device count should now spit out a few more devices...

Brose answered 10/5, 2013 at 19:8 Comment(1)
Hello @theagent, thanks for your contribution here :), I installed all the packages in the world, I modified the list of packages that I installed in Update2 in my question, reconfigured, remade ... and still the same :(Culture
H
0

You can install a virtual soundcard to ubuntu and get this working, as explained in this solution, https://mcmap.net/q/812674/-linux-without-hardware-soundcard-capture-audio-playback-and-record-it-to-file

You have to install install these packages sudo apt-get install pulseaudio jackd2 alsa-utils dbus-x11 and rebuild pjsip, thats it!

Hugohugon answered 13/5, 2021 at 12:52 Comment(0)
B
0

I had the exact same issue. I created directories ~/pjproject and ~/pjproject/exec for build outputs including executables. Than I build pjproject with:

./configure CFLAGS="-fPIC" --prefix=~/pjproject --exec-prefix=~/pjproject/exec --enable-shared

Everything here is owned by my user. I added these directories to shared lib search path with:

export LD_LIBRARY_PATH=/home/youruser/pjproject/exec/lib
Bemused answered 20/5 at 14:32 Comment(0)
T
-2

Well, just a guess (I cannot try it on my PC right now), but don't you actually need to set your sound device to the value obtained by get_snd_dev? That seems to be reasonable at least. So instead of

lib.set_snd_dev(0,0)

try to call it with (-1, -2) tuple:

lib.set_snd_dev(-1,-2)
Toll answered 2/12, 2013 at 6:7 Comment(1)
Hi dude, what difference does it make, and why it should work with (-1,-2)? I don't fully understand.Culture

© 2022 - 2024 — McMap. All rights reserved.