Ir al contenido

Quickstart

Esta página aún no está disponible en tu idioma.

This guide starts an outbound call through the AI4CALL trunks. It assumes that an assistant and an AI4CALL number are already available.

1. Keep your credentials outside the source code

Section titled “1. Keep your credentials outside the source code”

Create a key from Security → API Key in the portal and store it in a secret manager or environment variable. You will need:

  • OUTBOUND_API_KEY for the outbound service;
  • ASSISTANT_API_KEY, the confidential key of the assistant;
  • CALLER_ID, an AI4CALL demo or purchased number assigned to the assistant.

[!NOTE] callerId must be a number available in AI4CALL Numbers → Routing. A demo number can be assigned to one assistant at a time.

Terminal window
curl --request POST 'https://outcall.ai4call.com/webhook/outbound_call' \
--header "X-APIKEY-SECRET-AI4CALL: $OUTBOUND_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"dst": "+390212345678",
"callerId": "'"$CALLER_ID"'",
"assistantApiKey": "'"$ASSISTANT_API_KEY"'",
"callResultUrl": "https://example.com/webhooks/call-result"
}'

assistantApiKey and callResultUrl are the current camelCase names. The legacy fields apiKey_assistente and url_esito_chiamata remain accepted for compatibility.

The request is made by your application to AI4CALL. Despite the /webhook/ path name, it is not a callback received by your application.

AI4CALL sends the call outcome to callResultUrl when supplied. The confirmed payload contains the correlation identifier, dialstatus, and duration.

{
"internal_id": "f69d21d0-4a56-4e27-990d-0a71771f0767",
"dialstatus": "ANSWER",
"duration": 42
}

Persist the internal_id returned when the call is accepted, so your webhook endpoint can associate the result with the original request. Outbound calls do not send a conversation transcript in this callback.

If the CDR is not ready yet, retrieve it later with GET /getDialstatus/{internal_id} and the same X-APIKEY-SECRET-AI4CALL header.

Continue with Outbound calls for PBX mode and all supported fields.