WebAPI/WebTelephony: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 19: Line 19:
     attribute boolean speaker;
     attribute boolean speaker;
    
    
     attribute any active; // Either a session or a group
     readonly attribute any active; // Either a session or a group
    
    
     attribute sequence<TelephonySession> sessions;
     readonly attribute sequence<TelephonySession> sessions;
     attribute sequence<TelephonySessionGroup> groups;
     readonly attribute sequence<TelephonySessionGroup> groups;
    
    
     attribute Function onincoming;
     attribute Function onincoming;
Line 28: Line 28:
    
    
   interface TelephonySession : EventTarget {
   interface TelephonySession : EventTarget {
     readonly DOMString number;
     readonly attribute DOMString number;
    
    
     readonly attribute DOMString readyState; // "calling", "incomming", "connected", "closed"
     readonly attribute DOMString readyState; // "calling", "incomming", "connected", "closed"
Line 37: Line 37:
     attribute TelephonySessionGroup? group;
     attribute TelephonySessionGroup? group;
    
    
     answer(); // Should this make the session the active one?
     void answer(); // Should this make the session the active one?
     hangUp();
     void hangUp();
   
   
     void sendTone(DOMString dtmfTones);
     void startTone(DOMString tone);
    void stopTone();
 
    void sendTones(DOMString tones,
                  [optional] unsigned long toneDuration,
                  [optional] unsigned long intervalDuration);
   }
   }
    
    

Revision as of 22:27, 26 August 2011

Goals

Our first goal is to create a low-level API for "plain" telephony. I.e. not SIP or other VoIP calls. This is because plain telephony is still the main use case for most users. While we long term will want to have APIs for things like SIP, it's likely that those APIs will look substantially different since the capabilities there are much more advanced.

It's possible that we will want to have a higher level API which abstracts over POTS and VoIP, but that's something we should focus on once we have the lower level pieces in place. See also the discussion here.

Status

There are some rudamentory patches in bug 674726, but they don't implement much of what we need yet.

Proposed API

navigator.telephony would return an object with the following interface

 interface Telephony : EventTarget {
   TelephonySession connect(DOMString number); // Should this make the session the active one?
 
   attribute boolean mute; // Should these live on the session/group?
   attribute boolean speaker;
 
   readonly attribute any active; // Either a session or a group
 
   readonly attribute sequence<TelephonySession> sessions;
   readonly attribute sequence<TelephonySessionGroup> groups;
 
   attribute Function onincoming;
 }
 
 interface TelephonySession : EventTarget {
   readonly attribute DOMString number;
 
   readonly attribute DOMString readyState; // "calling", "incomming", "connected", "closed"
   // Can we get info on when a call goes from "trying to place call" to "calling"?
   attribute Function onconnect;
   attribute Function ondisconnect;
 
   attribute TelephonySessionGroup? group;
 
   void answer(); // Should this make the session the active one?
   void hangUp();

   void startTone(DOMString tone);
   void stopTone();
   void sendTones(DOMString tones,
                  [optional] unsigned long toneDuration,
                  [optional] unsigned long intervalDuration);
 }
 
 [Constructor()]
 interface TelephonySessionGroup {
   getter TelephonySession item(unsigned long index);
   readonly attribute unsigned long length;
 }
 
 interface IncommingCallEvent : Event {
   attribute TelephonySession session;
 }