Picture of nickname
Registered 2 years 263 days
nickname Monday, 9 May 2022, 02:05 AM
How to push client app in the foreground on incoming call?
Dear innovaphone forum,

What is the intended way of pushing my app (the user hasnt started the app at this point) in the foreground on an incoming call in the softphone app?

Has it something to do with the "wake" in the AppInfo?

A jsruntime solution is preferred.
Andreas Fink
Moderator Registered 12 years 279 days
Andreas Fink (innovaphone) Monday, 9 May 2022, 03:59 PM
Re: How to push client app in the foreground on incoming call?
Hello Nick,

"wake" is sent by PBX to the myApps client.


To start your app when a call occurs, your App must provide the API com.innovaphone.phoneinfo ( https://sdk.innovaphone.com/web1/com.innovaphone.phoneinfo/com.innovaphone.phoneinfo.htm ).

Afterwards the method bringToFront from the lib1 library ( https://sdk.innovaphone.com/13r2/web1/lib1/lib1.htm ) can be used when CallAdded info is sent to your app.

Best Regards
Andreas Fink
Picture of Daniel 450
Registered 14 years 36 days
Daniel 450 Tuesday, 10 May 2022, 08:36 PM
Re: How to push client app in the foreground on incoming call?
Hello Andreas,

all the links you send us we consumed days before and thought the same. But sorry, we didn´t know how to realise it with these documentation.

We saw in the browser console, that we got only an wake if the softphone app which had to be set as default phone app is closed:
recv from pbx: {"mt":"Wake","type":"phone","outgoing":false}
outherwise no wake is shown in the browser console.
Then we see there an "outgoing: false" and not like in the docu an "incomming: boolean". And i understand the docu, that only the standard app react to the wake "The client starts an app if the app is selected as the standard app for the corresponding wake type" https://sdk.innovaphone.com/13r2/doc/appwebsocket/myApps.htm#Wake

Here https://sdk.innovaphone.com/13r2/doc/appgeneric.htm#config-apis we see for the config.json

"<htm filename of the app>": {

"<name of the API>": {

"info": object,

}

"presence": bool/string,

"hidden": bool

}

vs.

"apis": {

"manufacturer-appname": {

"com.innovaphone.phoneinfo": {phoneinfo

"info": {}

},

"presence": true,

"hidden": true

},

"manufacturer-appname-admin": {

"com.manufacturer.someapi": {

"info": {}

},

}

}


I think we we have to kill the "phoneinfo" after "com.innovaphone.phoneinfo: {"

We also tried it after "hidden..." with an "wake": ["phone"], but that also doesn´t work.


And then we saw the show(applink)

https://sdk.innovaphone.com/13r2/web1/lib1/lib1.htm, but like you discribed, we had first to trigger to open app.


When our the serverside JavaScript App is started, we can react on changes off the integrated com.innovaphone.phoneinfo, but no reaction to start automaticaly the app.


I hope you can close our knowledge gap with an JS Runtime example how to "autostart" an app when a phonecall is incomming.

Andreas Fink
Moderator Registered 12 years 279 days
Andreas Fink (innovaphone) Thursday, 12 May 2022, 10:47 AM
Re: How to push client app in the foreground on incoming call?
Hello Daniel,

> I think we we have to kill the "phoneinfo" after "com.innovaphone.phoneinfo: {"

yes, this is a typo in the documentation, I will remove it.

Your config.json should look like this:

{
    "javascript": {
        "eval": [
            "innovaphone-jsautostartexampleservice.js"
        ]
    },
    "apis": {
        "innovaphone-jsautostartexample": {
            "com.innovaphone.phoneinfo": {
                "info": {}
            }
        }
    }
}

To check if your app provides the API look into the UpdateAppsInfo message on the myApps cleint console:

{
    "mt": "UpdateAppsInfo",
    "app": {
        "info": {
            "apis": {
                "com.innovaphone.phoneinfo": {
                    "info": {}
                }
            }
        },
        "name": "jsautostartexample",
        "title": "jsautostartexample",
        "url": "https://172.31.29.123/jsautostartexample/innovaphone-jsautostartexample"
    }
}


In the client code you have to add following to make sure your app provides the com.innovaphone.phoneinfo API:

var phoneinfoApi = start.provideApi("com.innovaphone.phoneinfo");
phoneinfoApi.onmessage.attach(function (sender, obj) {
    switch (obj.msg.mt) {
        case "CallAdded":
            console.warn(obj.msg.mt);
            console.log(obj.msg);
            break;
        case "CallUpdated":
            console.warn(obj.msg.mt);
            console.log(obj.msg);
            // show app if call is in connected state
            if (obj.msg.state === "Connected") start.show();
            break;
        case "CallRemoved":
            console.warn(obj.msg.mt);
            console.log(obj.msg);
            // show home screen after the call is ended
            start.home();
            break;
    }
}); 

And forget about wake - it is only a protocol between PBX and myApps client, where you have no direct access to.

Best Regards
Andreas Fink


Picture of Daniel 450
Registered 14 years 36 days
Daniel 450 Friday, 27 May 2022, 01:32 PM
1 of 1 users consider this post helpful
Re: How to push client app in the foreground on incoming call?
Hello Andreas,

sorry for my late answer, when the focus is not on the "wake" the error research is much easyer. We had the "same" code, but in one line innovaphone was written wrong. It works good since one day after your answer.
Thank you.
← You can define your color theme preference here