Checking a Fax Status
Checking the status of a fax.
Once a fax has been submitted, the FaxResult value in the FaxStatus response is monitored until it is no longer InProgress. Using the JobId, you may query the status of the transaction.
In the following example, a simple progress loop monitors the status using the returned JobId until completion. If the FaxResult is not FaxResult.InProgress, it is considered a final result.
// begin sending the fax
var status = client.SendFax(fax);
// valid fax status?
if (status != null)
{
while (true)
{
// query job status
status = client.GetFaxStatus(status.JobId);
// done?
if (status.FaxResult != FaxResult.InProgress)
break;
Console.WriteLine("State: {0}, ConnectTime: {1}, ConnectSpeed: {2}, PagesDelivered: {3}, RemoteId: {4}",
status.State,
TimeSpan.FromSeconds(status.ConnectTime),
status.ConnectSpeed,
status.PagesDelivered,
status.RemoteId);
Thread.Sleep(15 * 1000);
}
// display final result
Console.WriteLine("Final result: " + status.FaxResult);
}
else
{
// display last http status code
Console.WriteLine("Response: {0}", client.StatusCode);
}
The following is an example FaxStatus returned from a completed fax:
{
"JobId": "ef05de9b-53f7-421e-8617-80a2c81b1d63",
"FaxResult": 0,
"State": 0,
"DialNumber": "+18565551234",
"PagesDelivered": 1,
"ConnectTime": 29,
"ConnectSpeed": 33600,
"RemoteId": "Fax Machine",
"Tag": null,
"CompletedOn": "2018-01-25T20:07:37.607",
"DeliveredOn": "2018-01-25T20:07:38.91"
}
USING PUSH NOTIFICATIONS
The latest EtherFax.Client now supports real-time push notifications. Please see the Push Notifications section for further details. This is an optional means to monitor inbound and outbound fax activity.
Updated over 5 years ago
What’s Next