Phone State Monitoring
Phone State Monitoring

Phone State Monitoring

The WFC Voice Client broadcasts its status using the following intent. This is an intent that is sent by the WFC Voice Client. A third-party application can register to receive the intents; example code is below:

Prerequisites

  • WFC Voice Client is loaded to the device.
  • The third-party application must register to receive the intents as described in Phone State Example.
  • All versions of WFC Voice Client 9.0 support these intents.

Intent Definition

Name
Description
Action
wfc.voice.PHONE_STATE
extras
registration_state
PBX registration state
ACTIVE|ACTIVE_DND|CONNECTING|INACTIVE
state
Voice call state
IDLE|CALLING|RINGING|ACTIVE
number
Phone number for the current session that is reported when the voice call state changes (optional).
line_id
Line number that is reported when one of the line registers (optional).
line_extension
Line extension that is reported when one of the lines registers (optional).
line_registered
Boolean expression that is reported when one of the lines registers (optional).
suspended
Boolean expression that is reported when the state is
IDLE
because one of the sessions is suspended or on hold (optional)
The suspended extra is only available in WFC Voice version 9.0.21104 or later.

Phone State Example

The following code example registers the phone state intent from a third party app.
// create broadcast receiver BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "Received PHONE_STATE from WFCVoice “ + " registration_state=" + intent.getStringExtra("registration_state") + “ call state=" + intent.getStringExtra("state") + " number=" + intent.getStringExtra("number") + " line_id=" + intent.getStringExtra("line_id") + " line_extension=" + intent.getStringExtra("line_extension") + " line_registered=" + intent.getBooleanExtra("line_registered", false) ); } }; // register broadcast receiver in the Activity IntentFilter mMessageReceiver = new IntentFilter(); requestFilter.addAction(“wfc.voice.PHONE_STATE”); registerReceiver(mMessageReceiver, requestFilter);