When the nkmedia_kms
backend is selected (either manually, using the backend: "nkmedia_kms"
option when creating the session or automatically, depending on the type), the session types described bellow can be created. Kurento allows two modes for all types: as an offerer or as an offeree.
As an offerer, you create the session without an offer, and instruct Kurento to make one either calling get_offer or using wait_reply: true
in the session creation request. Once you have the answer, you must call set_answer to complete the session.
As an offeree, you create the session with an offer, and you get the answer from Kurento either calling get_answer or using wait_reply: true
in the session creation request.
You can use this session type to place the session at the Kurento mediaserver, without yet sending audio or video, and before updating it to any other type.
The available media updates can also be included in the creation request.
Sample
{
class: "media",
subclass: "session",
cmd: "start",
data: {
type: "park",
offer: {
sdp: "v=0.."
},
wait_reply: true
}
tid: 1
}
-->
{
result: "ok",
data: {
session_id: "54c1b637-36fb-70c2-8080-28f07603cda8",
answer: {
sdp: "v=0..."
}
},
tid: 1
}
Allows to create an echo session, sending the audio and video back to the caller.
Sample
{
class: "media",
subclass: "session",
cmd: "create",
data: {
type: "echo",
offer: {
sdp: "v=0.."
},
wait_reply: true
}
tid: 1
}
Allows to connect two different Kurento sessions together.
Once you have a session of any type, you can start (or switch) any other session and bridge it to the first one through the server. You need to use type bridge and include the field peer_id
pointing to the first one.
It is recommended to use the field master_id
in the new second session, so that it becomes a slave of the first, master session. This way, if either sessions stops, the other will also stop automatically.
The available media updates can also be included in the creation request.
Sample
{
class: "media",
subclass: "session",
cmd: "create",
data: {
type: "bridge",
peer_id: "54c1b637-36fb-70c2-8080-28f07603cda8",
master_id: "54c1b637-36fb-70c2-8080-28f07603cda8",
offer: {
sdp: "v=0.."
},
wait_reply: true
}
tid: 1
}
Allows you to publish a session with audio/video/data to a room, working as an SFU (selective forwarding unit). Any number of listeners can then be connected to this session.
If you don't include a room, a new one will be created automatically. If you include a room, it must already exist.
The available media updates can also be included in the creation request.
Sample
{
class: "media",
subclass: "session",
cmd: "create",
data: {
type: "publish",
offer: {
sdp: "v=0.."
},
wait_reply: true
}
tid: 1
}
-->
{
result: "ok",
data: {
session_id: "54c1b637-36fb-70c2-8080-28f07603cda8",
room: "bbd48487-3783-f511-ee41-28f07603cda8",
answer: {
sdp: "v=0..."
}
},
tid: 1
}
Allows you to listen to a previously started publisher, working as an SFU (selective forwarding unit). You must tell the publisher_id
, and the room will be found automatically.
Sample
{
class: "media",
subclass: "session",
cmd: "create",
data: {
type: "listen",
publisher_id: "54c1b637-36fb-70c2-8080-28f07603cda8",
offer: {
sdp: "v=0..."
},
wait_reply: true
}
tid: 1
}
-->
{
result: "ok",
data: {
session_id: "2052a043-3785-de87-581b-28f07603cda8",
offer: {
answer: "v=0..."
}
},
tid: 1
}
Allows you to reproduce any audio/video file over the session. The file must be encoded using WEBM or MP4. The uri must point to a local or remote file, using http.
The available media updates can also be included in the creation request.
Sample
{
class: "media",
subclass: "session",
cmd: "create",
data: {
type: "play",
uri: "http://files.kurento.org/video/format/sintel.webm",
offer: {
sdp: "v=0.."
},
wait_reply: true
}
tid: 1
}
-->
{
result: "ok",
data: {
session_id: "54c1b637-36fb-70c2-8080-28f07603cda8",
answer: {
sdp: "v=0..."
}
},
tid: 1
}
You can now manage the player using the player_action command. The available actions are:
Action | Description |
---|---|
pause | Pauses the reproduction |
resume | Resumes the reproduction |
get_info | Gets info about the file, length and if seekable. |
get_position | Gets current position |
set_position | Jumps to a specific position (use position: ... ) |
When sending an offer or answer to the backend, it can include all candidates in the SDP or you can use trickle ICE. In this case, you must not include the candidates in the SDP, but use the field trickle_ice: true
. You can now use the commands set_candidate and set_candidate_end to send candidates to the backend.
When Kurento generates and offer or an answer, it will always use trickle ICE by default. You can get the offered candidates listening to the candidate and candidate_end events.
If you do not want to support trickle ICE you can use the options no_offer_trickle_ice
and no_answer_trickle_ice
in the session creation request. NkMEDIA will then buffer all candidates from Kurento, an when either Kurento sends the last candidate event or the trickle_ice_timeout
is fired, all of them will be incorporated in the SDP and offered to you, as if it were generated from Kurento without trickle.
The Kurento backend has full support for SIP.
If the offer you send in has a SIP-like SDP, you must also include the option sdp_type: "rtp"
on it. The generated answer will also be SIP compatible. If you want Kurento to generate a SIP offer, use the sdp_type: "rtp"
parameter in the session creation request. Your answer must also be then SIP compatible.
This backend allows to you perform, at any moment and in all session types, the following media updates:
mute_audio
: Mute the outgoing audio.mute_video
: Mute the outgoing video.mute_data
: Mute the outgoing data channel.bitrate
: Limit the incoming bandwidth (TBD)
Sample
{
class: "media",
subclass: "session",
cmd: "update_media",
data: {
mute_audio: true,
bitrate: 100000
}
tid: 1
}
Kurento allows you to change the session to type to any other type at any moment, calling set_type.
You can for example first park
a call, then include it on a bridge
, then perform a play
.
Kurento offers a very sophisticated session recording mechanism.
At any moment, and in all session types, you can order to start or stop recording of the session, using the recorder_action command.
To start recording, use the start
action. You can also use stop
, pause
and resume
actions.
Sample
{
class: "media",
class: "session",
cmd: "recorder_action",
data: {
session_id: "2052a043-3785-de87-581b-28f07603cda8",
action: start
}
tid: 1
}
TBD: how to access the file
When using the call plugin with this backend, the caller session will be of type park
, and the callee session will have type bridge
, connected to the first. You will get the answer for the callee inmediately.
You can start several parallel destinations, and each of them is a fully independent session.
You can receive and send calls to SIP endpoints.