WebAPI/WebTelephony: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:


   interface Telephony : EventTarget {
   interface Telephony : EventTarget {
    TelephonyCall dial(DOMString number); // Returns a object in "dialing" state
     attribute boolean muted;          // Should these live on the call/group?
     attribute boolean muted;          // Should these live on the call/group?
     attribute boolean speakerOn;
     attribute boolean speakerOn;
Line 24: Line 25:
   }
   }
    
    
  [Constructor(DOMString)]
   interface TelephonyCall : EventTarget {
   interface TelephonyCall : EventTarget {
     readonly attribute DOMString number;
     readonly attribute DOMString number;
    
    
     readonly attribute DOMString readyState; // "calling", "incomming", "connected", "closed", "busy"
     readonly attribute DOMString readyState;
    // Can we get info on when a call goes from "trying to place call" to "calling"?
    // "dialing", "ringing", "busy", "connecting", "connected", "disconnecting", "disconnected", "incoming"
     attribute Function onconnect;
 
     attribute Function ondisconnect;
     attribute Function onreadystatechange;
     attribute Function onringing;
     attribute Function onbusy;
     attribute Function onbusy;
 
    attribute Function onconnecting;
     attribute CallGroup? group;
    attribute Function onconnected;
 
    attribute Function ondisconnecting;
     attribute Function ondisconnected;
   
     void answer(); // Should this make the call the active one?
     void answer(); // Should this make the call the active one?
     void disconnect();
     void disconnect();
    
    
     // void hold(); Not sure if needed for now. We might need to remake group APi to make it async
     // void hold(); These need to be made async. Also not sure if they are needed with a proper async 3-way API
     // void resume();
     // void resume();
  }
 
  [Constructor()]
  interface CallGroup {
    TelephonyCall item(unsigned long index);
    readonly attribute unsigned long length;
   }
   }
    
    

Revision as of 23:55, 1 December 2011

Proposed API

navigator.telephony would return an object with the following interface

 interface Telephony : EventTarget {
   TelephonyCall dial(DOMString number); // Returns a object in "dialing" state
   attribute boolean muted;           // Should these live on the call/group?
   attribute boolean speakerOn;
   attribute double speakerVolume;
   attribute boolean doNotDisturb;    // Automatically drops calls. Not sure if needed. Only seems needed
                                      // if supported as a network feature.
 
   attribute any active; // Either a call or a group
 
   readonly attribute TelephonyCall[] liveCalls;
   readonly attribute CallGroup[] liveGroups;
 
   void startTone(DOMString tone);
   void stopTone();
   void sendTones(DOMString tones,
                  [optional] unsigned long toneDuration,
                  [optional] unsigned long intervalDuration);
 
   attribute Function onincoming;
 }
 
 interface TelephonyCall : EventTarget {
   readonly attribute DOMString number;
 
   readonly attribute DOMString readyState;
   // "dialing", "ringing", "busy", "connecting", "connected", "disconnecting", "disconnected", "incoming"
   attribute Function onreadystatechange;
   attribute Function onringing;
   attribute Function onbusy;
   attribute Function onconnecting;
   attribute Function onconnected;
   attribute Function ondisconnecting;
   attribute Function ondisconnected;
   
   void answer(); // Should this make the call the active one?
   void disconnect();
 
   // void hold(); These need to be made async. Also not sure if they are needed with a proper async 3-way API
   // void resume();
 }
 
 interface CallEvent : Event {
   readonly attribute TelephonyCall call;
 }