Talk:WebAPI/WebTelephony: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 37: Line 37:
== philikon's thoughts ==
== philikon's thoughts ==


* IMHO
* IMHO <code>navigator.telephony.dial("numbergoeshere");</code> is nicer than <code>new TelephonyCall("numbergoeshere");</code>
 
  var call = navigator.telephony.dial("numbergoeshere");
 
is nicer than
 
  var call = new TelephonyCall("numbergoeshere");
 
* We have a bunch of telephony-related functionality that's not reflected yet:
* We have a bunch of telephony-related functionality that's not reflected yet:
** controlling and reading radio power
** controlling and reading radio power
** reading radio metadata (operator, signal strength, etc.)
** reading radio metadata (operator, signal strength, etc.)
** ...
** ...
* I would also suggest another readyState, <code>"dialing"</code> that comes before <code>"calling"</code> for outgoing calls.
* Nits: we should probably define the possible values for readyState on the interface (nit: for XHR they're ints, not strings... I like being consistent, but I also prefers strings... hmmm...). Also, event listener objects should probably be declared as <code>EventListener</code>.


My proposal on this (as a delta to the main proposal):
My proposal on this (as a delta to the main proposal):
Line 54: Line 49:
   interface Telephony {
   interface Telephony {
     void power(bool on);
     void power(bool on);
 
    Some thoughts on this:
     TelephonyCall dial(String number);
     TelephonyCall dial(String number);
 
   
     EventListener onpowerchange
     EventListener onpowerchange
     EventListener onsignalstrengthchange
     EventListener onsignalstrengthchange
     EventListener onoperatorchange
     EventListener onoperatorchange
   }
   }

Revision as of 20:48, 30 November 2011

Proposal for an improved and simplied Telephony API (José M. Cantera, Telefónica I+D)

Sensor API

navigator.telephony would return an object with the following interface

 interface Telephony : EventTarget {
   TelephonySession newSession(DOMString number); // Multiple number call??
   readonly attribute TelephonySession liveSession;
   attribute Function onincoming;
 }
 interface TelephonySession : EventTarget {
   readonly attribute DOMString originNumber;
   readonly attribute DOMString number;
   // Do the call
   void call();
  attribute boolean muted; 
  attribute boolean speakerOn;
  void startTone(DOMString tone);
  void stopTone();
  void sendTones(DOMString tones,
                 [optional] unsigned long toneDuration,
                 [optional] unsigned long intervalDuration);
   readonly attribute DOMString readyState; // "calling", "incomming", "connected", "closed", "busy"
   // Can we get info on when a call goes from "trying to place call" to "calling"?
   attribute Function onconnect;
   attribute Function ondisconnect;
   attribute Function onbusy;
   attribute Function onreadystatechange;
   void answer(); 
   void hangUp();
  }
 interface IncomingCallEvent : Event {
   readonly attribute TelephonySession session;
 }

philikon's thoughts

  • IMHO navigator.telephony.dial("numbergoeshere"); is nicer than new TelephonyCall("numbergoeshere");
  • We have a bunch of telephony-related functionality that's not reflected yet:
    • controlling and reading radio power
    • reading radio metadata (operator, signal strength, etc.)
    • ...
  • I would also suggest another readyState, "dialing" that comes before "calling" for outgoing calls.
  • Nits: we should probably define the possible values for readyState on the interface (nit: for XHR they're ints, not strings... I like being consistent, but I also prefers strings... hmmm...). Also, event listener objects should probably be declared as EventListener.

My proposal on this (as a delta to the main proposal):

 interface Telephony {
   void power(bool on);
   Some thoughts on this:
   TelephonyCall dial(String number);
   
   EventListener onpowerchange
   EventListener onsignalstrengthchange
   EventListener onoperatorchange
 }