From 1cb062631e95304481ecb20cfbffb3f3d931289d Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 16 Oct 2013 00:04:33 -0700 Subject: [PATCH] Create contact on incoming call if needed --- clientapp/helpers/xmppEventHandlers.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clientapp/helpers/xmppEventHandlers.js b/clientapp/helpers/xmppEventHandlers.js index cd94f61..b114e4e 100644 --- a/clientapp/helpers/xmppEventHandlers.js +++ b/clientapp/helpers/xmppEventHandlers.js @@ -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; });