Diagnosis Tutorial

Prerequisites

  • An authentication token with ProjectSuperAdmin permission.

  • The id of the provider to diagnose, from GET /providers.

  • (Optional) A number you own for invite_probe or real_call. The provider can charge these calls (real_call is not billed by VoIPBin).

Run the free checks

Send an empty body to run static, signal and inbound.

$ curl --location --request POST 'https://api.voipbin.net/v1.0/providers/4dbeabd6-f397-4375-95d2-a38411e07ed1/diagnoses?token=<YOUR_AUTH_TOKEN>' \
    --header 'Content-Type: application/json' \
    --data-raw '{}'

The answer is 202 with a report in the running state. Poll it until status is completed or failed.

$ curl --location --request GET 'https://api.voipbin.net/v1.0/providers/4dbeabd6-f397-4375-95d2-a38411e07ed1/diagnoses/6f1b0d3c-7a52-4f6b-9a4e-2d6f5f9c1a10?token=<YOUR_AUTH_TOKEN>'

$ curl --location --request GET 'https://api.voipbin.net/v1.0/providers/4dbeabd6-f397-4375-95d2-a38411e07ed1/diagnoses/latest?token=<YOUR_AUTH_TOKEN>'

Preview the dial string

Add destination to the static scenario to see the request URI and headers that a call would send, without sending anything.

$ curl --location --request POST 'https://api.voipbin.net/v1.0/providers/4dbeabd6-f397-4375-95d2-a38411e07ed1/diagnoses?token=<YOUR_AUTH_TOKEN>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "scenarios": ["static"],
        "destination": "+15550100001"
    }'

Probe with one INVITE (can be billed)

$ curl --location --request POST 'https://api.voipbin.net/v1.0/providers/4dbeabd6-f397-4375-95d2-a38411e07ed1/diagnoses?token=<YOUR_AUTH_TOKEN>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "scenarios": ["signal", "invite_probe"],
        "destination": "+15550100001"
    }'

Read invite_probe.result: a ringing answer passes, answered_billable is a warning (the provider can bill the answered probe), and a rejection names the likely cause in hint_code.

Real call (no VoIPBin billing, carrier cost possible)

$ curl --location --request POST 'https://api.voipbin.net/v1.0/providers/4dbeabd6-f397-4375-95d2-a38411e07ed1/diagnoses?token=<YOUR_AUTH_TOKEN>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "scenarios": ["real_call"],
        "destination": "+15550100001",
        "source": "+15550100002"
    }'

Answer the call, press one digit after the prompt and speak to hear the echo. The call is cut at 60 seconds after answer, and in any case 90 seconds after creation.

Observe an inbound call

$ curl --location --request POST 'https://api.voipbin.net/v1.0/providers/4dbeabd6-f397-4375-95d2-a38411e07ed1/diagnoses?token=<YOUR_AUTH_TOKEN>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "scenarios": ["inbound"],
        "inbound_number_id": "550e8400-e29b-41d4-a716-446655440000",
        "observe_inbound": true
    }'

Poll the report. When the inbound.observe step is running, read evidence.observe_until and call the number from your own phone before that time. The window is 120 seconds.

Ask the helper

$ curl --location --request GET 'https://api.voipbin.net/v1.0/provider_helper/status?token=<YOUR_AUTH_TOKEN>'

$ curl --location --request POST 'https://api.voipbin.net/v1.0/providers/4dbeabd6-f397-4375-95d2-a38411e07ed1/diagnoses/6f1b0d3c-7a52-4f6b-9a4e-2d6f5f9c1a10/interpret?token=<YOUR_AUTH_TOKEN>'

The answer holds a plain English message and suggestions. Nothing is applied automatically. To apply a suggestion, update the provider yourself:

$ curl --location --request PUT 'https://api.voipbin.net/v1.0/providers/4dbeabd6-f397-4375-95d2-a38411e07ed1?token=<YOUR_AUTH_TOKEN>' \
    --header 'Content-Type: application/json' \
    --data-raw '{"codecs": "PCMU"}'

Errors

HTTP Status

Cause and Fix

400 Bad Request

Invalid JSON, an unknown scenario, an invalid number or an inbound_number_id that is not yours.

403 Forbidden

Not a ProjectSuperAdmin, or a direct-access token.

404 Not Found

The provider or the diagnosis does not exist, or the diagnosis belongs to another provider.

409 Conflict

diagnosis_running: a diagnosis of this provider is still running. Wait and poll it. The interpret call also answers 409 DIAGNOSIS_RUNNING while the report is running.

429 Too Many Requests

rate_limit_invite_probe or rate_limit_real_call: the limit of 5 per provider per hour was reached. The helper can also answer 429 when it is busy or its daily limit is reached.

503 Service Unavailable

The helper took too long or is temporarily unavailable.