mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-11-26 03:02:25 -05:00
Create contact on incoming call if needed
This commit is contained in:
parent
5ccdc6361b
commit
1cb062631e
@ -338,6 +338,12 @@ module.exports = function (client, app) {
|
|||||||
|
|
||||||
client.on('jingle:incoming', function (session) {
|
client.on('jingle:incoming', function (session) {
|
||||||
var contact = me.getContact(session.peer);
|
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({
|
var call = new Call({
|
||||||
contact: contact,
|
contact: contact,
|
||||||
state: 'incoming',
|
state: 'incoming',
|
||||||
@ -381,6 +387,11 @@ module.exports = function (client, app) {
|
|||||||
|
|
||||||
client.on('jingle:remotestream:added', function (session) {
|
client.on('jingle:remotestream:added', function (session) {
|
||||||
var contact = me.getContact(session.peer);
|
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;
|
contact.stream = session.stream;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user