WebAPI/AppDefinedTeleophony
For B2G, communication applications likes Skype, lines, ..., etc, will define their own communication protocol for short/instant messages, voice communication, and contact lists. The features of these applications are very similar to telephony, users may like to integrate all of them into one/or several place(s).
For most communication applications, they are comprised by contact, calling history, messaging, and voice/video calling service. For voice/video call, it is very different from one application to another. So, every application should define their owned user interface to accept and initiate a call. But, for contact, calling history, and messages, they are very similar. By integrating contact, calling history, and messages from all applications, the platform can provide better UX that users can browse and search all information at one place.
Following, this page is about changes of ContactsAPI, calling history, and WebSMS
Contacts API
interface ContactField : nsISupports
{
attribute DOMString handler; // the application that can handle voice/video calling and messaging.
attribute DOMURI status; // an status icon as an indication of presence and alike.
attribute DOMString[] type; // for primary/favorite (use:"PREF"), "home", "work", etc.
attribute DOMString value;
};
|handler| and |status| field are added to ContactField interface. With them, the contact app can invoke the correct APP to initiate a voice/video calling or concall. For most IM now, |status| field can be used to show presence and status of a user.
WebSMS
interface SmsManager
{
SmsRequest send(DOMString number, DOMString message);
SmsRequest[] send(DOMString[] number, DOMString message);
unsigned short getNumberOfMessagesForText(in DOMString text);
SMSRequest delete(in long id); // request.result == boolean
SMSRequest delete(in SmsMessage message); // request.result == boolean
SMSRequest getMessage(in long id); // request.result == SMSMessage
SMSRequest getMessages(in SMSFilter filter, bool reverse); // request.result == SMSIterator
SMSRequest markMessageRead(long id, boolean aValue); // request.result == boolean
SmsRequest addArrivedMessage(SmsMessage msg); // IM or Telephony Apps can add a new message as a new arrival.
};
interface SmsMessage
{
readonly attribute long id;
readonly attribute DOMString handler; // the application that can handle the message for replying or sending.
readonly attribute DOMString delivery; // could be "sent" or "received"
readonly attribute DOMString sender;
readonly attribute DOMString receiver;
readonly attribute DOMString body;
readonly attribute Date timestamp;
readonly attribute boolean read;
};
addArrivedMessage() is added to SmsManager to let communication Apps add a message for a new arrival of the message. |handler| is added to SmsMessage to record which application can handle replying the message.
Calling history
There is no API for call history. We need a new API for that. It should have the capability of telling which App can handle an address/number in the calling history.