3.1.7.25 TSPI_phoneSetHookSwitch

Syntax

LONG TSPI_phoneSetHookSwitch(dwRequestID, hdPhone, dwHookSwitchDevs, dwHookSwitchMode)

This function sets the hook state of the specified open phone's hookswitch devices to the specified mode. Only the hookswitch state of the hookswitch devices listed is affected.

Parameters

DRV_REQUESTID dwRequestID
Specifies the identifier of the asynchronous request. The Service Provider returns this value if the function completes asynchronously.

HDRVPHONE hdPhone
Specifies the Service Provider's opaque handle to the phone containing the hookswitch devices whose modes are to be set.

DWORD dwHookSwitchDevs
Specifies the device(s) whose hookswitch mode is to be set, of type PHONEHOOKSWITCHDEV. Values are:

PHONEHOOKSWITCHDEV_HANDSET
This is the phone's handset.

PHONEHOOKSWITCHDEV_SPEAKER
This is the phone's speakerphone or adjunct.

PHONEHOOKSWITCHDEV_HEADSET
This is the phone's headset.|

DWORD dwHookSwitchMode
Specifies the hookswitch mode to set, of type PHONEHOOKSWITCHMODE. Values are:

PHONEHOOKSWITCHMODE_ONHOOK
The device's mic and speaker are both onhook.

PHONEHOOKSWITCHMODE_MIC
The devicer's mic is active, the speaker is mute.

PHONEHOOKSWITCHMODE_SPEAKER
The device's speaker is active, the mic is mute.

PHONEHOOKSWITCHMODE_MICSPEAKER
The device's mic and speaker are both active.

Return Value

Returns zero if the function is successful, the (positive) dwRequestID value if the function will be completed asynchronously, or a negative error number if an error has occurred. Possible error returns are:

PHONEERR_INVALPHONEHANDLE
The specified phone device handle is invalid.

PHONEERR_INVALHOOKSWITCHDEV
The hookswitch device parameter is invalid.

PHONEERR_INVALHOOKSWITCHMODE
The hookswitch mode parameter is invalid.

PHONEERR_INVALPHONESTATE
The phone device is not in a valid state for the requested operation.

PHONEERR_OPERATIONFAILED
The specified operation failed for unspecified reason.

Comments

The hookswitch mode is the same for all devices specified. If different settings are desired, then this function can be invoked multiple times with a different set of parameters. A PHONE_STATE message is sent to the application after the hookswitch state has changed.

See Also

Functions: TSPI_phoneGetHookSwitch
Messages: PHONE_STATE
Data types: PHONESTATUS, PHONEHOOKSWITCHDEV, PHONEHOOKSWITCHMODE