A phone device can have multiple hookswitch devices. Each hookswitch device has a speaker and a microphone component, and operates in one of four hookswitch modes:
Onhook | The hookswitch device is onhook, and both its microphone and speaker are disabled. |
Microphone only | The hookswitch device is offhook, its microphone is enabled, and its speaker is mute. |
Speaker only | The hookswitch device is offhook, its microphone is disabled, and its speaker is enabled. |
Microphone and speaker | The hookswitch device is offhook, and both the microphone and the speaker are enabled. |
The tapi32.dll can set and query the hookswitch mode of an opened phone's hookswitch devices. To mute or unmute the microphone or speaker component of a hookswitch device, the TSPI_phoneSetHookSwitch function is used with the appropriate hookswitch mode. This function sets the hookswitch mode of one or more of the hookswitch devices of an open phone device. The TSPI_phoneGetHookSwitch function queries the hookswitch mode of a hookswitch device of an open phone device.
When the mode of a phone's hookswitch device is changed manually, for example by lifting the handset from its cradle, the service provider must send a PHONE_STATUS message to the The tapi32.dll callback function to notify it about the state change. Parameters to this message provide an indication of the change.
The volume of the speaker component of a hookswitch device can be set with TSPI_phoneSetVolume. The volume setting is different from mute in that muting a speaker and later unmuting it preserves the volume setting of the speaker. The TSPI_phoneGetVolume function returns the volume setting of the hookswitch device's speaker of an open phone device.
The microphone component of a hookswitch device can be gain controlled. The gain setting is different from mute in that muting a microphone and later unmuting it preserves the gain setting of the microphone. TSPI_phoneSetGain sets the gain of a hookswitch device's microphone of an open phone device, and TSPI_phoneGetGain returns the gain setting of the hookswitch device's microphone of an opened phone.
When the volume or gain of a phone's hookswitch device is changed, the service provider sends a PHONE_STATUS message to the tapi32.dll callback function to notify tapi32.dll about the state change. Parameters to this message provide an indication of the change.