Relay.Calling.FaxAction

View as Markdown

Relay.Calling.FaxAction

This object returned from faxReceiveAsync and faxSendAsync methods represents a receiving or sending Fax on the call.

Methods-submenu

GetResult

Returns the final result of the faxing.

Parameters

None

Returns

Relay.Calling.FaxResult - Final result of the faxing.

Examples

Trying receiving a Fax and grab the result when it’s completed.

1call.OnFaxFinished = func(faxAction *signalwire.FaxAction) {
2 faxResult := faxAction.GetResult()
3 signalwire.Log.Info("Download Document from %s\n Pages #%d\n", faxResult.Document, faxResult.Pages)
4}
5_, err := call.ReceiveFaxAsync()
6if err != nil {
7 signalwire.Log.Error("Error occurred while trying to receive fax\n")
8}

GetCompleted

Return true if faxing has finished, false otherwise.

Parameters

None

Returns

Boolean - True/False accordingly to the state.

Examples

Trying receiving a Fax and check if it has finished.

1faxAction, err := call.ReceiveFaxAsync()
2if err != nil {
3 signalwire.Log.Error("Error occurred while trying to receive fax\n")
4}
5for {
6 time.Sleep(1 * time.Second)
7 if faxAction.GetCompleted() {
8 break
9 }
10 }

Stop

Stop the action immediately.

Parameters

None

Returns

Examples

Trying to receive a Fax and then stop the attempt.

1faxAction, err := call.ReceiveFaxAsync()
2if err != nil {
3 signalwire.Log.Error("Error occurred while trying to receive fax\n")
4}
5time.Sleep(3 * time.Second)
6faxAction.Stop()