Code Monkey home page Code Monkey logo

ionic-plugin-callkit's People

Contributors

manur avatar taracque avatar vadimdez avatar vinceops avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ionic-plugin-callkit's Issues

Fallback to pushkit

I know that you actually already made a pushkit plugin called VoIP Push, so why not integrate into this plugin as a fallback?

Native views not visible on Android

Hi,

Thank you for this great plugin! I have a question, I am able to report an incoming call and I hear the audio / vibration. However, the native android call view is not visible. I just see my app and hear the sound. Do I have to grant permissions or something?

I run the app on a Android device, viaionic cordova run android

Kind regards,

Marcel

Handling calls from the native dialer

Firstly, thanks for publishing this. It works pretty nicely.

In iOS at least, a contact can be selected from the native dialer's call list, which reports the event to the VoIP app. But, it doesn't seem to forward any data about the contact that was clicked.

Is this already available or currently planned in your roadmap? If not planned, I would appreciate guidance on how to go about integrating and I'd be happy to submit a PR.

Thanks

CallKit plug-in doesn't work

CallKit plug-in doesn't work when integrated in an Ionic 3 App (tested on Android phone).

Issue
When an incoming call comes - Incoming call, its ending, its deferring, etc never gets detected and no event written in callkit plugin gets fired!!!

Note: CallKit & BackgroundMode instance gets created successfully.

call-kit

Here are the integration steps.

Ionic Project Integration Steps

  1. Generate new ionic 3 app.
  2. Add cordova plugin "ionic-plugin-callkit"
  3. Add cordova plugin "cordova-plugin-background-mode"

CallKit Plugin Integration Steps

  1. Generate "CallKitService" class:
import { Injectable } from '@angular/core';
import { Platform } from 'ionic-angular';
declare const CallKit;

@Injectable()
export class CallKitService {
   private callUUID: string;
   private callKit: any;

   constructor(platform: Platform) {
      if (platform.is("ios") || platform.is("android") || platform.is("windows")) {
         this.callUUID = "";
         this.callKit = new CallKit();
      }
   }

   /**
   * Determine whether the plugin is available.
   *
   * @return {boolean} `true` if the plugin is available.
   */
   private hasCallKit() {
      return typeof CallKit !== "undefined" && this.callKit;
   }

   /**
   * Wrapper for functions which cannot be executed without the plugin.
   *
   * @param {Function} fn Function to be called only if plugin is available.
   *
   * @return {Function} A function running `fn` (with its arguments), if plugin is available.
   */
   private execWithPlugin(fn) {
      return function () {
         if (!this.hasCallKit()) {
            console.error('callkit plugin not available');
            return;
         }

         fn.apply(this, Array.prototype.slice.call(arguments));
      };
   }

   register(callChanged, audioSystem) {
      if (typeof CallKit !== "undefined") {
         this.callKit = new CallKit();
         this.callKit.register(callChanged, audioSystem);
      }
   }

   reportIncomingCall(name, params) {
      this.callKit.reportIncomingCall(name, params, (uuid) => {
         this.callUUID = uuid;
      });
   }


   askNotificationPermission() {
      // only useful on iOS 9, as we use local notifications to report incoming calls
      this.callKit.askNotificationPermission();
   }

   startCall(name, isVideo) {
      this.callKit.startCall(name, isVideo, (uuid) => {
         this.callUUID = uuid;
      });
   }

   callConnected(uuid) {
      this.callKit.callConnected(this.callUUID);
   }

   endCall(notify) {
      this.callKit.endCall(this.callUUID, notify);
   }

   finishRing() {
      this.callKit.finishRing();
   }
}

  1. In app.component.ts constructor
import { CallKitService } from '../services/call-kit.service';
declare const cordova;

platform.ready().then(() => {
         // Okay, so the platform is ready and our plugins are available.
         // Here you can do any higher level native things you might need.
         statusBar.styleDefault();
         splashScreen.hide();

         (<any>cordova).plugins.backgroundMode.setDefaults({ title: "Test", text: "Test" });
         (<any>cordova).plugins.backgroundMode.enable();
         callKitService.register(that.callChanged, that.audioSystem);
      });

   callChanged(data) {
      console.log("onCallChanged: " + JSON.stringify(data));
   }

   audioSystem(data) {
      console.log("onAudioSystem: " + JSON.stringify(data));
   }

display video view on iosApp upon call accept

First of all.. Thank you very much for this fantastic plugin making it easier to integrate the callKit.
I could successfully integrate my cordova App with this plugin in iOS platform.

