2013-10-15 15:15:25 -04:00
|
|
|
/*global app, me, client*/
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var _ = require('underscore');
|
|
|
|
var HumanModel = require('human-model');
|
|
|
|
var logger = require('andlog');
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = HumanModel.define({
|
|
|
|
type: 'call',
|
2013-10-16 13:48:00 -04:00
|
|
|
initialize: function (attrs) {
|
|
|
|
this.contact.onCall = true;
|
2013-10-16 16:44:24 -04:00
|
|
|
// temporary, this won't stay here
|
2014-12-10 05:25:19 -05:00
|
|
|
app.navigate('/chat/' + encodeURIComponent(this.contact.jid));
|
2013-10-16 13:48:00 -04:00
|
|
|
},
|
2013-10-15 15:15:25 -04:00
|
|
|
session: {
|
2013-10-15 19:21:22 -04:00
|
|
|
contact: 'object',
|
2013-10-15 15:15:25 -04:00
|
|
|
jingleSession: 'object',
|
|
|
|
state: ['string', true, 'inactive'],
|
|
|
|
multiUser: ['boolean', true, false]
|
2013-10-16 13:48:00 -04:00
|
|
|
},
|
|
|
|
end: function (reasonForEnding) {
|
|
|
|
var reason = reasonForEnding || 'success';
|
|
|
|
this.contact.onCall = false;
|
|
|
|
if (this.jingleSession) {
|
2013-10-16 16:13:29 -04:00
|
|
|
this.jingleSession.end(reasonForEnding);
|
2013-10-16 13:48:00 -04:00
|
|
|
}
|
|
|
|
this.collection.remove(this);
|
2013-10-15 15:15:25 -04:00
|
|
|
}
|
|
|
|
});
|