WebAPI/WebTelephony/Multi-SIM: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(B2G arch proposal for multi-sim)
Line 87: Line 87:
  incoming.answer();
  incoming.answer();


== Proposal: Architecture ==
<h2> Proposal: Architecture  </h2>
<p><img src="/images/thumb/6/6e/B2GArch.png/799px-B2GArch.png" _fck_mw_filename="B2GArch.png" _fck_mw_width="799" _fck_mw_height="600" alt="B2G: Single SIM" />
</p><p><img src="/images/thumb/d/d9/B2GArch-multisim.png/799px-B2GArch-multisim.png" _fck_mw_filename="B2GArch-multisim.png" _fck_mw_width="799" _fck_mw_height="600" alt="B2GArch-multisim.png" />
</p>

Revision as of 10:07, 22 October 2012

Proposal: WebTelephony API for Multi-SIM

interface nsIDOMTelephonyManager : nsIDOMEventTarget
{
  attribute boolean muted; 
  attribute boolean speakerEnabled;
  
  readonly attribute jsval active;
  readonly attribute jsval calls;
  readonly attribute phoneState;  /* Ringing, Offhook, Idel */
  readonly attribute jsval phones;
  readonly attribute nsIDOMTelephony defaultPhone;
  
  [implicit_jscontext] attribute jsval onincoming;
  [implicit_jscontext] attribute jsval oncallschanged;
};
interface nsIDOMTelephony: nsIDOMEventTarget
{
  nsIDOMTelephonyCall dial(in DOMString number);
  
  // The call that is "active", i.e. receives microphone input and tones
  // generated via startTone.
  readonly attribute jsval active;

  // Array of all calls that are currently connected.
  readonly attribute jsval calls;

  void startTone(in DOMString tone);
  void stopTone();

  attribute nsIDOMEventListener onincoming;
  attribute nsIDOMEventListener oncallschanged;
};
interface nsIDOMTelephonyCall: nsIDOMEventTarget
{
  readonly attribute DOMString number;

  // "dialing", "alerting", "busy", "connecting", "connected", "disconnecting", 
  // "disconnected", "incoming", "holding", "held", "resuming"
  readonly attribute DOMString state;
  
  readonly attribute nsIDOMDOMError error;
  readonly attribute nsIDOMTelephony phone;

  // functions to mediate a call.
  void answer();  
  void hangUp();
  void hold(); 
  void resume(); 

  attribute nsIDOMEventListener onstatechange;

  attribute nsIDOMEventListener ondialing;
  attribute nsIDOMEventListener onalerting;
  attribute nsIDOMEventListener onbusy;
  attribute nsIDOMEventListener onconnecting;
  attribute nsIDOMEventListener onconnected;
  attribute nsIDOMEventListener ondisconnecting;
  attribute nsIDOMEventListener ondisconnected;
  attribute nsIDOMEventListener onincoming;
  attribute nsIDOMEventListener onholding; 
  attribute nsIDOMEventListener onheld; 
  attribute nsIDOMEventListener onresuming; 
 };

Use Case

Outgoing Call

  • Current B2G
 navigator.mozTelephony.dial(number)
  • Multi-SIM
 navigator.mozTelephonyManager.defaultPhone.dial()
 navigator.mozTelephonyManager.phones[index].dial()

Incoming Call

  • Current B2G
 Tel1 = navigator.mozTelephony;
  • Multi-SIM
 Tel1 = navigator.mozTelephonyManager.phones[index];

Once the telephony object is obtained, the following work remains the same.

Tel1.addEventListener('incoming');
Tel1.onincoming = function onincoming (evt) {
  incoming = evt.call; };
incoming.answer();

Proposal: Architecture

<img src="/images/thumb/6/6e/B2GArch.png/799px-B2GArch.png" _fck_mw_filename="B2GArch.png" _fck_mw_width="799" _fck_mw_height="600" alt="B2G: Single SIM" />

<img src="/images/thumb/d/d9/B2GArch-multisim.png/799px-B2GArch-multisim.png" _fck_mw_filename="B2GArch-multisim.png" _fck_mw_width="799" _fck_mw_height="600" alt="B2GArch-multisim.png" />