Audio problem

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

 



Hello everyone,

I am trying to write a C++ application using pjsua2 that will run on the 
Raspberry Pi (armv6 architecture). I used a cross compiler to compile 
pjproject on my laptop (normal intel 64-bit architecture).

The initialisation of the endpoint and library go just fine, my test sip 
account appears online to other accounts. But when I try to make a call, 
nothing goes trough and I don't hear any sound. I expect that you should 
hear a ring when trying to make a call, please correct me if I'm wrong. 
So I suspect that it is a audiodevice problem.

In my C++ code I tried to play a normal .wav file, and that also fails. 
The program seems to think that everything is fine, but I don't hear 
anything. I checked if the program is using the right device and indeed 
it is. When I try "./pjsua --play-file THEFILE.WAV" like found in the 
sound-problem page of pjsip, I do hear the sound. So it has nothing to 
do with the pjsip libraries, but something else.

So my device is definitly working properly, the pjsip executable is 
working, so that are all not the problem. So next I will copy the 
program output and the way I initialize pjsua and play the audiofile.

The device I am using is Logitech Wireless Headset: USB Audio and I am 
compiling with the flags:
-DPJMEDIA_AUDIO_DEV_HAS_ALSA=1
-DPJMEDIA_AUDIO_DEV_HAS_PORTAUDIO=0

Any help/corrections will be greatly appreciated.

*** Initialization ***
ep.libCreate();

     ep_cfg.logConfig.level = 4;
     ep_cfg.logConfig.consoleLevel = 4;

     ep_cfg.uaConfig.userAgent = "Pjsua2 Debian Wheezy (wackytalky)";
     pj::StringVector stun_servers;
     stun_servers.push_back("stun.pjsip.org");
     ep_cfg.uaConfig.stunServer = stun_servers;


     ep_cfg.medConfig.sndClockRate = 48000;
     ep_cfg.medConfig.ecTailLen = 0;

     ep.libInit( ep_cfg );

     // Create SIP transport. Error handling sample is shown
     tcfg.port = 5060;
     try {
     ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg);
     } catch (pj::Error &err) {
     std::cout << err.info() << std::endl;
     return;
     }

     // Configure an AccountConfig
     acfg.idUri = "sip:wackytalky_rasp at sip.linphone.org";
     acfg.regConfig.registrarUri = "sip:sip.linphone.org";
     acfg.natConfig.iceEnabled = true;
     pj::AuthCredInfo cred("digest", "*", "wackytalky_rasp", 0, "k56ska");
     acfg.sipConfig.authCreds.push_back( cred );
     acfg.callConfig.timerMinSESec = 90;
     acfg.callConfig.timerSessExpiresSec = 90;

     // Create the account
     acc = new MyAccount;
     acc->create(acfg);

     // Start the library (worker threads etc)
     ep.libStart();
     std::cout << "*** PJSUA2 STARTED ***" << std::endl;
--------------------------------------------------------------------------------------------------------

*** Playing the file ***
std::cout << "***************** PLAYING AUDIO *****************" << 
std::endl;
     pj::AudioMediaPlayer player;
     pj::AudioMedia& play_med = ep.audDevManager().getPlaybackDevMedia();
     std::cout << "Portinfo.name: " << play_med.getPortInfo().name << 
std::endl;
     try {
     player.createPlayer(wavFile, PJMEDIA_FILE_NO_LOOP);
     player.startTransmit(play_med);
     } catch(pj::Error& err) {
     std::cout << "Error playing file\n" << err.reason << std::endl;
     }
     std::cout << "***************** END PLAY AUDIO *****************" 
<< std::endl;
---------------------------------------------------------------------------------------------------------------


*** Output with loglevel 4 ***
14:01:11.786 os_core_unix.c !pjlib 2.3 for POSIX initialized
14:01:11.793 sip_endpoint.c  .Creating endpoint instance...
14:01:11.796          pjlib  .select() I/O Queue created (0xfaef60)
14:01:11.798 sip_endpoint.c  .Module "mod-msg-print" registered
14:01:11.799 sip_transport.  .Transport manager created.
14:01:11.801   pjsua_core.c  .PJSUA state changed: NULL --> CREATED
14:01:11.802 sip_endpoint.c  .Module "mod-pjsua-log" registered
14:01:11.803 sip_endpoint.c  .Module "mod-tsx-layer" registered
14:01:11.804 sip_endpoint.c  .Module "mod-stateful-util" registered
14:01:11.806 sip_endpoint.c  .Module "mod-ua" registered
14:01:11.807 sip_endpoint.c  .Module "mod-100rel" registered
14:01:11.809 sip_endpoint.c  .Module "mod-pjsua" registered
14:01:11.810 sip_endpoint.c  .Module "mod-invite" registered
14:01:11.811   pjsua_core.c  .Trying STUN server stun.pjsip.org (1 of 1)..
14:01:12.379       pa_dev.c  ..PortAudio sound library initialized, status=0
14:01:12.381       pa_dev.c  ..PortAudio host api count=1
14:01:12.382       pa_dev.c  ..Sound device count=10
14:01:12.384          pjlib  ..select() I/O Queue created (0xfdcd54)
14:01:12.447 sip_endpoint.c  .Module "mod-evsub" registered
14:01:12.448 sip_endpoint.c  .Module "mod-presence" registered
14:01:12.449 sip_endpoint.c  .Module "mod-mwi" registered
14:01:12.450 sip_endpoint.c  .Module "mod-refer" registered
14:01:12.451 sip_endpoint.c  .Module "mod-pjsua-pres" registered
14:01:12.452 sip_endpoint.c  .Module "mod-pjsua-im" registered
14:01:12.453 sip_endpoint.c  .Module "mod-pjsua-options" registered
14:01:12.454   pjsua_core.c  .1 SIP worker threads created
14:01:12.456   pjsua_core.c  .pjsua version 2.3 for 
Linux-3.12.28/armv6l/glibc-2.13 initialized
14:01:12.457   pjsua_core.c  .PJSUA state changed: CREATED --> INIT
14:01:12.459    stunresolve !.STUN mapped address found/changed: 
81.11.170.171:61951
14:01:12.462   pjsua_core.c  .STUN resolution success, using 
stun.pjsip.org, address is 208.109.222.137:3478
14:01:12.699   pjsua_core.c !SIP UDP socket reachable at 81.11.170.171:43401
14:01:12.700    udp0xfe8718  SIP UDP transport started, published 
address is 81.11.170.171:43401
14:01:12.702    pjsua_acc.c  Adding account: 
id=sip:wackytalky_rasp at sip.linphone.org
14:01:12.703    pjsua_acc.c  .Account 
sip:wackytalky_rasp at sip.linphone.org added with id 0
14:01:12.705    pjsua_acc.c  .Acc 0: setting registration..
14:01:12.931   pjsua_core.c  ...TX 587 bytes Request msg 
REGISTER/cseq=26221 (tdta0xfeceb0) to UDP 91.121.209.194:5060:
REGISTER sip:sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 
81.11.170.171:43401;rport;branch=z9hG4bKPjnr-JeP0GtBXtgx0jnEA4Rj17xo6UNNmj
Max-Forwards: 70
From: 
<sip:wackytalky_rasp at sip.linphone.org>;tag=WBKGxmaoLkNufobpr.UIIT2ygMr6thrB
To: <sip:wackytalky_rasp at sip.linphone.org>
Call-ID: ueFaLQ-58TSf3LFkhuiJwif5zyxvOJB-
CSeq: 26221 REGISTER
User-Agent: Pjsua2 Debian Wheezy (wackytalky)
Contact: <sip:wackytalky_rasp at 81.11.170.171:43401;ob>;+sip.ice
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, 
REFER, MESSAGE, OPTIONS
Content-Length:  0


--end msg--
14:01:12.934    pjsua_acc.c  ..Acc 0: Registration sent
14:01:12.935   pjsua_core.c  PJSUA state changed: INIT --> STARTING
14:01:12.937 sip_endpoint.c  .Module "mod-unsolicited-mwi" registered
14:01:12.938   pjsua_core.c  .PJSUA state changed: STARTING --> RUNNING
*** PJSUA2 STARTED ***
***************** LISTING AUDIO DEVICES *****************
Index: 0Name: Logitech Wireless Headset: USB Audio (hw:0,0) Driver: PA 
defaultSamplesPerSec: 48000
Index: 1Name: bcm2835 ALSA: bcm2835 ALSA (hw:1,0) Driver: PA 
defaultSamplesPerSec: 44100
Index: 2Name: bcm2835 ALSA: bcm2835 IEC958/HDMI (hw:1,1) Driver: PA 
defaultSamplesPerSec: 44100
Index: 3Name: sysdefault Driver: PA defaultSamplesPerSec: 44100
Index: 4Name: front Driver: PA defaultSamplesPerSec: 48000
Index: 5Name: surround40 Driver: PA defaultSamplesPerSec: 48000
Index: 6Name: iec958 Driver: PA defaultSamplesPerSec: 48000
Index: 7Name: spdif Driver: PA defaultSamplesPerSec: 48000
Index: 8Name: default Driver: PA defaultSamplesPerSec: 44100
Index: 9Name: dmix Driver: PA defaultSamplesPerSec: 48000
14:01:12.950    pjsua_acc.c  Acc 0: setting online status to 1..
command: 14:01:12.995   pjsua_core.c !.RX 539 bytes Response msg 
401/REGISTER/cseq=26221 (rdata0xfe9d4c) from UDP 91.121.209.194:5060:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 
81.11.170.171:43401;rport=37004;branch=z9hG4bKPjnr-JeP0GtBXtgx0jnEA4Rj17xo6UNNmj
From: 
<sip:wackytalky_rasp at sip.linphone.org>;tag=WBKGxmaoLkNufobpr.UIIT2ygMr6thrB
To: <sip:wackytalky_rasp at sip.linphone.org>;tag=Z6jFrU1r5rppF
Call-ID: ueFaLQ-58TSf3LFkhuiJwif5zyxvOJB-
CSeq: 26221 REGISTER
Server: Flexisip/0.8.0 (sofia-sip-nta/2.0)
WWW-Authenticate: Digest realm="sip.linphone.org", 
nonce="fpcp2AAAAADwjHH8AAAeZH6nzAMAAAAA", opaque="+GNywA==", 
algorithm=MD5, qop="auth"
Content-Length: 0


