Skip to content
Draft
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
13 changes: 13 additions & 0 deletions conf/janus.plugin.sip.jcfg.sample
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,17 @@ general: {
# engine (default 32000 milliseconds)
sip_timer_t1x64 = 32000

# In case you want to configure the SIP plugin to create a trunk with
# an external provider or PBX (e.g., to automatically receive all
# INVITEs meant for a range of addresses without the need for users
# to perform any REGISTER), uncomment and fill the following section
# with the related configuration info. Notice that, in order to have
# users use the trunk, you'll need to use the 'trunk' register type:
# regular REGISTER won't work with the trunk. See the documentation
# for more info on what this means and how it works.
#sip_trunk = {
# local = "0.0.0.0:5090"
# peer = "1.2.3.4:5060"
#}

}
1 change: 1 addition & 0 deletions html/demos/sip.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ <h3>Demo details</h3>
<a class="dropdown-item" href='#' id='secret'>Register using plain secret</a>
<a class="dropdown-item" href='#' id='ha1secret'>Register using HA1 secret</a>
<a class="dropdown-item" href='#' id='guest'>Register as a guest (no secret)</a>
<a class="dropdown-item" href='#' id='trunk'>Register as trunk user (no secret)</a>
</ul>
</div>
</div>
Expand Down
37 changes: 13 additions & 24 deletions html/demos/sip.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ $(document).ready(function() {
$('.dropdown-toggle').dropdown('hide');
selectedApproach = $(this).attr("id");
$('#registerset').html($(this).html()).parent().removeClass('open');
if(selectedApproach === "guest") {
if(selectedApproach === "guest" || selectedApproach === "trunk") {
$('#password').empty().attr('disabled', true);
} else {
$('#password').removeAttr('disabled');
Expand All @@ -70,7 +70,10 @@ $(document).ready(function() {
bootbox.alert("Using this approach might not work with Asterisk because the generated HA1 secret could have the wrong realm");
break;
case "guest":
bootbox.alert("Using this approach you'll try to REGISTER as a guest, that is without providing any secret");
bootbox.alert("Using this approach you'll be marked as a guest, so no REGISTER will be sent");
break;
case "trunk":
bootbox.alert("Using this approach you'll be associated with a trunk (if available), so no REGISTER will be sent");
break;
default:
break;
Expand Down Expand Up @@ -751,20 +754,22 @@ function registerUsername() {
$('#registerset').removeAttr('disabled');
return;
}
if(selectedApproach === "guest") {
// We're registering as guests, no username/secret provided
if(selectedApproach === "guest" || selectedApproach === "trunk") {
// We're registering as guests or trunk users, no username/secret provided
let register = {
request: "register",
type: "guest"
type: selectedApproach
};
if(sipserver !== "") {
register["proxy"] = sipserver;
// Uncomment this if you want to see an outbound proxy too
// Uncomment this if you want to see an outbound proxy too;
// notice that it will be ignored for trunk users (the trunk
// peer will be automatically marked as the outbound proxy to use)
//~ register["outbound_proxy"] = "sip:outbound.example.com";
}
let username = $('#username').val();
if(!username === "" || username.indexOf("sip:") != 0 || username.indexOf("@") < 0) {
bootbox.alert("Please insert a valid SIP address (e.g., sip:goofy@example.com): this doesn't need to exist for guests, but is required");
bootbox.alert("Please insert a valid SIP address (e.g., sip:goofy@example.com): this doesn't need to exist for " + selectedApproach + "s, but is required");
$('#server').removeAttr('disabled');
$('#username').removeAttr('disabled');
$('#authuser').removeAttr('disabled');
Expand All @@ -778,23 +783,7 @@ function registerUsername() {
if(displayname) {
register.display_name = displayname;
}
if(sipserver === "") {
bootbox.confirm("You didn't specify a SIP Registrar to use: this will cause the plugin to try and conduct a standard (<a href='https://tools.ietf.org/html/rfc3263' target='_blank'>RFC3263</a>) lookup. If this is not what you want or you don't know what this means, hit Cancel and provide a SIP Registrar instead'",
function(result) {
if(result) {
sipcall.send({ message: register });
} else {
$('#server').removeAttr('disabled');
$('#username').removeAttr('disabled');
$('#authuser').removeAttr('disabled');
$('#displayname').removeAttr('disabled');
$('#register').removeAttr('disabled').click(registerUsername);
$('#registerset').removeAttr('disabled');
}
});
} else {
sipcall.send({ message: register });
}
sipcall.send({ message: register });
return;
}
let username = $('#username').val();
Expand Down
Loading