WebAPI/WebTelephony/Multi-SIM: Difference between revisions

Jump to navigation Jump to search
Line 5: Line 5:


== Proposal: WebTelephony API for Multi-SIM  ==
== Proposal: WebTelephony API for Multi-SIM  ==
Currently B2G supports a single SIM architecture. This proposal wants to extend it for supporting multi-SIMs. We introduce a central 'nsIDOMTelephonyManager' to manage several DOMTelephony objects. One DOMTelephony object is binded to a physical SIM slot. nsIDOMTelephonyManager controls the call policies, such as when an outgoing call can be placed or which incoming call is to be answered. Besides, by this WebTelephony API, user can choose which SIM card he wants to make a call through, or user can choose which incoming call he wants to accept if there are more than one. User can also easily get all the calls from all the SIMs as well as all the calls within a specific SIM.
Currently B2G supports a single SIM architecture. This proposal wants to extend it for supporting multi-SIMs and also takes single SIM scenario into account.  
 
The improvement is quite simple that adding an optional paramter in dial() function.


=== Web API ===
=== Web API ===
  interface nsIDOMTelephonyManager : nsIDOMEventTarget
  interface nsIDOMTelephony: nsIDOMEventTarget
  {
  {
  attribute boolean muted; /* Moved from the original nsIDOMTelephony */
  attribute boolean muted;
  attribute boolean speakerEnabled; /* Moved from the original nsIDOMTelephony */
  attribute boolean speakerEnabled;
readonly attribute long numServices;
   
   
  // Calls existing in all the sim cards.
  // Calls existing in all the services.
  readonly attribute jsval calls;
  readonly attribute jsval calls;
readonly attribute phoneState;  /* ringtone, incall, idle */
// Array of nsIDOMTelephony. Each service is taking care of one sim card.
readonly attribute jsval services;
readonly attribute nsIDOMTelephony defaultService;
[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
  // The call that is "active", i.e. receives microphone input and tones
  // generated via startTone.
  // generated via startTone.
  readonly attribute jsval active;
  readonly attribute jsval active;
 
nsIDOMTelephonyCall dial(in DOMString number, [optional] in unsigned long serviceId);
naIDOMTelephonyCall dialEmergency(in DOMString number, [optional] in unsigned long serviceId);
   
   
// Array of all calls that are currently connected.
  void startTone(in DOMString tone, [optional] in unsigned long serviceId);
readonly attribute jsval calls;
  void stopTone([optional] in unsigned long serviceId);
  void startTone(in DOMString tone);
  void stopTone();
   
   
  attribute nsIDOMEventListener onincoming;
  attribute nsIDOMEventListener onincoming;
Line 44: Line 36:
  interface nsIDOMTelephonyCall: nsIDOMEventTarget
  interface nsIDOMTelephonyCall: nsIDOMEventTarget
  {
  {
// Indicate which service the call comes from.
readonly attribute unsigned long serviceId; /* new attribute */
  readonly attribute DOMString number;
  readonly attribute DOMString number;
   
   
Line 51: Line 45:
   
   
  readonly attribute nsIDOMDOMError error;
  readonly attribute nsIDOMDOMError error;
// Indicate which SIM card this call belongs to.
readonly attribute unsigned long subscriptionId; /* New attribute */
   
   
  // Functions to mediate a call.
  // Functions to mediate a call.
Line 86: Line 77:
*Multi-SIMs
*Multi-SIMs


   navigator.mozTelephonyManager.defaultService.dial()
   navigator.mozTelephony.dial(number) // Use default service to make a call
   navigator.mozTelephonyManager.services[index].dial()
   navigator.mozTelephony.dial(number, serviceId)


==== Incoming Call  ====
==== Incoming Call  ====
Line 93: Line 84:
*Current B2G (Single SIM)
*Current B2G (Single SIM)


   Tel1 = navigator.mozTelephony;
   tel = navigator.mozTelephony;


*Multi-SIMs
*Multi-SIMs


   Tel1 = navigator.mozTelephonyManager.services[index];
   tel = navigator.mozTelephony;


Once the telephony object is obtained, the following work remains the same. We can get notified when an incoming call occurs in the specified SIM.
Once the telephony object is obtained, the following work remains the same. We get notified when an incoming call occurs in any of services.


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


With the extended API, we are able to listen to the 'incoming' event for a newly incoming call, no matter which SIM the call comes from.
navigator.mozTelephonyManager.addEventListener('incoming');


=== Implementation Details ===
=== Implementation Details ===
Confirmed users
978

edits

Navigation menu