Commit 7692b193 authored by Dele Olajide's avatar Dele Olajide Committed by dele

work-in-progress

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13758 b35dd754-fafc-0310-a699-88a17e54d16e
parent ca711647
......@@ -109,6 +109,9 @@
{
window.connection.rayo.phone(
{
codec_name: "PCMU",
stereo_pan: "0",
offHook: function() {
$("#status").html("Off Hook");
},
......@@ -131,7 +134,7 @@
if (window.candybar.call == null) // ignore when user has active call
{
var cli = headers['caller-name'] ? headers['caller-name']: call.from;
var cli = headers.caller_name ? headers.caller_name : call.from;
window.candybar.setUser({
name: cli,
......@@ -193,7 +196,10 @@
if (prefix == "xmpp:") sipUri = prefix + destination + "@" + domain + "/" + destination;
window.candybar.call = window.connection.rayo.dial("xmpp:" + window.connection.jid, sipUri);
window.candybar.call = window.connection.rayo.dial("xmpp:" + window.connection.jid, sipUri, {
codec_name: "PCMU",
});
window.candybar.setUser({
name: destination,
......
......@@ -132,7 +132,7 @@ Strophe.addConnectionPlugin('rayo',
var that = this;
var mixer = "rayo-mixer-" + Math.random().toString(36).substr(2,9);
var mixer = "rayo-outgoing-" + Math.random().toString(36).substr(2,9);
var callId = "rayo-call-" + Math.random().toString(36).substr(2,9);
if (to.indexOf("xmpp:") == 0)
......@@ -146,7 +146,7 @@ Strophe.addConnectionPlugin('rayo',
{
var iq = $iq({to: "rayo." + that._connection.domain, from: that._connection.jid, type: "get"}).c("dial", {xmlns: Strophe.NS.RAYO_CORE, to: to, from: from});
iq.c("header", {name: "call-id", value: callId}).up();
iq.c("header", {name: "call_id", value: callId}).up();
if (headers)
{
......@@ -212,6 +212,9 @@ Strophe.addConnectionPlugin('rayo',
//console.log('Rayo plugin _offhook1 ' + mixer);
var that = this;
var codec = (headers && headers.codec_name) ? headers.codec_name : (that.callbacks.codec_name ? that.callbacks.codec_name : "OPUS");
that.pc1 = new webkitRTCPeerConnection(null);
that.pc2 = new webkitRTCPeerConnection(null);
......@@ -230,7 +233,12 @@ Strophe.addConnectionPlugin('rayo',
that.pc1.setLocalDescription(desc);
var sdpObj1 = WebrtcSDP.parseSDP(desc.sdp);
if (codec == "PCMU")
sdpObj1.contents[0].codecs = [{clockrate: "8000", id: "0", name: "PCMU", channels: 1}];
else
sdpObj1.contents[0].codecs = [{clockrate: "48000", id: "111", name: "opus", channels: 2}];
var sdp = WebrtcSDP.buildSDP(sdpObj1);
//console.log(sdp);
that.cryptoSuite = sdpObj1.contents[0].crypto['crypto-suite'];
......@@ -257,8 +265,8 @@ Strophe.addConnectionPlugin('rayo',
//console.log('Rayo plugin _offhook2 ' + this.cryptoSuite + " " + this.localCrypto + " " + this.remoteCrypto + " " + mixer);
var that = this;
var stereo = (headers && headers.stereo) ? headers.stereo : "0";
var codec = (headers && headers.codec) ? headers.codec : "OPUS";
var stereo = (headers && headers.stereo_pan) ? headers.stereo_pan : (that.callbacks.stereo_pan ? that.callbacks.stereo_pan : "0");
var codec = (headers && headers.codec_name) ? headers.codec_name : (that.callbacks.codec_name ? that.callbacks.codec_name : "OPUS");
var iq = $iq({to: "rayo." + that._connection.domain, from: that._connection.jid, type: "get"}).c("offhook", {xmlns: Strophe.NS.RAYO_HANDSET, cryptoSuite: that.cryptoSuite, localCrypto: that.localCrypto, remoteCrypto: that.remoteCrypto, codec: codec, stereo: stereo, mixer: mixer});
......@@ -346,7 +354,7 @@ Strophe.addConnectionPlugin('rayo',
var callTo = $(this).attr('to');
var callId = Strophe.getNodeFromJid(from);
var mixer = headers['mixer-name']
var mixer = headers['mixer_name']
var call = {
digit: function(tone) {that.digit(callId, tone);},
......@@ -396,7 +404,14 @@ Strophe.addConnectionPlugin('rayo',
{
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
if (callId.indexOf("rayo-incoming-") == 0)
{
that._onhook();
if (that.callbacks && that.callbacks.onEnd) that.callbacks.onEnd(callId, headers);
}
}
});
......@@ -433,7 +448,7 @@ Strophe.addConnectionPlugin('rayo',
{
var callId = Strophe.getNodeFromJid(from);
if (headers['call-protocol'] == "WebRtc")
if (headers['call_protocol'] == "WebRtc")
{
if (that.callbacks && that.callbacks.offHook) that.callbacks.offHook();
......
......@@ -23,12 +23,6 @@
package com.sun.voip.server;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.session.ClientSession;
import org.jivesoftware.util.JiveGlobals;
import org.xmpp.packet.JID;
import com.sun.voip.CallParticipant;
import com.sun.voip.CallState;
import com.sun.voip.CallEvent;
......@@ -40,6 +34,9 @@ import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.NoSuchElementException;
import java.text.ParseException;
......@@ -48,6 +45,8 @@ import java.util.Collection;
import org.voicebridge.Application;
import org.voicebridge.Config;
import org.ifsoft.rayo.RayoComponent;
/**
* Handle an incoming call. The call is placed into a temporary conference.
......@@ -109,38 +108,12 @@ public class IncomingCallHandler extends CallHandler
System.out.println("Incoming SIP, call " + cp);
Collection<ClientSession> sessions = SessionManager.getInstance().getSessions();
boolean foundUser = false;
for (ClientSession session : sessions)
{
try{
String userId = session.getAddress().getNode();
if (cp.getToPhoneNumber().equals(userId))
{
System.out.println("Incoming SIP, call route to user " + userId);
foundUser = true;
break;
}
} catch (Exception e) { }
}
if (foundUser) // send this call to conf with username and invite user to join with Jingle RTMP
if (RayoComponent.self.routeIncomingSIP(cp))
{
String sid = "incoming-" + String.valueOf(System.currentTimeMillis());
cp.setConferenceId(sid);
haveIncomingConferenceId = true;
CallEvent callEvent = new CallEvent(CallEvent.STATE_CHANGED);
callEvent.setCallState(new CallState(CallState.INCOMING));
callEvent.setInfo(cp.getPhoneNumber());
callEvent.setCallId(sid);
sendCallEventNotification(callEvent);
} else { // conf bridge
} else {
// conf bridge
if (Config.getInstance().getConferenceExten().equals(cp.getToPhoneNumber()))
{
......
......@@ -369,7 +369,7 @@ public class MemberSender {
callHandler.getMember().adjustVolume(dataToSend, outputVolume);
}
dataToSend = normalize(dataToSend);
//dataToSend = normalize(dataToSend);
try {
/*
......
......@@ -380,8 +380,7 @@ public class SipServer implements SipListener {
String from = fromHeader.getAddress().toString();
String to = toHeader.getAddress().toString();
Logger.writeFile("SipServer: duplicate INVITE from "
+ from + " to " + to);
Logger.writeFile("SipServer: duplicate INVITE from " + from + " to " + to);
return;
}
......@@ -434,6 +433,7 @@ public class SipServer implements SipListener {
* we should send back a 500 Internal Server Error
*/
Logger.exception("processRequest", e);
e.printStackTrace();
}
}
......
......@@ -19,7 +19,14 @@ package org.ifsoft.rayo;
import org.dom4j.Element;
import org.dom4j.DocumentHelper;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.session.ClientSession;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.openfire.XMPPServer;
import org.xmpp.packet.JID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmpp.component.ComponentManagerFactory;
......@@ -372,16 +379,21 @@ public class RayoComponent extends AbstractComponent
private IQ handleAcceptCommand(AcceptCommand command, IQ iq)
{
Log.info("RayoComponent handleAcceptCommand " + iq.getFrom() + " " + iq.getTo().getNode());
String callId = iq.getTo().getNode();
Log.info("RayoComponent handleAcceptCommand " + iq.getFrom() + " " + callId);
IQ reply = IQ.createResultIQ(iq);
JID callJID = getJID(callId);
if (callJID != null) // only for XMPP calls
{
Map<String, String> headers = command.getHeaders();
headers.put("call-protocol", "XMPP");
headers.put("call_protocol", "XMPP");
try {
Presence presence = new Presence();
presence.setFrom(iq.getTo());
presence.setTo(JID.unescapeNode(iq.getTo().getNode()));
presence.setTo(callJID);
presence.getElement().add(rayoProvider.toXML(new RingingEvent(null, headers)));
sendPacket(presence);
......@@ -389,22 +401,30 @@ public class RayoComponent extends AbstractComponent
} catch (Exception e) {
reply.setError(PacketError.Condition.item_not_found);
}
}
return reply;
}
private IQ handleAnswerCommand(AnswerCommand command, IQ iq)
{
Log.info("RayoComponent AnswerCommand " + iq.getFrom() + " " + iq.getTo().getNode());
String callId = iq.getTo().getNode();
Log.info("RayoComponent AnswerCommand " + iq.getFrom() + " " + callId);
IQ reply = IQ.createResultIQ(iq);
JID callJID = getJID(callId);
Map<String, String> headers = command.getHeaders();
headers.put("call-protocol", "XMPP");
CallHandler callHandler = null;
if (callJID != null) // XMPP call
{
headers.put("call_protocol", "XMPP");
try {
Presence presence1 = new Presence(); //to caller
presence1.setFrom(iq.getTo());
presence1.setTo(JID.unescapeNode(iq.getTo().getNode()));
presence1.setTo(callJID);
presence1.getElement().add(rayoProvider.toXML(new AnsweredEvent(null, headers)));
sendPacket(presence1);
......@@ -414,13 +434,29 @@ public class RayoComponent extends AbstractComponent
presence2.getElement().add(rayoProvider.toXML(new AnsweredEvent(null, headers)));
sendPacket(presence2);
String handsetId = iq.getTo().getNode(); // use mixer of caller
RelayChannel channel = plugin.getRelayChannel(handsetId);
RelayChannel channel = plugin.getRelayChannel(callId);
if (channel != null)
{
Handset handset = channel.getHandset();
CallHandler callHandler = channel.getCallHandler();
callHandler = channel.getCallHandler();
} else reply.setError(PacketError.Condition.item_not_found);
} catch (Exception e) {
reply.setError(PacketError.Condition.item_not_found);
e.printStackTrace();
}
} else {
callHandler = CallHandler.findCall(callId); // SIP call;
Presence presence = new Presence(); //to called
presence.setFrom(iq.getTo());
presence.setTo(iq.getFrom());
presence.getElement().add(rayoProvider.toXML(new AnsweredEvent(null, headers)));
sendPacket(presence);
}
if (callHandler != null)
{
......@@ -430,23 +466,26 @@ public class RayoComponent extends AbstractComponent
if (cp != null)
{
String username = iq.getFrom().getNode();
ConferenceManager conferenceManager = ConferenceManager.getConference( handset.mixer,
channel.getMediaPreference(),
username, false);
try {
cp.setStartTimestamp(System.currentTimeMillis());
cp.setHeaders(headers);
String recording = handset.mixer + "-" + cp.getStartTimestamp() + ".au";
conferenceManager.recordConference(true, recording, "au");
String recording = cp.getConferenceId() + "-" + cp.getStartTimestamp() + ".au";
ConferenceManager.recordConference(cp.getConferenceId(), true, recording, "au");
String source = (new JID(JID.unescapeNode(iq.getTo().getNode()))).getNode();
String destination = iq.getFrom().getNode();
String source = cp.getName();
if (callJID != null)
{
source = callJID.getNode();
Config.createCallRecord(source, recording, "xmpp:" + iq.getFrom(), cp.getStartTimestamp(), 0, "dialed") ;
Config.createCallRecord(destination, recording, "xmpp:" + callJID, cp.getStartTimestamp(), 0, "received") ;
} else { // incoming SIP
Config.createCallRecord(source, recording, destination, cp.getStartTimestamp(), 0, "dialed") ;
Config.createCallRecord(destination, recording, source, cp.getStartTimestamp(), 0, "received") ;
Config.createCallRecord(destination, recording, "sip:" + cp.getPhoneNumber(), cp.getStartTimestamp(), 0, "received") ;
}
} catch (ParseException e1) {
reply.setError(PacketError.Condition.internal_server_error);
......@@ -455,16 +494,11 @@ public class RayoComponent extends AbstractComponent
} else reply.setError(PacketError.Condition.item_not_found);
} else reply.setError(PacketError.Condition.item_not_found);
} catch (Exception e) {
reply.setError(PacketError.Condition.item_not_found);
e.printStackTrace();
}
return reply;
}
private IQ handleHangupCommand(IQ iq)
{
String callId = iq.getTo().getNode();
......@@ -479,15 +513,17 @@ public class RayoComponent extends AbstractComponent
{
Log.info("RayoComponent handleHangupCommand found callhandler " + callId);
CallHandler.hangup(iq.getTo().getNode(), "User requested call termination");
CallHandler.hangup(callId, "User requested call termination");
} else {
reply.setError(PacketError.Condition.item_not_found);
}
try {
JID otherParty = new JID(JID.unescapeNode(callId));
JID otherParty = getJID(callId);
if (otherParty != null)
{
Log.info("RayoComponent handleHangupCommand found other party " + otherParty);
Presence presence1 = new Presence();
......@@ -495,12 +531,28 @@ public class RayoComponent extends AbstractComponent
presence1.setTo(otherParty);
presence1.getElement().add(rayoProvider.toXML(new EndEvent(null, null)));
sendPacket(presence1);
}
} catch (Exception e) { }
return reply;
}
private JID getJID(String jid)
{
jid = JID.unescapeNode(jid);
if (jid.indexOf("@") == -1 || jid.indexOf("/") == -1) return null;
try {
return new JID(jid);
} catch (Exception e) {
return null;
}
}
private IQ handleDtmfCommand(DtmfCommand command, IQ iq)
{
Log.info("RayoComponent handleDtmfCommand " + iq.getFrom());
......@@ -591,9 +643,9 @@ public class RayoComponent extends AbstractComponent
boolean toPhone = to.indexOf("sip:") == 0 || to.indexOf("tel:") == 0;
boolean toXmpp = to.indexOf("xmpp:") == 0;
String callId = headers.get("call-id");
String callerName = headers.get("caller-name");
String calledName = headers.get("called-name");
String callId = headers.get("call_id");
String callerName = headers.get("caller_name");
String calledName = headers.get("called_name");
String handsetId = iq.getFrom().toString();
......@@ -614,13 +666,13 @@ public class RayoComponent extends AbstractComponent
if (callId == null)
{
callId = "rayo-call-" + System.currentTimeMillis();
headers.put("call-id", callId);
headers.put("call_id", callId);
}
if (callerName == null)
{
callerName = iq.getFrom().getNode();
headers.put("caller-name", callerName);
headers.put("caller_name", callerName);
}
if (toPhone)
......@@ -628,7 +680,7 @@ public class RayoComponent extends AbstractComponent
if (calledName == null)
{
calledName = to;
headers.put("called-name", calledName);
headers.put("called_name", calledName);
}
CallParticipant cp = new CallParticipant();
......@@ -646,7 +698,7 @@ public class RayoComponent extends AbstractComponent
} else if (toXmpp){
headers.put("call-protocol", "XMPP");
headers.put("call_protocol", "XMPP");
String destination = to.substring(5);
String source = JID.escapeNode(handsetId);
......@@ -655,7 +707,8 @@ public class RayoComponent extends AbstractComponent
if (channel != null)
{
headers.put("mixer-name", channel.getHandset().mixer);
headers.put("mixer_name", channel.getHandset().mixer);
headers.put("codec_name", channel.getHandset().codec);
Presence presence = new Presence();
presence.setFrom(source + "@rayo." + getDomain());
......@@ -675,7 +728,7 @@ public class RayoComponent extends AbstractComponent
if (calledName == null)
{
calledName = presence.getTo().getNode();
headers.put("called-name", calledName);
headers.put("called_name", calledName);
}
offer.setHeaders(headers);
......@@ -715,10 +768,10 @@ public class RayoComponent extends AbstractComponent
boolean fromHandset = from.indexOf("handset:") == 0;
String mixer = null;
String callerId = headers.get("caller-id");
String calledId = headers.get("called-id");
String callerName = headers.get("caller-name");
String calledName = headers.get("called-name");
String callerId = headers.get("caller_id");
String calledId = headers.get("called_id");
String callerName = headers.get("caller_name");
String calledName = headers.get("called_name");
JoinCommand join = command.getJoin();
......@@ -901,7 +954,7 @@ public class RayoComponent extends AbstractComponent
public void callEventNotification(com.sun.voip.CallEvent callEvent)
{
Log.info("RayoComponent callEventNotification " + callEvent);
JID from = new JID(callEvent.getCallInfo());
JID from = getJID(callEvent.getCallInfo());
if (from != null)
{
......@@ -923,9 +976,9 @@ public class RayoComponent extends AbstractComponent
Map<String, String> headers = cp.getHeaders();
headers.put("call-id", callEvent.getCallId());
headers.put("mixer-name", callEvent.getConferenceId());
headers.put("call-protocol", cp.getProtocol());
headers.put("call_id", callEvent.getCallId());
headers.put("mixer_name", callEvent.getConferenceId());
headers.put("call_protocol", cp.getProtocol());
Presence presence = new Presence();
presence.setFrom(callEvent.getCallId() + "@rayo." + getDomain());
......@@ -945,16 +998,7 @@ public class RayoComponent extends AbstractComponent
presence.getElement().add(rayoProvider.toXML(new EndEvent(null, EndEvent.Reason.valueOf("HANGUP"), headers)));
sendPacket(presence);
if (cp.getStartTimestamp() > 0)
{
cp.setEndTimestamp(System.currentTimeMillis());
Config.updateCallRecord(cp.getStartTimestamp(), (int)((cp.getEndTimestamp() - cp.getStartTimestamp()) / 1000));
ConferenceManager conferenceManager = ConferenceManager.findConferenceManager(callEvent.getConferenceId());
conferenceManager.recordConference(false, null, null);
cp.setStartTimestamp(0);
}
finishCallRecord(cp);
}
} else if ("250 STARTED SPEAKING".equals(myEvent)) {
......@@ -987,6 +1031,23 @@ public class RayoComponent extends AbstractComponent
}
}
private void finishCallRecord(CallParticipant cp)
{
if (cp.getStartTimestamp() > 0)
{
cp.setEndTimestamp(System.currentTimeMillis());
Config.updateCallRecord(cp.getStartTimestamp(), (int)((cp.getEndTimestamp() - cp.getStartTimestamp()) / 1000));
try {
ConferenceManager conferenceManager = ConferenceManager.findConferenceManager(cp.getConferenceId());
conferenceManager.recordConference(false, null, null);
} catch (Exception e) {}
cp.setStartTimestamp(0);
}
}
public void initiated(String name, String callId)
{
Log.info( "RayoComponent initiated " + name + " " + callId);
......@@ -1072,6 +1133,9 @@ public class RayoComponent extends AbstractComponent
{
UnjoinedEvent event = new UnjoinedEvent(null, conferenceEvent.getConferenceId(), JoinDestinationType.MIXER);
presence.getElement().add(rayoProvider.toXML(event));
finishCallRecord(callParticipant);
} else {
JoinedEvent event = new JoinedEvent(null, conferenceEvent.getConferenceId(), JoinDestinationType.MIXER);
presence.getElement().add(rayoProvider.toXML(event));
......@@ -1100,4 +1164,70 @@ public class RayoComponent extends AbstractComponent
e.printStackTrace();
}
}
private JID findUser(String username)
{
Collection<ClientSession> sessions = SessionManager.getInstance().getSessions();
JID foundUser = null;
for (ClientSession session : sessions)
{
try{
String userId = session.getAddress().getNode();
if (username.equals(userId))
{
Log.info("Incoming SIP, findUser " + session.getAddress());
foundUser = session.getAddress();
break;
}
} catch (Exception e) { }
}
return foundUser;
}
public boolean routeIncomingSIP(CallParticipant cp)
{
Log.info("Incoming SIP, call route to user " + cp.getToPhoneNumber());
JID foundUser = findUser(cp.getToPhoneNumber());
if (foundUser != null) // send this call to user
{
String callId = "rayo-incoming-" + System.currentTimeMillis();
cp.setCallId(callId);
cp.setConferenceId(callId);
cp.setCallOwner(foundUser.toString());
Map<String, String> headers = cp.getHeaders();
headers.put("mixer_name", callId);
headers.put("call_protocol", "SIP");
Presence presence = new Presence();
presence.setFrom(callId + "@rayo." + getDomain());
presence.setTo(foundUser);
OfferEvent offer = new OfferEvent(callId);
try {
offer.setTo(new URI("xmpp:" + foundUser.toString()));
offer.setFrom(new URI("sip:" + cp.getPhoneNumber()));
} catch (URISyntaxException e) {
Log.error("SIP phone nos not URI " + cp.getPhoneNumber() + " " + foundUser);
}
headers.put("called_name", foundUser.getNode());
headers.put("caller_name", cp.getName());
offer.setHeaders(headers);
presence.getElement().add(rayoProvider.toXML(offer));
sendPacket(presence);
}
return foundUser != null;
}
}
......@@ -132,7 +132,7 @@ Strophe.addConnectionPlugin('rayo',
var that = this;
var mixer = "rayo-mixer-" + Math.random().toString(36).substr(2,9);
var mixer = "rayo-outgoing-" + Math.random().toString(36).substr(2,9);
var callId = "rayo-call-" + Math.random().toString(36).substr(2,9);
if (to.indexOf("xmpp:") == 0)
......@@ -146,7 +146,7 @@ Strophe.addConnectionPlugin('rayo',
{
var iq = $iq({to: "rayo." + that._connection.domain, from: that._connection.jid, type: "get"}).c("dial", {xmlns: Strophe.NS.RAYO_CORE, to: to, from: from});
iq.c("header", {name: "call-id", value: callId}).up();
iq.c("header", {name: "call_id", value: callId}).up();
if (headers)
{
......@@ -212,6 +212,9 @@ Strophe.addConnectionPlugin('rayo',
//console.log('Rayo plugin _offhook1 ' + mixer);
var that = this;
var codec = (headers && headers.codec_name) ? headers.codec_name : (that.callbacks.codec_name ? that.callbacks.codec_name : "OPUS");
that.pc1 = new webkitRTCPeerConnection(null);
that.pc2 = new webkitRTCPeerConnection(null);
......@@ -230,7 +233,12 @@ Strophe.addConnectionPlugin('rayo',
that.pc1.setLocalDescription(desc);
var sdpObj1 = WebrtcSDP.parseSDP(desc.sdp);
if (codec == "PCMU")
sdpObj1.contents[0].codecs = [{clockrate: "8000", id: "0", name: "PCMU", channels: 1}];
else
sdpObj1.contents[0].codecs = [{clockrate: "48000", id: "111", name: "opus", channels: 2}];
var sdp = WebrtcSDP.buildSDP(sdpObj1);
//console.log(sdp);
that.cryptoSuite = sdpObj1.contents[0].crypto['crypto-suite'];
......@@ -257,8 +265,8 @@ Strophe.addConnectionPlugin('rayo',
//console.log('Rayo plugin _offhook2 ' + this.cryptoSuite + " " + this.localCrypto + " " + this.remoteCrypto + " " + mixer);
var that = this;
var stereo = (headers && headers.stereo) ? headers.stereo : "0";
var codec = (headers && headers.codec) ? headers.codec : "OPUS";
var stereo = (headers && headers.stereo_pan) ? headers.stereo_pan : (that.callbacks.stereo_pan ? that.callbacks.stereo_pan : "0");
var codec = (headers && headers.codec_name) ? headers.codec_name : (that.callbacks.codec_name ? that.callbacks.codec_name : "OPUS");
var iq = $iq({to: "rayo." + that._connection.domain, from: that._connection.jid, type: "get"}).c("offhook", {xmlns: Strophe.NS.RAYO_HANDSET, cryptoSuite: that.cryptoSuite, localCrypto: that.localCrypto, remoteCrypto: that.remoteCrypto, codec: codec, stereo: stereo, mixer: mixer});
......@@ -346,7 +354,7 @@ Strophe.addConnectionPlugin('rayo',
var callTo = $(this).attr('to');
var callId = Strophe.getNodeFromJid(from);
var mixer = headers['mixer-name']
var mixer = headers['mixer_name']
var call = {
digit: function(tone) {that.digit(callId, tone);},
......@@ -396,7 +404,14 @@ Strophe.addConnectionPlugin('rayo',
{
if ($(this).attr('xmlns') == Strophe.NS.RAYO_CORE)
{
var callId = Strophe.getNodeFromJid(from);
if (callId.indexOf("rayo-incoming-") == 0)
{
that._onhook();
if (that.callbacks && that.callbacks.onEnd) that.callbacks.onEnd(callId, headers);
}
}
});
......@@ -433,7 +448,7 @@ Strophe.addConnectionPlugin('rayo',
{
var callId = Strophe.getNodeFromJid(from);
if (headers['call-protocol'] == "WebRtc")
if (headers['call_protocol'] == "WebRtc")
{
if (that.callbacks && that.callbacks.offHook) that.callbacks.offHook();
......
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