--end msg--
14:01:12.997    pjsua_acc.c  ....IP address change detected for account 
0 (81.11.170.171:43401 --> 81.11.170.171:37004). Updating registration 
(using method 4)
14:01:12.999   pjsua_core.c  ....TX 878 bytes Request msg 
REGISTER/cseq=26222 (tdta0xfeceb0) to UDP 91.121.209.194:5060:
REGISTER sip:sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 
81.11.170.171:37004;rport;branch=z9hG4bKPjtOLt4IZpb.flD56Mh19Dx.7zrw8JSnVG
Max-Forwards: 70
From: 
<sip:wackytalky_rasp at sip.linphone.org>;tag=WBKGxmaoLkNufobpr.UIIT2ygMr6thrB
To: <sip:wackytalky_rasp at sip.linphone.org>
Call-ID: ueFaLQ-58TSf3LFkhuiJwif5zyxvOJB-
CSeq: 26222 REGISTER
User-Agent: Pjsua2 Debian Wheezy (wackytalky)
Contact: <sip:wackytalky_rasp at 81.11.170.171:37004;ob>;+sip.ice
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, 
REFER, MESSAGE, OPTIONS
Authorization: Digest username="wackytalky_rasp", 
realm="sip.linphone.org", nonce="fpcp2AAAAADwjHH8AAAeZH6nzAMAAAAA", 
uri="sip:sip.linphone.org", response="2746a476da3e6dfaded742501519feaf", 
algorithm=MD5, cnonce="bTC-fBmk10HddeNJr0zzxIRFbBJDfJay", 
opaque="+GNywA==", qop=auth, nc=00000001
Content-Length:  0


--end msg--
14:01:13.075   pjsua_core.c  .RX 485 bytes Response msg 
200/REGISTER/cseq=26222 (rdata0xfe9d4c) from UDP 91.121.209.194:5060:
SIP/2.0 200 Registration successful
Via: SIP/2.0/UDP 
81.11.170.171:37004;rport=37004;branch=z9hG4bKPjtOLt4IZpb.flD56Mh19Dx.7zrw8JSnVG
From: 
<sip:wackytalky_rasp at sip.linphone.org>;tag=WBKGxmaoLkNufobpr.UIIT2ygMr6thrB
To: <sip:wackytalky_rasp at sip.linphone.org>;tag=7eXN6K8me08Bc
Call-ID: ueFaLQ-58TSf3LFkhuiJwif5zyxvOJB-
CSeq: 26222 REGISTER
Contact: <sip:wackytalky_rasp at 81.11.170.171:37004;ob>;expires=300;q=0.00
Server: Flexisip/0.8.0 (sofia-sip-nta/2.0)
Content-Length: 0


--end msg--
14:01:13.076    pjsua_acc.c  ....SIP outbound status for acc 0 is not active
14:01:13.078    pjsua_acc.c ....sip:wackytalky_rasp at sip.linphone.org: 
registration success, status=200 (Registration successful), will 
re-register in 300 seconds
14:01:13.079    pjsua_acc.c  ....Keep-alive timer started for acc 0, 
destination:91.121.209.194:5060, interval:15s
*** Register: code=200
play
***************** PLAYING AUDIO *****************
Portinfo.name: Master/sound
14:01:15.114    pjsua_aud.c !Creating file player: Noise.wav..
14:01:15.116   wav_player.c  .File player 'Noise.wav' created: 
samp.rate=48000, ch=1, bufsize=4KB, filesize=135KB
14:01:15.117    pjsua_aud.c  .Player created, id=0, slot=1
14:01:15.118    pjsua_aud.c  Conf connect: 1 --> 0
14:01:15.119    pjsua_aud.c  .Set sound device: capture=-1, playback=-2
14:01:15.121    pjsua_aud.c  ..Opening sound device PCM at 48000/1/20ms
14:01:15.140   conference.c  .Port 1 (Noise.wav) transmitting to port 0 
(Logitech Wireless Headset: USB Audio (hw:0,0) (48KHz))
***************** END PLAY AUDIO *****************
14:01:15.143    pjsua_aud.c  Destroying player 0..
command: 14:01:15.183 os_core_unix.c !Info: possibly re-registering 
existing thread
14:01:16.143    pjsua_aud.c !Closing sound device after idle for 1 second(s)
14:01:16.144    pjsua_aud.c  .Closing Logitech Wireless Headset: USB 
Audio (hw:0,0) sound playback device and Logitech Wireless Headset: USB 
Audio (hw:0,0) sound capture device




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux