Commit 74e18f53 authored by Dele Olajide's avatar Dele Olajide Committed by dele

Rayo Plugin - Added support for tel: uri and fixed webrtc issue for Chrome r31

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13812 b35dd754-fafc-0310-a699-88a17e54d16e
parent 87d0efed
...@@ -98,12 +98,6 @@ ...@@ -98,12 +98,6 @@
if (urlParam("handset")) if (urlParam("handset"))
{ {
sipHandset = urlParam("handset"); sipHandset = urlParam("handset");
if (sipHandset.indexOf("rtmfp:") == 0)
{
tokens = sipHandset.split(":")
rtmpIframe = $("<iframe>").attr("style", "width:1px;height:1px;").attr("src", window.location.protocol + '//' + window.location.host + '/rayo-phone/confphone.swf?rtmpUrl=rtmfp://' + window.location.hostname + '&recieverStream=' + tokens[2] + '&senderStream=' + tokens[1]).appendTo("body");
}
} }
if (domain == "81.201.82.25" && prefix == "sip:") prefix = "sip:883510"; if (domain == "81.201.82.25" && prefix == "sip:") prefix = "sip:883510";
...@@ -217,6 +211,7 @@ ...@@ -217,6 +211,7 @@
window.dialer.setCallLabel('Call'); window.dialer.setCallLabel('Call');
stopTone(); stopTone();
if (rtmpIframe) rtmpIframe.src = "about:blank"
}, },
onAnswer: function(callId, headers) { onAnswer: function(callId, headers) {
...@@ -355,6 +350,13 @@ ...@@ -355,6 +350,13 @@
if (!username) groupname = null; if (!username) groupname = null;
if (sipHandset && sipHandset.indexOf("rtmfp:") == 0)
{
tokens = sipHandset.split(":")
rtmpIframe = document.getElementById("rtmpIframeDIV");
rtmpIframe.src = window.location.protocol + '//' + window.location.host + '/rayo-phone/confphone.swf?rtmpUrl=rtmfp://' + window.location.hostname + '&recieverStream=' + tokens[2] + '&senderStream=' + tokens[1];
}
window.connection.rayo.dial("xmpp:" + window.connection.jid, sipUri, { window.connection.rayo.dial("xmpp:" + window.connection.jid, sipUri, {
codec_name: document.getElementById("codec").value, codec_name: document.getElementById("codec").value,
//group_name: groupname //group_name: groupname
...@@ -399,5 +401,6 @@ ...@@ -399,5 +401,6 @@
<body style="position: absolute; width: 500px: height: 300px;"> <body style="position: absolute; width: 500px: height: 300px;">
<div>Codec<select id="codec"><option value="OPUS"><b>OPUS</b></option><option value="PCMU"><b>PCMU (Ulaw)</b></option></select></div> <div>Codec<select id="codec"><option value="OPUS"><b>OPUS</b></option><option value="PCMU"><b>PCMU (Ulaw)</b></option></select></div>
<span id="status">Loading...</span> <span id="status">Loading...</span>
<iframe id="rtmpIframeDIV" style="width:1px;height:1px;"></iframe>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -498,9 +498,11 @@ Strophe.addConnectionPlugin('rayo', ...@@ -498,9 +498,11 @@ Strophe.addConnectionPlugin('rayo',
var that = this; var that = this;
var codec = (headers && headers.codec_name) ? headers.codec_name : (that.callbacks.codec_name ? that.callbacks.codec_name : "OPUS"); var codec = (headers && headers.codec_name) ? headers.codec_name : (that.callbacks.codec_name ? that.callbacks.codec_name : "OPUS");
var peerConstraints = {'optional': [{'DtlsSrtpKeyAgreement': 'false'}]};
that.pc1 = new webkitRTCPeerConnection(null); that.pc1 = new webkitRTCPeerConnection(null, peerConstraints);
that.pc2 = new webkitRTCPeerConnection(null); that.pc2 = new webkitRTCPeerConnection(null, peerConstraints);
that.pc2.onaddstream = function(e) that.pc2.onaddstream = function(e)
{ {
...@@ -534,6 +536,8 @@ Strophe.addConnectionPlugin('rayo', ...@@ -534,6 +536,8 @@ Strophe.addConnectionPlugin('rayo',
that.pc2.setLocalDescription(desc); that.pc2.setLocalDescription(desc);
var sdpObj2 = WebrtcSDP.parseSDP(desc.sdp); var sdpObj2 = WebrtcSDP.parseSDP(desc.sdp);
//console.log(desc.sdp);
//console.log(sdpObj2);
that.localCrypto = sdpObj2.contents[0].crypto['key-params'].substring(7); that.localCrypto = sdpObj2.contents[0].crypto['key-params'].substring(7);
var sdp = WebrtcSDP.buildSDP(sdpObj2); var sdp = WebrtcSDP.buildSDP(sdpObj2);
//console.log(sdp); //console.log(sdp);
...@@ -921,6 +925,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -921,6 +925,7 @@ Strophe.addConnectionPlugin('rayo',
// representation of candidates, offers and answers // representation of candidates, offers and answers
_parseLine = function(line) { _parseLine = function(line) {
var s1 = line.split("="); var s1 = line.split("=");
return { return {
type: s1[0], type: s1[0],
...@@ -1490,6 +1495,10 @@ Strophe.addConnectionPlugin('rayo', ...@@ -1490,6 +1495,10 @@ Strophe.addConnectionPlugin('rayo',
// Return an object representing the SDP in Jingle like constructs // Return an object representing the SDP in Jingle like constructs
parseSDP: function(sdpString) { parseSDP: function(sdpString) {
//console.log('parseSDP');
//console.log(sdpString);
var contentsObj = {}; var contentsObj = {};
contentsObj.contents = []; contentsObj.contents = [];
var sdpObj = null; var sdpObj = null;
...@@ -1497,7 +1506,11 @@ Strophe.addConnectionPlugin('rayo', ...@@ -1497,7 +1506,11 @@ Strophe.addConnectionPlugin('rayo',
// Iterate the lines // Iterate the lines
var sdpLines = sdpString.split("\r\n"); var sdpLines = sdpString.split("\r\n");
for (var sdpLine in sdpLines) { for (var sdpLine in sdpLines) {
//console.log("parseSDP sdpLines[sdpLine] " + typeof sdpLines[sdpLine]);
//console.log(sdpLines[sdpLine]); //console.log(sdpLines[sdpLine]);
if (typeof sdpLines[sdpLine] != "string") continue;
var line = _parseLine(sdpLines[sdpLine]); var line = _parseLine(sdpLines[sdpLine]);
if (line.type == "o") { if (line.type == "o") {
......
...@@ -412,6 +412,11 @@ if (false) { ...@@ -412,6 +412,11 @@ if (false) {
} else { // telephone number } else { // telephone number
if (toNumber.indexOf("tel:") == 0)
{
toNumber = toNumber.substring(4);
}
voipGateway = proxy; voipGateway = proxy;
Logger.println("Call " + cp + " Using proxy " + proxy + " for " + toNumber); Logger.println("Call " + cp + " Using proxy " + proxy + " for " + toNumber);
} }
......
...@@ -498,9 +498,11 @@ Strophe.addConnectionPlugin('rayo', ...@@ -498,9 +498,11 @@ Strophe.addConnectionPlugin('rayo',
var that = this; var that = this;
var codec = (headers && headers.codec_name) ? headers.codec_name : (that.callbacks.codec_name ? that.callbacks.codec_name : "OPUS"); var codec = (headers && headers.codec_name) ? headers.codec_name : (that.callbacks.codec_name ? that.callbacks.codec_name : "OPUS");
var peerConstraints = {'optional': [{'DtlsSrtpKeyAgreement': 'false'}]};
that.pc1 = new webkitRTCPeerConnection(null); that.pc1 = new webkitRTCPeerConnection(null, peerConstraints);
that.pc2 = new webkitRTCPeerConnection(null); that.pc2 = new webkitRTCPeerConnection(null, peerConstraints);
that.pc2.onaddstream = function(e) that.pc2.onaddstream = function(e)
{ {
...@@ -534,6 +536,8 @@ Strophe.addConnectionPlugin('rayo', ...@@ -534,6 +536,8 @@ Strophe.addConnectionPlugin('rayo',
that.pc2.setLocalDescription(desc); that.pc2.setLocalDescription(desc);
var sdpObj2 = WebrtcSDP.parseSDP(desc.sdp); var sdpObj2 = WebrtcSDP.parseSDP(desc.sdp);
//console.log(desc.sdp);
//console.log(sdpObj2);
that.localCrypto = sdpObj2.contents[0].crypto['key-params'].substring(7); that.localCrypto = sdpObj2.contents[0].crypto['key-params'].substring(7);
var sdp = WebrtcSDP.buildSDP(sdpObj2); var sdp = WebrtcSDP.buildSDP(sdpObj2);
//console.log(sdp); //console.log(sdp);
...@@ -921,6 +925,7 @@ Strophe.addConnectionPlugin('rayo', ...@@ -921,6 +925,7 @@ Strophe.addConnectionPlugin('rayo',
// representation of candidates, offers and answers // representation of candidates, offers and answers
_parseLine = function(line) { _parseLine = function(line) {
var s1 = line.split("="); var s1 = line.split("=");
return { return {
type: s1[0], type: s1[0],
...@@ -1490,6 +1495,10 @@ Strophe.addConnectionPlugin('rayo', ...@@ -1490,6 +1495,10 @@ Strophe.addConnectionPlugin('rayo',
// Return an object representing the SDP in Jingle like constructs // Return an object representing the SDP in Jingle like constructs
parseSDP: function(sdpString) { parseSDP: function(sdpString) {
//console.log('parseSDP');
//console.log(sdpString);
var contentsObj = {}; var contentsObj = {};
contentsObj.contents = []; contentsObj.contents = [];
var sdpObj = null; var sdpObj = null;
...@@ -1497,7 +1506,11 @@ Strophe.addConnectionPlugin('rayo', ...@@ -1497,7 +1506,11 @@ Strophe.addConnectionPlugin('rayo',
// Iterate the lines // Iterate the lines
var sdpLines = sdpString.split("\r\n"); var sdpLines = sdpString.split("\r\n");
for (var sdpLine in sdpLines) { for (var sdpLine in sdpLines) {
//console.log("parseSDP sdpLines[sdpLine] " + typeof sdpLines[sdpLine]);
//console.log(sdpLines[sdpLine]); //console.log(sdpLines[sdpLine]);
if (typeof sdpLines[sdpLine] != "string") continue;
var line = _parseLine(sdpLines[sdpLine]); var line = _parseLine(sdpLines[sdpLine]);
if (line.type == "o") { if (line.type == "o") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment