mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-11-28 20:22:15 -05:00
refine, send directed presence before session-accept
This commit is contained in:
parent
4b04d706fe
commit
9f6f45eb30
@ -431,12 +431,15 @@ module.exports = function (client, app) {
|
|||||||
contact.callState = '';
|
contact.callState = '';
|
||||||
contact.jingleCall = null;
|
contact.jingleCall = null;
|
||||||
contact.onCall = false;
|
contact.onCall = false;
|
||||||
|
if (me.calls.length == 1) { // this is the last call
|
||||||
|
client.jingle.stopLocalMedia();
|
||||||
|
client.jingle.localStream = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('jingle:accepted', function (session) {
|
client.on('jingle:accepted', function (session) {
|
||||||
var contact = me.getContact(session.peer);
|
var contact = me.getContact(session.peer);
|
||||||
contact.callState = 'activeCall';
|
contact.callState = 'activeCall';
|
||||||
console.log('jingle accepted...');
|
|
||||||
contact.onCall = true;
|
contact.onCall = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -231,20 +231,21 @@ module.exports = BasePage.extend({
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
//if (!(this.model.jingleCall && this.model.jingleCall.jingleSession)) return;
|
|
||||||
this.$('button.accept').prop('disabled', true);
|
this.$('button.accept').prop('disabled', true);
|
||||||
if (this.model.jingleCall.jingleSession.state == 'pending') {
|
if (this.model.jingleCall.jingleSession.state == 'pending') {
|
||||||
if (!client.jingle.localStream) {
|
if (!client.jingle.localStream) {
|
||||||
client.jingle.startLocalMedia(null, function (err) {
|
client.jingle.startLocalMedia(null, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
this.model.jingleCall.end({
|
self.model.jingleCall.end({
|
||||||
condition: 'decline'
|
condition: 'decline'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
client.sendPresence({to: client.JID(self.model.jingleCall.jingleSession.peer) });
|
||||||
self.model.jingleCall.jingleSession.accept();
|
self.model.jingleCall.jingleSession.accept();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
client.sendPresence({to: client.JID(this.model.jingleCall.jingleSession.peer) });
|
||||||
this.model.jingleCall.jingleSession.accept();
|
this.model.jingleCall.jingleSession.accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,13 +254,14 @@ module.exports = BasePage.extend({
|
|||||||
handleEndClick: function (e) {
|
handleEndClick: function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var condition = 'success';
|
var condition = 'success';
|
||||||
if (this.model.jingleCall && this.model.jingleCall.jingleSession &&
|
if (this.model.jingleCall) {
|
||||||
this.model.jingleCall.jingleSession.state == 'pending') {
|
if (this.model.jingleCall.jingleSession && this.model.jingleCall.jingleSession.state == 'pending') {
|
||||||
condition = 'decline';
|
condition = 'decline';
|
||||||
}
|
}
|
||||||
this.model.jingleCall.end({
|
this.model.jingleCall.end({
|
||||||
condition: condition
|
condition: condition
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
handleMuteClick: function (e) {
|
handleMuteClick: function (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user