Capturing raw audio data from a SIP call

Yury Pogrebnyak

New Member
I'm using SIP as RTMP feature to forward audio data from a SIP call to RTMP server. However it seems that audio is pre-converted as .flv. Is there a way to get raw audio (which is u-law encoded in my case) directly from WCS or probably on RTMP server side?
 

Max

Administrator
Staff member
You can place file media_transponder.sdp inside the WCS_HOME/conf directory.
See attached example. This config uses G.711 audio codec for RTMP re-publishing.
Once you have placed the config, you have to restart WCS server to apply changes.
Is there a way to get raw audio (which is u-law encoded in my case) directly from WCS or probably on RTMP server side?
Do you mean record PCM16 raw audio file on WCS end or just play the audio stream?
To play stream you can use REST API parameter toStream when you create a new call:
Code:
/call/startup
{
"toStream":"stream1",
...
}
Here you map SIP call to internally publishing stream "stream1", and this stream can be played by stream name using Player example:
https://wcs5-eu.flashphoner.com/client2/examples/demo/streaming/player/player.html

REST API docs:
https://flashphoner.com/docs/wcs5/wcs_docs/html/en/wcs-rest-api/index.html?api_methods.htm
 
Last edited:

Yury Pogrebnyak

New Member
You can place file media_transponder.sdp inside the WCS_HOME/conf directory.
See attached example. This config uses G.711 audio codec for RTMP re-publishing.
Once you have placed the config, you have to restart WCS server to apply changes.
Thank you, but I don't see any attached files
Do you mean record PCM16 raw audio file on WCS end or just play the audio stream?
I need to save (e.g. record) audio from a sip call in original format, G.711 in my case. I need to record chunks real-time, that's why I'm looking into rtmp streaming. My only issue is I need original audio format, not converted one.
 

Max

Administrator
Staff member
media_transponder.sdp
Code:
v=0
o=- 1988962254 1988962254 IN IP4 0.0.0.0
c=IN IP4 0.0.0.0
t=0 0
a=sdplang:en
m=video 0 RTP/AVP 95 96
a=rtpmap:95 H264/90000
a=fmtp:95 profile-level-id=42e01f;packetization-mode=0
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42e01f;packetization-mode=1
a=recvonly
m=audio 0 RTP/AVP 8 0
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=recvonly
 

Max

Administrator
Staff member
I need to save (e.g. record) audio from a sip call in original format, G.711 in my case. I need to record chunks real-time, that's why I'm looking into rtmp streaming. My only issue is I need original audio format, not converted one.
WCS does not dump audio in original formats. This means you can't record raw G.711 bytes.
However you can try to record PCM16 wav file.
It is raw decoded audio and you can encode this audio to G.711 anytime using a converter like Sox.
Steps to record raw pcm16.

1. Configure flashphoner.properties
#Here we set folder for wav files
record=/tmp
#Here we enable audio recording on streams
record_audio_processor_pcm=true

2. Make a call.
Code:
/call/startup
{
"toStream":"stream1"
...
}
4. Make sure you have recorded wav files in /tmp directory

5. Re-publish your stream1 to RTMP.
Code:
/push/startup
{
"streamName":"stream1",
"rtmpUrl":"rtmp://host:1935/live"
}
 

Max

Administrator
Staff member
One last question is what is the configuration to get ulaw instead of alaw?
Try to change priority to:
Code:
m=audio 0 RTP/AVP 0 8
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
or remove alaw at all
Code:
m=audio 0 RTP/AVP 0
a=rtpmap:0 PCMU/8000
 
Top