|
393 | 393 | callParameters.callType = 2 |
394 | 394 | } |
395 | 395 |
|
| 396 | + // Call to users |
| 397 | + // |
| 398 | + var pushRecipients = []; |
396 | 399 | app.currentSession.call({}, function(error) { |
397 | 400 | if(error) { |
398 | 401 | console.warn(error.detail); |
|
409 | 412 | 'name': app.callees[id], |
410 | 413 | 'state': 'connecting' |
411 | 414 | }); |
| 415 | + pushRecipients.push(id); |
412 | 416 | }); |
413 | 417 |
|
414 | 418 | $('.j-callees').append(videoElems); |
|
418 | 422 | app.helpers.setFooterPosition(); |
419 | 423 | } |
420 | 424 | }); |
| 425 | + |
| 426 | + // and also send push notification about incoming call |
| 427 | + // (corrently only iOS/Android users will receive it) |
| 428 | + // |
| 429 | + var params = { |
| 430 | + notification_type: 'push', |
| 431 | + user: {ids: pushRecipients}, |
| 432 | + environment: 'development', // environment, can be 'production' as well. |
| 433 | + message: QB.pushnotifications.base64Encode(app.caller.full_name + ' is calling you') |
| 434 | + }; |
| 435 | + // |
| 436 | + QB.pushnotifications.events.create(params, function(err, response) { |
| 437 | + if (err) { |
| 438 | + console.log(err); |
| 439 | + } else { |
| 440 | + // success |
| 441 | + console.log("Push Notification is sent."); |
| 442 | + } |
| 443 | + }); |
| 444 | + |
| 445 | + |
421 | 446 | } |
422 | 447 | }); |
423 | 448 | } |
|
582 | 607 | } |
583 | 608 | } |
584 | 609 | }); |
585 | | - |
| 610 | + |
586 | 611 | /** Video recording */ |
587 | 612 | $(document).on('click', '.j-record', function() { |
588 | 613 | var $btn = $(this), |
|
643 | 668 | * - onCallListener |
644 | 669 | * - onCallStatsReport |
645 | 670 | * - onUpdateCallListener |
646 | | - * |
| 671 | + * |
647 | 672 | * - onAcceptCallListener |
648 | 673 | * - onRejectCallListener |
649 | 674 | * - onUserNotAnswerListener |
650 | | - * |
| 675 | + * |
651 | 676 | * - onRemoteStreamListener |
652 | | - * |
| 677 | + * |
653 | 678 | * - onStopCallListener |
654 | 679 | * - onSessionCloseListener |
655 | 680 | * - onSessionConnectionStateChangedListener |
|
681 | 706 | if(recorder) { |
682 | 707 | recorder.pause(); |
683 | 708 | } |
684 | | - |
| 709 | + |
685 | 710 | app.helpers.toggleRemoteVideoView(userId, 'hide'); |
686 | 711 | $('.j-callee_status_' + userId).text('disconnected'); |
687 | 712 |
|
|
692 | 717 | if(recorder) { |
693 | 718 | recorder.resume(); |
694 | 719 | } |
695 | | - |
| 720 | + |
696 | 721 | if(ffHack.waitingReconnectTimer) { |
697 | 722 | clearTimeout(ffHack.waitingReconnectTimer); |
698 | 723 | ffHack.waitingReconnectTimer = null; |
|
0 commit comments