PJSIP without audio device

AC
Allan Chandler
Mon, Jul 18, 2016 2:32 AM

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@dti.com.au

Visit our website www.dti.com.auhttp://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.

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@dti.com.au Visit our website www.dti.com.au<http://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.
BG
Bill Gardner
Mon, Jul 18, 2016 6:30 AM

Hi Allen, PJSIP provides a null audio device which provides timing for audio media. This is what you want. - Bill

Sent from my iPhone

On Jul 18, 2016, at 4:32 AM, Allan Chandler allan.chandler@dti.com.au wrote:

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@dti.com.au

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@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Allen, PJSIP provides a null audio device which provides timing for audio media. This is what you want. - Bill Sent from my iPhone > On Jul 18, 2016, at 4:32 AM, Allan Chandler <allan.chandler@dti.com.au> wrote: > > 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@dti.com.au > > > > 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@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
AC
Allan Chandler
Wed, Jul 20, 2016 1:40 AM

Thanks for that, Bill.

I've now successfully gotten a client application to talk to a server (in terms of establishing a call), the only main problem being that the server crashes on exit. I'm not too concerned about that yet since it's almost certainly to do with deferred disposal, something the PJSUA2 docs warn about when using non-native bindings. I'll fix it at some point but it's not high on the priority list at the moment.

What I now need to do is to be able to read an audio file (since the hardware has no ALSA devices) on the client and send it over PJSIP to the server, which will then write that data to another file for comparison.

I've found the AudiMediaPlayer stuff but that appears to just be for sending the file to a local sound device whereas I need to send it over the wire to the server.

I suspect from an earlier comment that the NULL sound device just provides timing, that I will need to somehow hook into the timer and send audio data to the call based on that.

So, two questions.

1/ How do I get the client to send audio data to the server? Reading the file is easy, I just need to know how to feed that into the call.

2/ How does this audio show up at the server (e.g., which callback/delegate), so I can write it to a file?

Cheers,
Al.

From: pjsip [mailto:pjsip-bounces@lists.pjsip.org] On Behalf Of Bill Gardner
Sent: Monday, 18 July 2016 2:31 PM
To: pjsip list
Subject: Re: [pjsip] PJSIP without audio device

Hi Allen, PJSIP provides a null audio device which provides timing for audio media. This is what you want. - Bill

Sent from my iPhone

On Jul 18, 2016, at 4:32 AM, Allan Chandler <allan.chandler@dti.com.aumailto:allan.chandler@dti.com.au> wrote:
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@dti.com.aumailto:allan.chandler@dti.com.au

Visit our website www.dti.com.auhttps://linkprotect.cudasvc.com/url?a=http://www.dti.com.au&c=E,1,jOGLXM5O3cPAMMrpY59KmHtAqSBZIDXycdc8J2yjFy7H7QiWWnjigmvERUlZ7VVx-csQ6P_wcgjVbuVXIdOxCn64hSaD1pmboo8w0dapYg-Q_ALN3TLVMpg,&typo=1

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.orghttps://linkprotect.cudasvc.com/url?a=http://blog.pjsip.org&c=E,1,FgWd8mOrY-MrzLndw9JADN2aBG7uFc1j9Qn5Mg5_vgNNCmehbUGWucP8hMAk8DZwQ5e_p_UzcwqrTsqYYfJG9J_sueSeMbxr_D8NNI1EArEiu37rH7g,&typo=1

pjsip mailing list
pjsip@lists.pjsip.orgmailto:pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.orghttps://linkprotect.cudasvc.com/url?a=http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org&c=E,1,_UsJcMd3PmujXA4QSBwUOkbb_b1_py8azo_zkL56WFVUNmGzs53HGAksIe-GQp3Bq3XKOnF1y25MUL8sz2Cy0A8c8gJi0tDnpyj0iYsp9nStPi7xpfUfoUi8rw,,&typo=1

