WebAPI/WebTelephony/Multi-SIM: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<h2> Proposal: WebTelephony API for Multi-SIM  </h2>
== Proposal: WebTelephony API for Multi-SIM  ==
<pre class="_fck_mw_lspace">interface nsIDOMTelephonyManager&#160;: nsIDOMEventTarget
 
{
interface nsIDOMTelephonyManager&nbsp;: nsIDOMEventTarget
{
  attribute boolean muted;  
  attribute boolean muted;  
  attribute boolean speakerEnabled;
  attribute boolean speakerEnabled;
Line 13: Line 14:
  [implicit_jscontext] attribute jsval onincoming;
  [implicit_jscontext] attribute jsval onincoming;
  [implicit_jscontext] attribute jsval oncallschanged;
  [implicit_jscontext] attribute jsval oncallschanged;
};
};
</pre>
 
<pre class="_fck_mw_lspace">interface nsIDOMTelephony: nsIDOMEventTarget
interface nsIDOMTelephony: nsIDOMEventTarget
{
{
  nsIDOMTelephonyCall dial(in DOMString number);
  nsIDOMTelephonyCall dial(in DOMString number);
   
   
Line 22: Line 23:
  // generated via startTone.
  // generated via startTone.
  readonly attribute jsval active;
  readonly attribute jsval active;
 
  // Array of all calls that are currently connected.
  // Array of all calls that are currently connected.
  readonly attribute jsval calls;
  readonly attribute jsval calls;
 
  void startTone(in DOMString tone);
  void startTone(in DOMString tone);
  void stopTone();
  void stopTone();
 
  attribute nsIDOMEventListener onincoming;
  attribute nsIDOMEventListener onincoming;
  attribute nsIDOMEventListener oncallschanged;
  attribute nsIDOMEventListener oncallschanged;
};
};
</pre>
 
<pre class="_fck_mw_lspace">interface nsIDOMTelephonyCall: nsIDOMEventTarget
interface nsIDOMTelephonyCall: nsIDOMEventTarget
{
{
  readonly attribute DOMString number;
  readonly attribute DOMString number;
 
  // "dialing", "alerting", "busy", "connecting", "connected", "disconnecting",  
  // "dialing", "alerting", "busy", "connecting", "connected", "disconnecting",  
  // "disconnected", "incoming", "holding", "held", "resuming"
  // "disconnected", "incoming", "holding", "held", "resuming"
Line 43: Line 44:
  readonly attribute nsIDOMDOMError error;
  readonly attribute nsIDOMDOMError error;
  readonly attribute nsIDOMTelephony phone;
  readonly attribute nsIDOMTelephony phone;
 
  // functions to mediate a call.
  // functions to mediate a call.
  void answer();   
  void answer();   
Line 49: Line 50:
  void hold();  
  void hold();  
  void resume();  
  void resume();  
 
  attribute nsIDOMEventListener onstatechange;
  attribute nsIDOMEventListener onstatechange;
 
  attribute nsIDOMEventListener ondialing;
  attribute nsIDOMEventListener ondialing;
  attribute nsIDOMEventListener onalerting;
  attribute nsIDOMEventListener onalerting;
Line 63: Line 64:
  attribute nsIDOMEventListener onheld;  
  attribute nsIDOMEventListener onheld;  
  attribute nsIDOMEventListener onresuming;  
  attribute nsIDOMEventListener onresuming;  
};
};
</pre>
 
<h3> Use Case  </h3>
=== Use Case  ===
<h4> Outgoing Call  </h4>
 
<ul><li>Current B2G
==== Outgoing Call  ====
</li></ul>
 
<pre class="_fck_mw_lspace"> navigator.mozTelephony.dial(number)
*Current B2G
</pre>
 
<ul><li>Multi-SIM
  navigator.mozTelephony.dial(number)
</li></ul>
 
<pre class="_fck_mw_lspace"> navigator.mozTelephonyManager.defaultPhone.dial()
*Multi-SIM
navigator.mozTelephonyManager.phones[index].dial()
 
</pre>
  navigator.mozTelephonyManager.defaultPhone.dial()
<h4> Incoming Call  </h4>
navigator.mozTelephonyManager.phones[index].dial()
<ul><li>Current B2G
 
</li></ul>
==== Incoming Call  ====
<pre class="_fck_mw_lspace"> Tel1 = navigator.mozTelephony;
 
</pre>
*Current B2G
<ul><li>Multi-SIM
 
</li></ul>
  Tel1 = navigator.mozTelephony;
<pre class="_fck_mw_lspace"> Tel1 = navigator.mozTelephonyManager.phones[index];
 
</pre>
*Multi-SIM
<p>Once the telephony object is obtained, the following work remains the same.  
 
</p>
  Tel1 = navigator.mozTelephonyManager.phones[index];
<pre class="_fck_mw_lspace">Tel1.addEventListener('incoming');
 
Tel1.onincoming = function onincoming (evt) {
Once the telephony object is obtained, the following work remains the same.  
incoming = evt.call; };
 
incoming.answer();
Tel1.addEventListener('incoming');
</pre>
Tel1.onincoming = function onincoming (evt) {
<h2> Proposal: Architecture  </h2>
incoming = evt.call; };
<p><img src="/images/6/6e/B2GArch.png" _fck_mw_filename="B2GArch.png" alt="" /><br />
incoming.answer();
</p>
 
== Proposal: Architecture  ==
 
[[File:B2GArch.png|487x599px|B2G Architecture]]

Revision as of 10:20, 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

B2G Architecture