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 !!!
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.
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.
- install the required development packages! like pulseaudio-dev, alsa-dev, portaudio-dev or whatever you desire (in dubio all!)
- restart configuration and building again! (aconfigure, make...)
- 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...
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)
来源:https://stackoverflow.com/questions/16483635/pjsip-new-call-error-unable-to-find-default-audio-device-pjmedia-eaud-nodef