I was able to bring up the incoming call screen when a call is received and was able to accept the call and start talking with the caller. Further, I was able to display the video when the user clicks on the app icon on the call screen.

My question:

Can we display the video immediately after the user accepts the call without the need for the user to click on the app icon? If not, the user may not notice that the call is a video call and continue with the audio call only.

incoming call question

Hi @Taracque ,

Great plugin!
I would like to ask about "callChanged" function of CallKit.register.
Is it detect every incoming call (like if somebody calling my phone from another phone) or just the plugin managed calls (if i call the myCallKit.startCall(name,isVideo,onSuccess) method ) ?

Thank You :)

non ionic project

Hi!
I love to use the plugin in my non ionic project (non angular) for detecting incoming and outgoing calls on iOS.
I imported <Cordova/CDV.h> in the myAppName-Bridging-Header.h ( #import <Cordova/CDV.h> )
If I understood well I have to use the following codes in the deviceready listener:

/// Register

CallKit.register(onCallChanged, onAudioSystem);

onCallChanged = function(data){
console.log("onCallChanged: "+JSON.stringify(data));
};
onAudioSystem = function(data){
console.log("onAudioSystem: "+JSON.stringify(data));
};

/// incomeingCall

CallKit.prototype.reportIncomingCall(name,params,onSuccess);

name = function(name){
console.log("name: "+JSON.stringify(name));
};
params = function(params){
console.log("params: "+JSON.stringify(params));
};
onSuccess = function(onSuccess){
console.log("onSuccess: "+JSON.stringify(onSuccess));
};

Did I misunderstand something ?
Because from some reason the callback not fired at all :(

onVideoError: NSConcreteNotification

Thanks for this great plugin. I'm using it with WebRTC to make video calls. The problem is that when receiving calls on my iPhone, I get the following error. When I get rid of CallKit the error doesn't occur. Do you know what might be causing this?

onVideoError: NSConcreteNotification 0x17464fa20 {name = AVCaptureSessionRuntimeErrorNotification; object = <AVCaptureSession: 0x17000d8a0 [AVCaptureSessionPreset640x480]>; userInfo = {
    AVCaptureSessionErrorKey = "Error Domain=AVFoundationErrorDomain Code=-11800 \"The operation could not be completed\" UserInfo={NSUnderlyingError=0x170452180 {Error Domain=NSOSStatusErrorDomain Code=-12785 \"(null)\"}, NSLocalizedFailureReason=An unknown error occurred (-12785), NSLocalizedDescription=The operation could not be completed}";
}}

First incoming call does not call startAudio; it has no audio

Description

It seems like there's a handoff problem on the first incoming call between AudioToolbox and the CallKit delegate in this plugin.

Scenarios

❌ On the first incoming call after app initialization, no audio either way.

✔️ On the next and any incoming call, audio works both ways.

✔️ If the first call is an outgoing call, audio works on first and any successive calls.

Errors and logs

I've spent a lot of time debugging, and this particular line seems to indicate a handoff error between AudioToolbox and the app:

Apr 14 15:33:15 MyCallingApp(AudioToolbox)[2246] <Error>: 892: failed: 'ent?' (enable 3, outf< 1 ch, 44100 Hz, Int16> inf< 1 ch, 44100 Hz, Int16>)

The full log for the no-audio scenario on a first incoming call is here, with this error:
https://gist.github.com/manur/46c885c20257b634a34dc24324dff55f

Here's a comparative log for a later incoming call that connects correctly, where this error does not occur:
https://gist.github.com/manur/ebd81e0cb931026909cdc44d03749b07

Integration details

ionic-plugin-callkit is used in a Cordova app. The callChanged handler is used to start the audio for a call. The audioSystem callback is not used for anything right now. Also not sure how to use that callback, since it doesn't return a call UUID to start or stop audio for. Would appreciate guidance if this usage is just wrong

callKit.register(function(obj) {
        console.log("call-kit:register:call-changed", JSON.stringify(obj));
        var call = softphone.findCallByUUID(obj.uuid);

        if(obj.hasStartedConnecting && !obj.hasConnected && !obj.hasEnded) {
          if(!call.get('started')) {
              call.accept();
          }
        }
        /* other call logic for call termination etc. */

}, function(obj) {
        console.log("call-kit:register:audio-system", JSON.stringify(obj));
});

cc @sgibbons

"reportIncomingCall" not working inside setTimeout

Hi,

First, thanks for this plugin, it works beautifully :-).

Platform & versions
cordova 6.5
cordova-ios 4.3.1
iOS 10.2+
iPhone 5

Issue
Today I ran into my first problem: using iOS, I noticed that if I send my app to the background (simply by pushing the iphone "home" button), before an expected call to callKit.reportIncomingCall, then nothing happens when my iPhone is waiting on the iOS home screen (I'd like it to display the Incoming call screen).
I thought about the app being in 'pause' state... However, I can see my logs (console.log shown in the Safari debugger) made while the app is in the background, meaning (I guess) that my javascript code is still running...
As soon as I get back into my app, the call is immediatly reported (the CallKit screen appears, and the device vibrates).

Is there anything I did wrong here?
In the device logs, I can see the following (at the expected time, yet nothing happens):

May 10 18:06:14 iPhone-Dev MyApp(CallKit)[369] : Provider <CXXPCProvider: 0x762abf0> was asked to report a new incoming call with UUID: 130...... (etc, truncated)

I added console logging from the beginning of my process up to callKit.reportIncomingCall(). I can see all logs up to this point. Yet the call screen never shows... (until I take the app back to the foreground).

I cannot reproduce the issue on Android (everything is working perfectly).

Thanks!

Android Call Kit Native

We are implementing this plugin code into Native app(Without ionic) but we are not able to get the Native Caller screen using reportincomingcall method.

Invoking reportIncomingCall is multiple stopAudio responses

Hi there. I'm getting only "stopAudio" responses when calling reportIncomingCall. Am I missing something? Success function is called and has a UUID.

this.callKit.reportIncomingCall("Testing this", false, function(uuid){
  console.log("iOS Incoming call: "+uuid);

  that.callKitUUID = uuid;
});

How calls work (compose a number, bind an ID, etc..)

Hello. I don't understand how to choose who call.
I saw that I can choose just "Name", and the system take the first with that name.
This way is a bit rough...

  1. I can choose by phone number?
  2. Does the app is automatically bind to the mobile phone on which it is installed?
  3. Is it possible to call a number outside the app? I mean, I'd like to start a real native call from my app, just to monitor call info (duration, star time etc.)

Thank you

Error installing plugin

cordova plugin add https://github.com/Taracque/ionic-plugin-callkit.git
Error: Failed to fetch plugin https://github.com/Taracque/ionic-plugin-callkit via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 4294963228 Error output:
npm ERR! addLocal Could not install ...\AppData\Local\Temp\npm-6976-5685b142\git-cache-1f5128bf\3bc112b9e6fbc8fedad103b6ff998ce20799cea6
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "https://github.com/Taracque/ionic-plugin-callkit" "--save"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code EISDIR
npm ERR! errno -4068
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

nav.push not working when app is inactive and locked in ios

Hi,
i am facing issues with the nav.push in ios
when the app is inactive and the screen is locked i recieve a voip notification which in turn wakes up my app and the piece of javascript runs but as soon as i accept the call through the callkit nav.push never gets executed.

Upgrade plugin to swift 3

I'm getting a lot of errors when using this plugin with my ionic application (which uses by default swift 3)

Duplicated Call-kit Instances

Hello, fellow partners, I've been using this plugin for a while now, and it works flawlessly. The only issue I've encountered was when I refreshed my app (hot code push), call-kit instances will be duplicated.

I'm using Meteor 1.5 and the latest version of the plugin.

Below is the code I'm rocking with. I've also attached a video sample, showing the issue.

https://vimeo.com/227741568

function onDeviceReady() {
   callUUID = '';
   callKit = null;

   function callChanged(data) {
     console.log("onCallChanged: " + JSON.stringify(data));
   }

   function audioSystem(data) {
     console.log("onAudioSystem: " + JSON.stringify(data));
   }

   callKit = new CallKit();
   callKit.register(callChanged, audioSystem);

   incomingCall = function() {
     this.callKit.reportIncomingCall('Incoming call', {
       supportsVideo: false,
       supportsGroup: false,
       supportsUngroup: false,
       supportsDTMF: false,
       supportsHold: false
     }, function(uuid) {
       this.callUUID = uuid;
       console.log('call reported. returned uuid: ' + uuid);
     });
   }
}

ios background audio only connection breaks on second time

Hi,

we got one single case, where the apps breaks:

We recieve an incoming call with a locked iPhone and do NOT enter the Videomode ( of our app )
instead we have an audio only connection, which we sooner or later "hang up".
If we get a second call, without starting our app in between - we get errors.
We think it has sth. to do wir our videocallModal, which gets only presented if we go in the app to the foreground, If we dont do this, we are not able to dismiss it and therefore we don't close our connection properly, and the second call will fail.

I know this is probably more realeted to our framwork ( ionic3 ) then this plugin, but maybe one of u guys hat the same case, and got some valuable hints ;)

regards,

Kevin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.