Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSIP plugin: Fixed SRTP-SDES for "process" request and session update #2196

Merged
merged 3 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion html/nosiptest.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ <h3>Demo details</h3>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Caller</h3>
<h3 class="panel-title">Caller
<div class="btn-group btn-group-xs pull-right">
<button class="btn btn-danger" autocomplete="off" id="togglevideo">Disable video</button>
</div>
</h3>
</div>
<div class="panel-body" id="videoleft"></div>
</div>
Expand Down
54 changes: 49 additions & 5 deletions html/nosiptest.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ var opaqueId = Janus.randomString(12);

var spinner = null;

var videoenabled = true;
var srtp = undefined ; // use "sdes_mandatory" to test SRTP-SDES

$(document).ready(function() {
// Initialize the library (all console debuggers enabled)
Janus.init({debug: "all", callback: function() {
Expand Down Expand Up @@ -91,7 +94,7 @@ $(document).ready(function() {
Janus.debug("[caller] Trying a createOffer too (audio/video sendrecv)");
caller.createOffer(
{
// No media provided: by default, it's sendrecv for audio and video
media: {audio: true, video: videoenabled},
success: function(jsep) {
Janus.debug("[caller] Got SDP!", jsep);
// We now have a WebRTC SDP: to get a barebone SDP legacy
Expand All @@ -101,7 +104,8 @@ $(document).ready(function() {
// the SIP plugin uses (mandatory vs. optional). We'll
// get the result in an event called "generated" here.
var body = {
request: "generate"
request: "generate",
srtp: srtp
};
caller.send({ message: body, jsep: jsep });
},
Expand Down Expand Up @@ -172,7 +176,8 @@ $(document).ready(function() {
request: "process",
type: result["type"],
sdp: result["sdp"],
update: result["update"]
update: result["update"],
srtp: srtp
}
callee.send({ message: processOffer });
} else if(event === "processed") {
Expand Down Expand Up @@ -273,6 +278,43 @@ $(document).ready(function() {
$('#videoright .no-video-container').remove();
$('#peervideo').removeClass('hide').show();
}

if(videoenabled) {
$('#togglevideo').html("Disable video").removeClass("btn-success").addClass("btn-danger");
} else {
$('#togglevideo').html("Enable video").removeClass("btn-danger").addClass("btn-success");
}

$('#togglevideo').unbind('click').removeAttr('disabled').click(
function() {
videoenabled = !videoenabled;
var media;
if(videoenabled) {
$('#togglevideo').html("Disable video").removeClass("btn-success").addClass("btn-danger");
media = {addVideo: true};
} else {
$('#togglevideo').html("Enable video").removeClass("btn-danger").addClass("btn-success");
media = {removeVideo: true};
}
caller.createOffer(
{
media: media,
success: function(jsep) {
Janus.debug("[caller] Got UPDATE SDP!");
Janus.debug(jsep);
var body = {
request: "generate",
update: true,
srtp: srtp
};
caller.send({message: body, jsep: jsep});
},
error: function(error) {
Janus.error("WebRTC error:", error);
bootbox.alert("WebRTC error... " + JSON.stringify(error));
}
});
});
},
oncleanup: function() {
Janus.log("[caller] ::: Got a cleanup notification :::");
Expand Down Expand Up @@ -363,7 +405,8 @@ $(document).ready(function() {
// We'll get the result in an event called "generated" here.
var body = {
request: "generate",
update: update
update: update,
srtp: srtp
};
callee.send({ message: body, jsep: jsep });
},
Expand All @@ -385,7 +428,8 @@ $(document).ready(function() {
request: "process",
type: result["type"],
sdp: result["sdp"],
update: result["update"]
update: result["update"],
srtp: srtp
}
caller.send({ message: processAnswer });
}
Expand Down
Loading