[Pkg-voip-commits] [janus] 74/282: Added support for outbound proxies to the SIPre plugin
Jonas Smedegaard
dr at jones.dk
Wed Dec 20 21:53:29 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.2.6-1
in repository janus.
commit 6d3e2511c111a81d5c008f0a05c3d474691c8b8c
Author: Lorenzo Miniero <lminiero at gmail.com>
Date: Wed Jun 21 16:38:57 2017 +0200
Added support for outbound proxies to the SIPre plugin
---
html/sipretest.js | 9 +++++++++
plugins/janus_sipre.c | 12 ++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/html/sipretest.js b/html/sipretest.js
index 3f7a40c..24f8292 100644
--- a/html/sipretest.js
+++ b/html/sipretest.js
@@ -423,6 +423,13 @@ function registerUsername() {
$('#password').attr('disabled', true);
$('#register').attr('disabled', true).unbind('click');
$('#registerset').attr('disabled', true);
+ // Let's see if the user provided a server address
+ // NOTE WELL! Even though the attribute we set in the request is called "proxy",
+ // this is actually the _registrar_. If you want to set an outbound proxy (for this
+ // REGISTER request and for all INVITEs that will follow), you'll need to set the
+ // "outbound_proxy" property in the request instead. The two are of course not
+ // mutually exclusive. If you set neither, the domain part of the user identity
+ // will be used as the target of the REGISTER request the plugin might send.
var sipserver = $('#server').val();
if(sipserver !== "" && sipserver.indexOf("sip:") != 0 && sipserver.indexOf("sips:") !=0) {
bootbox.alert("Please insert a valid SIP server (e.g., sip:192.168.0.1:5060)");
@@ -542,6 +549,8 @@ function registerUsername() {
});
} else {
register["proxy"] = sipserver;
+ // Uncomment this if you want to see an outbound proxy too
+ register["outbound_proxy"] = "sip:192.168.1.80:5080";
sipcall.send({"message": register});
}
}
diff --git a/plugins/janus_sipre.c b/plugins/janus_sipre.c
index e2bc2ba..3966181 100644
--- a/plugins/janus_sipre.c
+++ b/plugins/janus_sipre.c
@@ -3655,13 +3655,17 @@ void janus_sipre_mqueue_handler(int id, void *data, void *arg) {
break;
}
JANUS_LOG(LOG_VERB, "[SIPre-%s] Sending REGISTER\n", session->account.username);
+ /* Check if there is an outbound proxy to take into account */
+ const char *outbound_proxy[1];
+ outbound_proxy[0] = session->account.outbound_proxy;
/* Check if there are custom headers to add */
char *headers = (char *)payload->data;
/* Send the REGISTER */
int err = sipreg_register(&session->stack.reg, session->stack.sipstack,
session->account.proxy,
session->account.identity, session->account.identity, session->stack.expires,
- session->account.username, NULL, 0, 0,
+ session->account.username,
+ outbound_proxy, (outbound_proxy[0] ? 1 : 0), 0,
janus_sipre_cb_auth, session, FALSE,
janus_sipre_cb_register, session, NULL, (headers ? headers : ""), NULL);
g_free(headers);
@@ -3696,6 +3700,9 @@ void janus_sipre_mqueue_handler(int id, void *data, void *arg) {
janus_sipre_mqueue_payload *payload = (janus_sipre_mqueue_payload *)data;
janus_sipre_session *session = (janus_sipre_session *)payload->session;
JANUS_LOG(LOG_VERB, "[SIPre-%s] Sending INVITE\n%s", session->account.username, session->temp_sdp);
+ /* Check if there is an outbound proxy to take into account */
+ const char *outbound_proxy[1];
+ outbound_proxy[0] = session->account.outbound_proxy;
/* Check if there are custom headers to add */
char *headers = (char *)payload->data;
/* Convert the SDP into a struct mbuf */
@@ -3707,7 +3714,8 @@ void janus_sipre_mqueue_handler(int id, void *data, void *arg) {
session->callee,
session->account.display_name, session->account.identity,
session->account.username,
- NULL, 0, "application/sdp", mb,
+ outbound_proxy, (outbound_proxy[0] ? 1 : 0),
+ "application/sdp", mb,
janus_sipre_cb_auth, session, FALSE,
janus_sipre_cb_offer, janus_sipre_cb_answer,
janus_sipre_cb_progress, janus_sipre_cb_established,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/janus.git
More information about the Pkg-voip-commits
mailing list