Africa's Talking
Point your Africa's Talking shortcode (or sandbox code) at Asterisks, test it, and see the request and response format.
Before you start
- A Africa's Talking account with a USSD shortcode (or a shared-code extension) assigned to you.
- An Asterisks app, tested in the phone preview. New to Asterisks? Start with the Quickstart.
- Africa's Talking selected in the builder's top bar, so the callback address is in Africa's Talking's format.
Connect Africa's Talking
Deploy your app
In the builder, press Save, then Deploy. Enter the shortcode Africa's Talking gave you and press Deploy.Copy the callback address
Under Callback URL for Africa's Talking, press the copy button. It looks like this, with your app's id at the end:Callback address for Africa's Talkinghttps://apis.useasterisks.com/api/ussd/africastalking/your-app-idPaste it into Africa's Talking
Sign in to Africa's Talking, open the settings for your USSD shortcode, and paste the address into the callback field. Africa's Talking may call it the callback URL. Save.Or use the free sandbox
Africa's Talking's sandbox lets you create a test USSD code and dial it from their online phone simulator, without a live shortcode. Create a USSD channel in the sandbox, paste the same callback address, then open the simulator and dial the code.
Test the connection
Open Live sessions
In the Asterisks dashboard, keep Live sessions open.Dial your shortcode
From a phone on a network Africa's Talking covers. Your first screen should appear, and the session shows up in Live sessions.Go through every path
Try each option and a few wrong answers, as you did in the preview.
Nothing happens, or you see an error? Check Troubleshooting.
- Africa's Talking ends a session that takes too long to answer, so keep Send Data APIs fast.
Technical details
You don't need this to get started. It is here for developers and for Africa's Talking's support team.
What Africa's Talking sends
POST /api/ussd/africastalking/{appId}
Content-Type: application/x-www-form-urlencoded
sessionId=ATUid_9f1c2...&serviceCode=*384*55#&phoneNumber=+233244123456&text=1*2text holds every reply in the session so far, joined with *: empty on dial, then 1, then 1*2. Asterisks takes the last part as the latest reply.
What Asterisks answers
Content-Type: text/plain
CON Coffee Shop
1. Order coffee
2. Opening hours
3. ExitThe reply starts with CON to wait for a reply, or END to end the session.
The Network variable
The caller's network isn't passed through, so {{Network}} doesn't tell you which network the caller is on. Don't route on it.