Overview
The Voice service enables you to make outbound calls, provide interactive voice instructions using XML, and handle call events through webhooks.Service Status
Check Voice Service Status
Service name (“voice”)
Service status (“ready”)
Making Calls
Initiate Outbound Call
Make a voice call to a phone number.Phone number to call (without + prefix)Example:
254711XXXYYYCall Instructions
Provide Voice Instructions
This endpoint is called by Africa’s Talking when a call is answered. Return XML instructions to control the call flow.Unique identifier for the call session
Phone number of the person who initiated the call
Phone number being called
XML Instructions Reference
You can use various XML elements to control the call:<Say> - Text-to-Speech
<Say> - Text-to-Speech
Convert text to speech and play it to the caller.Attributes:
voice: “man” or “woman” (default: “woman”)playBeep: Play a beep before speaking (default: false)
<Play> - Play Audio
<Play> - Play Audio
Play an audio file from a URL.
<GetDigits> - Collect Input
<GetDigits> - Collect Input
Collect DTMF input from the caller.Attributes:
timeout: Seconds to wait for inputfinishOnKey: Key that terminates input (e.g., ”#”)callbackUrl: URL to POST the collected digits
<Dial> - Connect Calls
<Dial> - Connect Calls
Connect the caller to another phone number.Attributes:
phoneNumbers: Comma-separated list of numbers to dialrecord: Record the conversation (default: false)sequential: Try numbers in order vs simultaneously
<Record> - Record Audio
<Record> - Record Audio
Record the caller’s voice.Attributes:
finishOnKey: Key to stop recordingmaxLength: Maximum recording duration in secondsplayBeep: Play beep before recordingcallbackUrl: URL to receive the recording URL
<Reject> - Reject Call
<Reject> - Reject Call
Reject an incoming call.
Call Events
Handle Voice Events
Receive real-time notifications about call events (started, answered, ended, failed, etc.).Unique call session identifier
Type of event (e.g., “SessionInitiated”, “SessionAnswered”, “SessionEnded”)
Caller’s phone number
Destination phone number
Reason for call termination (e.g., “NORMAL_CLEARING”, “USER_BUSY”, “NO_ANSWER”)
Call duration in seconds
Cost of the call
Currency code (e.g., “KES”)
SessionInitiated
Call has been initiated
SessionAnswered
Call has been answered
SessionEnded
Call has ended
SessionFailed
Call failed to connect
- Status: 200 OK
- Body:
"OK"
Complete Call Flow Example
Next Steps
SMS Service
Send SMS messages and handle delivery reports
USSD Service
Build interactive USSD menus
