= ~~How to Record Audio with pjsua~~ (moved) = **Moved to https://docs.pjsip.org/en/latest/specific-guides/audio-troubleshooting/problems/how_to_record.html** pjsua can record any audio coming into the conference bridge to a WAV or MP3 file (MP3 file recording is only available on Win32 though). But for reporting audio problems, it's best to use a WAV file instead of MP3 so that we can be perfectly sure that the original signal is not altered by MP3 encoding. To record audio with pjsua: 1. Run pjsua with additional {{{--rec-file}}} argument: {{{ $ ./pjsua --rec-file OUTPUT.WAV }}} 1. You should see that the file has been registered to the conference bridge with {{{cl}}} command: {{{ >>> cl Conference ports: Port #00[16KHz/10ms] Primary Sound Capture Driver transmitting to: Port #01[16KHz/10ms] OUTPUT.WAV transmitting to: }}} 1. Make a call and establish media as usual. 1. When the call is established, normally you will have the call is "connected" to the sound device in the bridge. This can be confirmed with the {{{cl}}} command below: {{{ cl Conference ports: Port #00[16KHz/10ms] Primary Sound Capture Driver transmitting to: #2 Port #01[16KHz/10ms] OUTPUT.WAV transmitting to: Port #02[16KHz/20ms] sip:user@localhost transmitting to: #0 }}} 1. All you need to do now is connect whatever port you want to record to the OUTPUT.WAV port. For example, if you want to record the audio from remote call to the WAV, this command would achieve that: {{{ >>> cc 2 1 09:40:08.969 conference.c Port 2 (sip:user@localhost) transmitting to port 1 (OUTPUT.WAV) Success }}} 1. You can also, for example, record the audio from the microphone to the WAV file: {{{ >>> cc 0 1 09:40:47.894 conference.c Port 0 (Primary Sound Capture Driver) transmitting to port 1 (OUTPUT.WAV) Success }}} In this case, the audio from both the call and the microphone will be first mixed in the conference bridge before it is recorded to the WAV file. 1. Now both the audio from the remote call and the audio from the microphone will be recorded to the WAV file. You can confirm this with {{{cl}}} command: {{{ >>> cl Conference ports: Port #00[16KHz/10ms] Primary Sound Capture Driver transmitting to: #2 #1 Port #01[16KHz/10ms] OUTPUT.WAV transmitting to: Port #02[16KHz/20ms] sip:user@localhost transmitting to: #0 #1 }}} As you can see from above output, both the sound device (port 0) and the call (port 2) are both transmitting to the WAV file, thus output from both will be mixed and recorded to the WAV file. 1. Note that when debugging audio problem, it's probably best '''not''' to mix the audio from the problematic source with other sources so that we can be clear about the source of the problem.