I'm trying to set up an embedded device (currently without audio hardware) to use PJSIP. The final device WILL have audio hardware but, for now, we just want to test whether PJSIP will build and function correctly in our environment.
So the setup we desire is a client application which will make a call to a server, read some audio data from a file, then send that via PJSIP to the server. The server will receive the call and write the audio data to another file. Then it will be a (relatively) simple matter of comparing the two files to see if they are the same content (by listening to them since I'm not sure the audio transmission will be a full bit-for-bit copy).
Keep in mind the function names or structures may look slightly different to what you're used to - we're actually using a SWIG-generated thin C# layer over pjsua2.
We have the server written to the point where it's awaiting an incoming call so that's not a problem (yet). It kicks up and waits on port 5060 for an incoming call.
The client follows the same logic as the server in terms of initialising (setting up ConnectionSettings and Account and creating delegates to capture PJSIP events). However, rather than waiting for an incoming call as the server does, it instead calls:
call = pjsip.Account.Call("127.0.0.1", 5060)
to try and contact the server. At this point, we see an error output to the command line (the timestamped lines are out of PJSIP itself, other lines are our log messages):
===== == Starting the VOIP demo client == Instantiating connection settings == Instantiating Pjsip object 02:01:16.185 os_core_unix.c !pjlib 2.4.5 for POSIX initialized 02:01:16.188 sip_endpoint.c .Creating endpoint instance... 02:01:16.188 pjlib .select() I/O Queue created (0x13b1318) 02:01:16.188 sip_endpoint.c .Module "mod-msg-print" registered 02:01:16.188 sip_transport. .Transport manager created. 02:01:16.189 pjsua_core.c .PJSUA state changed: NULL --> CREATED 02:01:16.190 sip_endpoint.c .Module "mod-pjsua-log" registered 02:01:16.190 sip_endpoint.c .Module "mod-tsx-layer" registered 02:01:16.190 sip_endpoint.c .Module "mod-stateful-util" registered 02:01:16.190 sip_endpoint.c .Module "mod-ua" registered 02:01:16.190 sip_endpoint.c .Module "mod-100rel" registered 02:01:16.190 sip_endpoint.c .Module "mod-pjsua" registered 02:01:16.191 sip_endpoint.c .Module "mod-invite" registered 02:01:16.204 alsa_dev.c ..ALSA driver found 0 devices 02:01:16.204 alsa_dev.c ..ALSA initialized 02:01:16.204 pjlib ..select() I/O Queue created (0x13b2134) 02:01:16.225 sip_endpoint.c .Module "mod-evsub" registered 02:01:16.225 sip_endpoint.c .Module "mod-presence" registered 02:01:16.225 sip_endpoint.c .Module "mod-mwi" registered 02:01:16.225 sip_endpoint.c .Module "mod-refer" registered 02:01:16.225 sip_endpoint.c .Module "mod-pjsua-pres" registered 02:01:16.226 sip_endpoint.c .Module "mod-pjsua-im" registered 02:01:16.226 sip_endpoint.c .Module "mod-pjsua-options" registered 02:01:16.226 pjsua_core.c .1 SIP worker threads created 02:01:16.226 pjsua_core.c .pjsua version 2.4.5 for Linux-3.14.28/armv7l/glibc-2.21 initialized 02:01:16.226 pjsua_core.c .PJSUA state changed: CREATED --> INIT 02:01:16.227 pjsua_core.c PJSUA state changed: INIT --> STARTING 02:01:16.227 sip_endpoint.c .Module "mod-unsolicited-mwi" registered 02:01:16.227 pjsua_core.c .PJSUA state changed: STARTING --> RUNNING PJSUA2 Started == Initialising Pjsip object 02:01:16.235 pjsua_core.c SIP UDP socket reachable at 169.254.113.10:5070 02:01:16.235 udp0x13e7e18 SIP UDP transport started, published address is 169.254.113.10:5070 02:01:16.261 pjsua_acc.c Adding account: id=sip:127.0.0.1:5070 02:01:16.261 pjsua_acc.c .Account sip:127.0.0.1:5070 added with id 0 == Adding delegates == Status update, callActive: False, callConnected: False == PJSUA2 started == Making call ***** DtiCall constructor ***** DtiCall constructor done == Status update, callActive: True, callConnected: False 02:01:16.289 pjsua_call.c Making call with acc #0 to sip:127.0.0.1:5060 02:01:16.289 pjsua_aud.c .Set sound device: capture=-1, playback=-2 02:01:16.289 pjsua_aud.c ..Error retrieving default audio device parameters: Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV) [status=420006] 02:01:16.289 call.cpp pjsua_call_make_call(acc.getId(), &pj_dst_uri, param.p_opt, this, param.p_msg_data, &id) error: Unable to find default audio device (PJMEDIA_EAUD_NODEFDEV) (status=420006) [../src/pjsua2/call.cpp:485]
Unhandled Exception: System.ApplicationException: C++ pj::Error exception thrown at PjsipSharp.Call.makeCall (System.String dst_uri, PjsipSharp.CallOpParam prm) [0x00000] in <filename unknown>:0 at DtiVoipSimple.DtiAccount.Call (System.String ipAddress, UInt32 port) [0x00000] in <filename unknown>:0 at DtiVoipSimple.MainClass.Run () [0x00000] in <filename unknown>:0 at DtiVoipSimple.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.ApplicationException: C++ pj::Error exception thrown at PjsipSharp.Call.makeCall (System.String dst_uri, PjsipSharp.CallOpParam prm) [0x00000] in <filename unknown>:0 at DtiVoipSimple.DtiAccount.Call (System.String ipAddress, UInt32 port) [0x00000] in <filename unknown>:0 at DtiVoipSimple.MainClass.Run () [0x00000] in <filename unknown>:0 at DtiVoipSimple.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 =====
As you can see at the bottom, the call is failing because there are apparently no audio devices available. We know that there are none available, the hardware for that is not yet ready and dmesg lists the ALSA device list as empty. I suspect the server may also complain similarly when it tries to accept the call but we haven't got that far yet.
What I'm asking is if it's possible to use PJSIP without audio hardware? While we are using this only for initial testing, it appears to me this is actually a desirable feature should anyone have a system in which the computer itself is supposed to send audio over PJSIP, without an actual speaker orating the message.
Allan Chandler | Software Engineer DTI Group Ltd | Transit Security & Surveillance 31 Affleck Road, Perth Airport, WA 6105, AU P | F | allan.chandler@xxxxxxxxxx
Visit our website www.dti.com.au The information contained in this email is confidential. If you receive this email in error, please inform DTI Group Ltd via the above contact details. If you are not the intended recipient, you may not use or disclose the information contained in this email or attachments. |
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org