Republishing a SIP call to an RTMP stream to the given server (SIP as RTMP function)¶
Overview¶
A SIP call made through the WCS server can be captured to an RTMP stream and rebroadcast to the specified RTMP server when the call is created. One usage example is publishing a call to Facebook or Youtube.
Operation flowchart¶
- The browser starts a call by sending the /call/startup REST query.
- WCS connects to the SIP server
- The SIP server sends the RTP stream of the call to WCS
- WCS connects to the RTMP server
- The RTMP server receives the RTMP stream
Quick manual on testing¶
-
For the test we use:
- two SIP accounts;
- a softphone to answer the call;
- the REST client in the Chrome browser;
- the RTMP server to receive the broadcast;
- the Player web application to play the stream from the RTMP server.
-
Open the REST client. Send
/call/startup
to the WCS server and specify in the parameters of the query the following data:- parameters of your SIP account the call is made from
- URL of the RTMP server the call is republished to, in this case specify the URL of the WCS server
- the name of the stream to rebroadcast the call to (the
rtmpStream
parameter), for example,rtmp_stream1
- the name of your second SIP account where the call is made to
-
Receive and answer the call on the softphone:
-
Open the Player web application. Specify the URL of the RTMP server and the name of the RTMP stream the call is redirected to, then click the
Play
button. The call starts playing:
-
Terminate the call in the softphone.
Call flow¶
Below is the call flow when using the SIP as RTMP example to create a call
-
Sending the
/call/startup
REST query:
sendREST()
code
function startCall() { ... var url = field("restUrl") + "/call/startup"; callId = generateCallID(); $("#sipCallId").val(callId); ... var RESTCall = {}; RESTCall.toStream = field("rtmpStream"); RESTCall.hasAudio = field("hasAudio"); RESTCall.hasVideo = field("hasVideo"); RESTCall.callId = callId; RESTCall.sipLogin = field("sipLogin"); RESTCall.sipAuthenticationName = field("sipAuthenticationName"); RESTCall.sipPassword = field("sipPassword"); RESTCall.sipPort = field("sipPort"); RESTCall.sipDomain = field("sipDomain"); RESTCall.sipOutboundProxy = field("sipOutboundProxy"); RESTCall.appKey = field("appKey"); RESTCall.sipRegisterRequired = field("sipRegisterRequired"); for (var key in RESTCall) { setCookie(key, RESTCall[key]); } RESTCall.callee = field("callee"); var data = JSON.stringify(RESTCall); sendREST(url, data); startCheckCallStatus(); }
-
Establishing a connection to the SIP server
-
Receiving confirmation from the SIP server
-
The RTP stream is sent to the WCS server
-
Publishing of the RTMP stream on the RTMP server
-
The RTMP stream is passed to the RTMP server
-
Sending the
/call/terminate
REST query:
sendREST()
code
-
Sending the command to the SIP server
-
Receiving confirmation from the SIP server
Known issues¶
1. Stream captured from SIP call cannot be played, if RTP session is not initialized for this stream.¶
Symptoms
SIP stream is published on server, but can not be played.
2. SIP callee does not recognize DTMF signals if audio data generation is no enabled¶
Symptoms
SIP callee does not recognize PIN code sent as DTMF
Solution
Enable audio and video data generation for SIP call with the following parameter
3. Freezes may occur, audio may be out of sync with video when republishing a SIP call stream as RTMP¶
Symptoms
Freezes and audio/video out of sync are observed while playing an RTMP stream republished from a SIP call
Solution
a) in WCS builds before 5.2.1541 add the delay to audio/video generator start
b) update WCS to build 5.2.1541 where the issue was fixed
4. RTP traffic buffering should be enabled in some cases when republishing SIP as Stream or SIP as RTMP¶
Symptoms
Audio and video may be out of sync when playing a SIP call RTMP stream