Tutorial: PhoneInfo API

In this tutorial you will learn how to use the PhoneInfo API in an app.


Conventions

The used file and class names in this example are based on a newly created App with the name NewApp1 and the company name Company. For testing we use the user admin.
Your filenames might be different according to your settings.

Step by step

Cleanup template

Remove parts you don't need for a hidden App

Make your App a provider of API "com.innovaphone.phoneinfo"

Start providing API "com.innovaphone.phoneinfo" in your main JS file.

Make your App a handler for API messages of "com.innovaphone.phoneinfo"

Add handler function for API messages "CallAdded", "CallUpdated", "CallRemoved".
Keep every call during lifetime in a list.

Database search

Send request to backend on AP to search database as soon as the call reaches certain state.
Add code to handling of "CallUpdated" message.

On App service side you add handling of "Search" message to you CPP code.
Here you should will execute DB query and wait for completion.
To keep this tutorial simple we create a response with some fake information.

Deliver search result to Phone-App

On JS side of you App the function onSearchResult() will be called now.
Make your App a consumer of API "com.innovaphone.phone" and deliver search result to Phone-App using the "CallInfo" message.

Make hidden App is started automatically by Appclient whenever a new call is created

You can make your App hidden by declaring this characteristic in the AppInfo of your App.

You can make your App getting auto-started by declaring your App as provider of an API.
You must do this in the CPP part of your App service on the AppPlatform. Here we declare your App as provider of "com.innovaphone.phoneinfo".
On any call activity the Appclient will auto-start all Apps that are providers of "com.innovaphone.phoneinfo".

Generating more sophisticated context information

Using innovaphone.ui1 to generate HTML

Use innovaphone.ui1.Div and innovaphone.ui1.Node to generate structured HTML which will be passed to Phone-App.
Use texts.text() to have language-dependend text strings on UI.
Add text strings to template1texts.js for every supported language.