Aller au contenu

Tester

Try every path in the phone preview, fix what Check flow finds, and test on a real phone before launch.

La documentation est rédigée en anglais. Les pages traduites arrivent.

The phone preview

The fastest way to test is the phone preview inside the builder. It costs nothing and needs no shortcode.

  1. Open your app in the builder

    From Apps, click the app.
  2. Press Test

    The ▷ button in the top bar. A phone opens on the left showing your first screen.
  3. Choose the number to dial from

    Dial from, above the phone, is the caller's number for the test. Type any Ghana number, such as 0241234567. Your app receives it as {{MobileNumber}}, and the preview remembers it. Change it and dial again to test as a different caller.
  4. Reply like a caller

    Type in the Reply box and press Send (or Enter). Cancel ends the session.
  5. Start again

    Press Dial again at the top of the preview to restart from the first screen.
Tip: With the preview closed, clicking any screen on the canvas shows how that screen will look on a phone, without running the whole flow.

What the preview checks

The preview runs your app in your browser and applies the same rules as the live service:

It checksExample
Menu choicesReplying 7 to a 3-option menu shows "Invalid option selected."
Answer typesA Numeric question refuses abc with "Please enter a valid number."
Length, minimum and maximumA 1–10 question refuses 25 with "Enter 10 or less."
PatternsAn answer that doesn't match Answer must match shows "That answer isn't in the expected format."
Going backReplying 0 returns to the previous screen, unless the question turns Pressing 0 goes back off.
Saved answersText like {{cups}} is filled in with the caller's answer.
Smart RouterPicks a branch from the saved answers and moves on, showing nothing, as on a real phone.
Sub-flowRuns the other app, passes values in and out, and comes back.

Where the preview differs from a real phone

StepIn the preview
Collect PaymentNothing is sent to your provider and nobody is charged. The amount and the number are shown under the phone. With PAID connected, press Paid or Failed to follow that route.
Sub-flowRuns the other app’s last saved version. A real phone gets its published version.
{{SessionId}} and {{Network}}Empty. They are filled in on a real session.
A failed or slow callTakes the FAIL route, and the reason is shown under the phone. With no FAIL route the test stops there, where a real session would carry on without the values. The “Check again” screen for slow calls only appears on a real session.
Watch out: Send Data steps and menus filled from your API make real web requests from your browser during the preview, so your API must allow requests from the dashboard (CORS). On a real phone the request comes from Asterisks' servers instead, so this only affects the preview. The address must start with https://. An ngrok address to your own machine works: the preview sends the header ngrok needs to skip its warning page.

Check flow

Press Check flow (the tick icon) before deploying. It finds screens that aren't connected and branches that never reach an end, and names the screen so you can fix it. Deploy runs the same check.

MessageWhat to do
Node "…" has no outgoing connectionsDrag from that screen’s dot to the screen that should come next, or make it an End Session.
Flow branch ending at "…" must be terminated with an END nodeThat path stops without ending the session. Add an End Session screen at the end of it.
Router branch … has an empty conditionOpen the Smart Router and fill in the condition, or delete that branch.
Router "…" has nothing connected to ELSEDrag the router’s ELSE dot to the screen for callers who match no branch.
"MobileNumber" is the caller’s own number…A step saves under a name Asterisks keeps for itself. Rename it, for example to recipientNumber.
"…" has no failure routeA warning, not an error. Connect the Send Data step’s FAIL dot to a “try again later” screen.

Before-launch checklist

  • Every menu option opens a screen.
  • Every path ends on an End Session, Flash Alert or Collect Payment screen.
  • No screen is over 182 characters (the counter under What the phone shows reads, for example, 55 / 182).
  • Questions use the right Answer type, with a minimum and maximum where it matters.
  • You tried wrong answers in the preview, not just the happy path.
  • Your session balance has credit. Sessions stop with "Insufficient credits" at zero.

Testing on real phones

Once the preview looks right, test with a real phone before telling customers.

  1. Deploy the app

    Follow step 5 of the Quickstart.
  2. Point your aggregator at Asterisks

    Paste the callback address into your aggregator's settings (see its guide under Connect an aggregator).
  3. Dial from your phone

    Dial the shortcode and go through every path on a real handset, ideally on more than one network.

Sandboxes

Africa's Talking has a free sandbox with an online phone simulator, so you can test against Asterisks without a live shortcode. See the Africa's Talking guide.

Watching live sessions

The Live sessions page in the dashboard lists sessions as they happen. Keep it open while you test on a real phone to see your test calls arrive.