This API is used for communication with phone/softphone apps. This API is closely related to API "com.innovaphone.phone". If an App provides this API it receives messages "CallAdded" and "CallUpdated" and "CallRemoved". An App can provide call-related display information to the phone app (e.g. about remote party).
The provideApi function is used to subscribe for API messages:
var phoneinfoApi = start.provideApi("com.innovaphone.phoneinfo");
phoneinfoApi.onmessage.attach(function (sender, obj) {
switch (obj.msg.mt) {
case "CallAdded":
break;
case "CallUpdated":
break;
case "CallRemoved":
break;
}
});
Send by Phone-App to all API providers whenever a new call is born.
{
mt: "CallAdded",
id: 1,
guid: "fff79c5bd2115d0109f400903341035b"
}
string mt | message type [mandatory] |
number id | uniqe call-id [mandatory] |
string guid | globally uniqe call-id [optional] |
Send by Phone-App to all API providers whenever call's attributes have changed.
{
mt: "CallUpdated",
id: 1,
guid: "fff79c5bd2115d0109f400903341035b",
dir: "i",
num: "200",
sip: "charlie.chaplin",
dn: "Sir Charles Spencer Chaplin",
state: "Connected"
}
string mt | message type [mandatory] |
number id | uniqe call-id [mandatory] |
string guid | globally uniqe call-id [optional] |
string dir | "i" for inbound call or "o" for outbound call [mandatory] |
string num | Phonenumber (e.g. 202 or +49 7031 73009 0) [optional] |
string sip | SIP-URI (e.g. charlie.chaplin or charlie.chaplin@unitedartists.com) [optional] |
string dn | Displayname [optional] |
string state | Setup | Dialing | Ringback | Queued | Alerting | Connected | Holding | Held | Disconnected [mandatory] |
Send by Phone-App to all API providers whenever a call has died.
{
mt: "CallRemoved",
id: 1,
guid: "fff79c5bd2115d0109f400903341035b"
}
string mt | message type [mandatory] |
number id | uniqe call-id [mandatory] |
string guid | globally uniqe call-id [optional] |
An App can provide call-related display information to the phone app (e.g. about remote party).
See API "com.innovaphone.phone" for details.
var phoneApi = start.consumeApi("com.innovaphone.phone");
var phoneinfoApi = start.provideApi("com.innovaphone.phoneinfo");
phoneinfoApi.onmessage.attach(function (sender, obj) {
switch (obj.msg.mt) {
case "CallAdded":
break;
case "CallUpdated":
if (obj.msg.state == "Connected") {
phoneApi.send({ mt: "CallInfo", id: obj.msg.id, guid: obj.msg.guid, html: "<div>Here's my info</div>" }, obj.consumer);
}
break;
case "CallRemoved":
break;
}
});