Multi Channel Recording - ngmediaserver/NG-Media-Server GitHub Wiki
Multi-Channel Call Recording
multi-channel call recording enables to isolate the voice of each participant on separate channels, empowering finer and more powerful Speech and A.I. processing post calls. This feature requires NGMS 7.3 or higher.
Number of Channels
Currently, up to 16 channels can be created, however it is recommended to keep the numbers of channels as low as possible to avoid unnecessary CPU overhead. Typically, for phone calls, 2 channels are required, to track individually each participant. This number can be increased to 3 if we consider including a separate channel to track call whispering or possible audio prompts. And to 4 if we include both.
-
Number of channels - by configuration:
In the Administration UI (Media Store > Channels) or in the configuration database (media_store.json, FormatAudioChannels), the default number of Channels used for call recording can be set. Possible values are 1 for Mono (default value), 2.
-
Number of channels - by API:
the client application can specify the number of channels to allocate when it starts a new record, with the optional Channels parameter.
>> Sample request to record using 2 channels:
{ "method":"POST", "path":"/calls/{callId}/recordMedias", "body": { "Uri":"test.m3u8", "Channels":2 } }
Channel selection
When using multiple channels, it is possible to assign the channel used by each participant of a conference call.
The channel is a 1-based index.
Warning: with mono recording, all participants are recorded in the one and only one channel. The Channel selection (RecordChannel parameter) is ignored with mono recording.
With multiple channels recording, the Channel selection is effective.
-
Channel selection - by configuration:
When recording using multiple channels, if the channels are not set by API, by default the channel 1 is assigned to the call on which the call recording was requested and channel 2 is assigned to the conference participant calls.
-
Channel selection - by API:
When making a new outgoing call, when accepting or answering an incoming call, an application can indicate the recording channel assigned to the call using the RecordChannel parameter.
>> Sample requests indicating to use the recording channel #1 on make call, accept call and answer call:
{ "method":"POST", "path":"/calls", "body": { "ToUri":"callto:2001", "RecordChannel":1 } } { "method":"POST", "path":"/calls/{callId}/accept", "body": { "RecordChannel":1 } } { "method":"POST", "path":"/calls/{callId}/answer", "body": { "RecordChannel":1 } }
The recording channel can also be changed at any time, with a recordMediaSetChannel request, indicate the recording channel using the RecordChannel parameter.
>> Sample request indicating to use the recording channel #2:
{ "method":"POST", "path":"/calls/{callId}/recordMediaSetChannel", "body": { "RecordChannel":2 } }
RecordChannelPlay
The RecordChannel parameter enables to set the recording channel assigned to the Audio received on the call (= audio from the remote participant = « Network RX » stream).
The RecordChannelPlay parameter enables to set the recording channel assigned to the Audio played on the call (= audio file played on the call = « Media TX » stream). If RecordChannelPlay is not defined, the value of RecordChannel is then used. RecordChannelPlay gives the opportunity to use distinct channels for the « Media TX » and « Network RX » stream.
Mono Tracks tagging
When recording using multiple channels, the WAVE segments generated include the WAVEFORMATEXTENSIBLE extension with dwChannelMask set to 0 to tag the channels as representing multiple mono tracks rather than the speaker positions of a spatial sound.
This tagging is helpful when playing back audio files, because if the file needs to be converted to mono, the volume adjustment of each channel is performed differently whether channels represent multiple mono tracks or a spatial sound (Stereo, Dolby Surround, ...).
Playback
NGMS 7.3+ enables to playback multi-channel records over calls.
Based on the Mono Tracks tagging, NGMS can distinguish multiple mono tracks from spatial sounds. With spatial sounds, only standard Stereo files are supported (Left and Right speaker positions).
Currently, NGMS handles calls with RTP streams in mono format, so multi-channel files are always internally converted to mono before being played.
When playing back a file, an application can select which channels are played using the optional ChannelMask parameter. When not specified, all channels are played. When specified the ChannelMask is a string representing a bit mask of the channels to include and exclude, with character 1 representing a channel to include and character 0 representing a channel to exclude. For example "1101" indicates that only channels #1, #3 and #4 are to be included.
>> Sample requests indicating to playback only channel #2:
{ "method":"POST", "path":"/calls/{callId}/playMedias", "body":{ "Uri":"test.m3u8", "ChannelMask":"10" } }
When a file playback completes (whether normally or because a stop command was requested), the duration of the file playback up to the completion is reported using the Duration parameter.
<< Sample notification indicating that the playback stopped after a playback duration of 20.78 seconds:
{ "method":"DELETE", "path":"/calls/-1/playMedias/-15", "body":{ "State":"completed", "Success":false, "Comment":"007 cancelled", "Duration":20.78 } }
Third party tools to replay Multi-Channel Call Recording
- The NG Media utility ngmsconv can be used to convert recorded multi channel audio files from HLS to WAVE
- To play the recorded WAVE files on a PC, we recommend to use Audacity which supports multiple channels correctly and enables to see and manage each channel individually.
- Warning: some multimedia players indicate that they do not support the format of the WAVE file, when there are 3 or more channels, like Windows "Multimedia Player" or "Windows Media Player".
- Warning: some multimedia players accept WAVE files with 3 or more channels, but only play a limited number of channels (like VLC seems to play only the first 3 channels)
Licensing
Multi-Channel Call Recording accounts for 1 extra license for one audio channel (NGMS-BAUDIO):
- 1x Call (SIP or WebRTC protocol) without Call Recording is accounted as using 1x license for one audio channel (NGMS-BAUDIO).
- 1x Call (SIP or WebRTC protocol) using Call Recording is accounted as using 2x licenses for one audio channel (NGMS-BAUDIO).