Thanks for that, Bill. I've now successfully gotten a client application to talk to a server (in terms of establishing a call), the only main problem being that the server crashes on exit. I'm not too concerned about that yet since it's almost certainly to do with deferred disposal, something the PJSUA2 docs warn about when using non-native bindings. I'll fix it at some point but it's not high on the priority list at the moment. What I now need to do is to be able to read an audio file (since the hardware has no ALSA devices) on the client and send it over PJSIP to the server, which will then write that data to another file for comparison. I've found the AudiMediaPlayer stuff but that appears to just be for sending the file to a local sound device whereas I need to send it over the wire to the server. I suspect from an earlier comment that the NULL sound device just provides timing, that I will need to somehow hook into the timer and send audio data to the call based on that. So, two questions. 1/ How do I get the client to send audio data to the server? Reading the file is easy, I just need to know how to feed that into the call. 2/ How does this audio show up at the server (e.g., which callback/delegate), so I can write it to a file? Cheers, Al. From: pjsip [mailto:pjsip-bounces@lists.pjsip.org] On Behalf Of Bill Gardner Sent: Monday, 18 July 2016 2:31 PM To: pjsip list Subject: Re: [pjsip] PJSIP without audio device Hi Allen, PJSIP provides a null audio device which provides timing for audio media. This is what you want. - Bill Sent from my iPhone On Jul 18, 2016, at 4:32 AM, Allan Chandler <allan.chandler@dti.com.au<mailto:allan.chandler@dti.com.au>> wrote: 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@dti.com.au<mailto:allan.chandler@dti.com.au> Visit our website www.dti.com.au<https://linkprotect.cudasvc.com/url?a=http://www.dti.com.au&c=E,1,jOGLXM5O3cPAMMrpY59KmHtAqSBZIDXycdc8J2yjFy7H7QiWWnjigmvERUlZ7VVx-csQ6P_wcgjVbuVXIdOxCn64hSaD1pmboo8w0dapYg-Q_ALN3TLVMpg,&typo=1> 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<https://linkprotect.cudasvc.com/url?a=http://blog.pjsip.org&c=E,1,FgWd8mOrY-MrzLndw9JADN2aBG7uFc1j9Qn5Mg5_vgNNCmehbUGWucP8hMAk8DZwQ5e_p_UzcwqrTsqYYfJG9J_sueSeMbxr_D8NNI1EArEiu37rH7g,&typo=1> pjsip mailing list pjsip@lists.pjsip.org<mailto:pjsip@lists.pjsip.org> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org<https://linkprotect.cudasvc.com/url?a=http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org&c=E,1,_UsJcMd3PmujXA4QSBwUOkbb_b1_py8azo_zkL56WFVUNmGzs53HGAksIe-GQp3Bq3XKOnF1y25MUL8sz2Cy0A8c8gJi0tDnpyj0iYsp9nStPi7xpfUfoUi8rw,,&typo=1>
BG
Bill Gardner
Thu, Jul 21, 2016 2:16 PM

Hi Al,

I've never used pjsua2 api, but this is trivially done using pjsua.
You'd create a wav_player, add it to the conference, and then connect
its port to the call port. Then media will stream from the wav file. You
can see the code for pjsua_player_create for example. The other user
agent (the server in your case) will receive the audio as if it came
from a mic recording. Note however that the transmission is not
reliable, there may be packets missing or reconstructed using PLC, and
the audio is encoded/decoded using whatever codec is selected for the
call. If the server is also implemented using pjsip it is easy to
capture the received audio into a wav file using a wav_writer.

Bill

On 7/19/2016 9:40 PM, Allan Chandler wrote:

Thanks for that, Bill.

I've now successfully gotten a client application to talk to a server
(in terms of establishing a call), the only main problem being that
the server crashes on exit. I'm not too concerned about that yet since
it's almost certainly to do with deferred disposal, something the
PJSUA2 docs warn about when using non-native bindings. I'll fix it at
some point but it's not high on the priority list at the moment.

What I now need to do is to be able to read an audio file (since the
hardware has no ALSA devices) on the client and send it over PJSIP to
the server, which will then write that data to another file for
comparison.

I've found the AudiMediaPlayer stuff but that appears to just be for
sending the file to a local sound device whereas I need to send it
over the wire to the server.

I suspect from an earlier comment that the NULL sound device just
provides timing, that I will need to somehow hook into the timer and
send audio data to the call based on that.

So, two questions.

1/ How do I get the client to send audio data to the server? Reading
the file is easy, I just need to know how to feed that into the call.

2/ How does this audio show up at the server (e.g., which
callback/delegate), so I can write it to a file?

Cheers,

Al.

*From:*pjsip [mailto:pjsip-bounces@lists.pjsip.org] *On Behalf Of
*Bill Gardner
Sent: Monday, 18 July 2016 2:31 PM
To: pjsip list
Subject: Re: [pjsip] PJSIP without audio device

Hi Allen, PJSIP provides a null audio device which provides timing for
audio media. This is what you want. - Bill

Sent from my iPhone

