1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-12-24 08:28:56 -05:00

Create contact on incoming call if needed

This commit is contained in:
Lance Stout 2013-10-16 00:04:33 -07:00
parent 5ccdc6361b
commit 1cb062631e

View File

@ -338,6 +338,12 @@ module.exports = function (client, app) {
client.on('jingle:incoming', function (session) {
var contact = me.getContact(session.peer);
if (!contact) {
contact = new Contact({jid: client.JID(session.peer).bare});
contact.resources.add({id: session.peer});
me.contacts.add(contact);
}
var call = new Call({
contact: contact,
state: 'incoming',
@ -381,6 +387,11 @@ module.exports = function (client, app) {
client.on('jingle:remotestream:added', function (session) {
var contact = me.getContact(session.peer);
if (!contact) {
contact = new Contact({jid: client.JID(session.peer).bare});
contact.resources.add({id: session.peer});
me.contacts.add(contact);
}
contact.stream = session.stream;
});