On Jul 18, 2016, at 4:32 AM, Allan Chandler <allan.chandler@dti.com.au
mailto:allan.chandler@dti.com.au> wrote:

 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@dti.com.au <mailto:allan.chandler@dti.com.au>

 Visit our website www.dti.com.au
 <https://linkprotect.cudasvc.com/url?a=http://www.dti.com.au&c=E,1,jOGLXM5O3cPAMMrpY59KmHtAqSBZIDXycdc8J2yjFy7H7QiWWnjigmvERUlZ7VVx-csQ6P_wcgjVbuVXIdOxCn64hSaD1pmboo8w0dapYg-Q_ALN3TLVMpg,&typo=1>


 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
 <https://linkprotect.cudasvc.com/url?a=http://blog.pjsip.org&c=E,1,FgWd8mOrY-MrzLndw9JADN2aBG7uFc1j9Qn5Mg5_vgNNCmehbUGWucP8hMAk8DZwQ5e_p_UzcwqrTsqYYfJG9J_sueSeMbxr_D8NNI1EArEiu37rH7g,&typo=1>

 pjsip mailing list
 pjsip@lists.pjsip.org <mailto:pjsip@lists.pjsip.org>
 http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
 <https://linkprotect.cudasvc.com/url?a=http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org&c=E,1,_UsJcMd3PmujXA4QSBwUOkbb_b1_py8azo_zkL56WFVUNmGzs53HGAksIe-GQp3Bq3XKOnF1y25MUL8sz2Cy0A8c8gJi0tDnpyj0iYsp9nStPi7xpfUfoUi8rw,,&typo=1>

Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Al, I've never used pjsua2 api, but this is trivially done using pjsua. You'd create a wav_player, add it to the conference, and then connect its port to the call port. Then media will stream from the wav file. You can see the code for pjsua_player_create for example. The other user agent (the server in your case) will receive the audio as if it came from a mic recording. Note however that the transmission is not reliable, there may be packets missing or reconstructed using PLC, and the audio is encoded/decoded using whatever codec is selected for the call. If the server is also implemented using pjsip it is easy to capture the received audio into a wav file using a wav_writer. Bill On 7/19/2016 9:40 PM, Allan Chandler wrote: > > Thanks for that, Bill. > > I've now successfully gotten a client application to talk to a server > (in terms of establishing a call), the only main problem being that > the server crashes on exit. I'm not too concerned about that yet since > it's almost certainly to do with deferred disposal, something the > PJSUA2 docs warn about when using non-native bindings. I'll fix it at > some point but it's not high on the priority list at the moment. > > What I now need to do is to be able to read an audio file (since the > hardware has no ALSA devices) on the client and send it over PJSIP to > the server, which will then write that data to another file for > comparison. > > I've found the AudiMediaPlayer stuff but that appears to just be for > sending the file to a local sound device whereas I need to send it > over the wire to the server. > > I suspect from an earlier comment that the NULL sound device just > provides timing, that I will need to somehow hook into the timer and > send audio data to the call based on that. > > So, two questions. > > 1/ How do I get the client to send audio data to the server? Reading > the file is easy, I just need to know how to feed that into the call. > > 2/ How does this audio show up at the server (e.g., which > callback/delegate), so I can write it to a file? > > Cheers, > > Al. > > *From:*pjsip [mailto:pjsip-bounces@lists.pjsip.org] *On Behalf Of > *Bill Gardner > *Sent:* Monday, 18 July 2016 2:31 PM > *To:* pjsip list > *Subject:* Re: [pjsip] PJSIP without audio device > > Hi Allen, PJSIP provides a null audio device which provides timing for > audio media. This is what you want. - Bill > > Sent from my iPhone > > > On Jul 18, 2016, at 4:32 AM, Allan Chandler <allan.chandler@dti.com.au > <mailto:allan.chandler@dti.com.au>> wrote: > > 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@dti.com.au <mailto:allan.chandler@dti.com.au> > > Visit our website www.dti.com.au > <https://linkprotect.cudasvc.com/url?a=http://www.dti.com.au&c=E,1,jOGLXM5O3cPAMMrpY59KmHtAqSBZIDXycdc8J2yjFy7H7QiWWnjigmvERUlZ7VVx-csQ6P_wcgjVbuVXIdOxCn64hSaD1pmboo8w0dapYg-Q_ALN3TLVMpg,&typo=1> > > > 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 > <https://linkprotect.cudasvc.com/url?a=http://blog.pjsip.org&c=E,1,FgWd8mOrY-MrzLndw9JADN2aBG7uFc1j9Qn5Mg5_vgNNCmehbUGWucP8hMAk8DZwQ5e_p_UzcwqrTsqYYfJG9J_sueSeMbxr_D8NNI1EArEiu37rH7g,&typo=1> > > pjsip mailing list > pjsip@lists.pjsip.org <mailto:pjsip@lists.pjsip.org> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > <https://linkprotect.cudasvc.com/url?a=http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org&c=E,1,_UsJcMd3PmujXA4QSBwUOkbb_b1_py8azo_zkL56WFVUNmGzs53HGAksIe-GQp3Bq3XKOnF1y25MUL8sz2Cy0A8c8gJi0tDnpyj0iYsp9nStPi7xpfUfoUi8rw,,&typo=1> > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org