How to set up a FreePBX AI receptionist with Hail

A FreePBX AI receptionist can answer selected calls on your existing business number. FreePBX sends those calls to Hail over a SIP trunk. With a return route, Hail can hand calls back to your desk phones.

View .md

Let Hail answer selected calls on your FreePBX business number. When a customer calls your bike shop about an e-bike service, the agent asks for the model and checks your service list. Your customers keep dialing the same number.

If a model is missing from your list, the agent can take the details for a callback. With a connected help desk, your team can get the question and transcript before calling back.

Start with one FreePBX test call

Create your Hail agent in the console or through Hail MCP. Try this in the agent's Instructions.

Ask which e-bike model the caller has. We service the City 2 and Trail 4. If we service their model, tell them. If the model is missing from the list, ask for their name and callback number so the shop can check.

Start with a spare number that already rings on FreePBX. Your team can keep answering the main line while you test. If the main number is your only option, use a maintenance window. Calls may be interrupted during verification.

You need admin access to FreePBX 17 and a Hail workspace owner or admin to set up the connection. Keep the carrier trunk that receives calls. Add a separate PJSIP trunk to send selected calls from FreePBX to Hail.

  1. A customer calls your existing number

  2. Your carrier sends the call to FreePBX

  3. FreePBX routes the call to Hail over a separate trunk

  4. Your agent answers

1. Get your Hail connection details

  1. In the Hail console, open Phone system. If you have a connection already, select New connection.
  2. Enter a name, such as Bike shop test, and select Create connection.
  3. Save the Username and Password securely. Share them only with the admin who will set up the trunk.
  4. Copy the full SIP server address. If it ends in dots, select Get full address and send the email it opens. Ask Hail to confirm the port and transport for your setup.

Plan for two FreePBX call channels per call sent to Hail. A handover to a FreePBX extension uses a third. The Hail phone system guide lists the trunk requirements.

2. Add a FreePBX PJSIP trunk to Hail

  1. Open Connectivity > Trunks > Add Trunk. Choose the SIP trunk labeled chan_pjsip. On General, set Trunk Name to Hail-spare or another name you will recognize. Leave Outbound CallerID blank and set CID Options to Allow Any CID so the trunk can pass the caller's number.
  2. Under pjsip Settings > General, enter Hail's Username and enter the password in Secret. Leave Auth username blank when it matches Username.
  3. Set Authentication to Outbound and Registration to None. Enter the full SIP Server address, SIP Server Port, and Transport from Hail.
  4. Under Advanced, leave From User blank and set DTMF Mode to RFC 4733 for the ownership check's keypad code. Under Codecs, enable G.711 (ulaw or alaw).
  5. Leave the trunk's Dialed Number Manipulation Rules empty. Select Submit, then Apply Config.

Use Sangoma's PJSIP screenshots to find the tabs. Use the Hail settings in the steps above.

3. Create an outbound route for just your test number

Choose an unused internal prefix that does not overlap an extension, feature code, or dialing pattern on your system. The example uses 4242. Use your chosen prefix in both the outbound route and the test destination.

  1. Open Connectivity > Outbound Routes > Add Outbound Route. Set Route Name to Hail-spare or another name you will recognize.
  2. Under Trunk Sequence for Matched Routes, add only the Hail trunk. Leave Route CID blank and set Override Extension to No.
  3. Under Dial Patterns, add one row. Enter a plus sign and the country code in prepend. Enter your chosen prefix in prefix. Enter the remaining digits of your number in international format in match pattern. Leave CallerID blank.
  4. Select Submit. In the outbound route list, drag the Hail route above any general route that matches your test dial string. Keep your emergency and restricted routes in their existing order. Select Apply Config.

For the fictional US number (201) 555-0123, enter +1 in prepend, 4242 in prefix, and 2015550123 in match pattern. FreePBX matches 42422015550123, strips 4242, and sends +12015550123 to Hail. The Sangoma outbound route user guide shows the fields.

4. Route the spare number and run the ownership check

A Misc Destination tells FreePBX what to dial when a call reaches it.

  1. Open Applications > Misc Destinations > Add Misc Destination. Enter Hail test in Description. In Dial, enter your prefix followed by the digits in match pattern. The example uses 42422015550123. Select Submit, then Apply Config.
  2. Open Connectivity > Inbound Routes. Look for a route with the exact DID Number your carrier sends and a blank CallerID Number. If that route exists, record its current Set Destination. Otherwise, plan to add a temporary route for that number.
  3. Hail may call from different numbers. A rule that matches both the DID and caller ID, or a CID Priority Route, can take precedence. If another rule could catch the call, ask your FreePBX admin to plan a temporary path and record how to restore it. If you switch spare numbers, set up the outbound route and repeat this section for the new number.
  4. In Hail, open Phone system and use Add number. Wait until the number appears with a Check button.
  5. In FreePBX, edit the route you recorded or add the temporary route with a blank CallerID Number. Keep the filters on existing caller-ID routes. Set the destination to Misc Destinations > Hail test. Make any temporary routing changes your admin planned. Select Submit, then Apply Config.
  6. Select Check only after confirming that calls reach Hail directly, whatever caller ID Hail uses. A menu or queue must stay out of this path. Hail calls the number and sends a keypad code that must come back on the same connection. Hail bills the check as an outbound call.
  7. After the check, or if you cannot run it, restore the saved Set Destination or remove the temporary route. Restore any other settings your admin changed for the check. Select Apply Config. When Hail shows Connected, select your receptionist under Choose the agent.

Sangoma shows the Misc Destinations fields and inbound route fields and priority.

5. Test the answers, caller ID, and handover

Before the call tests, record the current Set Destination of the route you will edit. If you removed a temporary route after verification, add it back for the same DID. Set Set Destination to the Hail Misc Destination. Confirm that this route takes precedence for your outside test phone's caller ID. If another rule wins, use a different test phone or have your FreePBX admin set up a temporary path. Select Submit, then Apply Config. Call from the outside test phone.

Ask about a model on your service list. Check that you can hear the agent and it can hear you. Then ask about an unlisted model and check that the agent offers a callback. If you connected a help desk, open the test ticket and check what your team receives. Find more test ideas in the AI phone agent guide.

Call from a number that shows its caller ID. In Hail, open Activity and confirm the call shows that number. If it shows the business number instead, check the Hail trunk's CID Options, Outbound CallerID, and From User, then check Route CID and Override Extension on its outbound route.

Hand a call back to a FreePBX extension

  1. Work with Hail to set up the SIP return path. In Phone system > Calls out and handover, save the public hostname or IP address where FreePBX receives those calls. Confirm the SIP transport and firewall settings with Hail. Give that inbound path access only to the extensions Hail should ring.
  2. In Contacts, save the FreePBX Extension on a contact. If the contact also has a phone number, add them under Hand over. For an extension-only contact, use Hail MCP or the API. Include the existing handover contacts when you update the list.
  3. Call from outside FreePBX and trigger the transfer. Confirm that the intended phone rings, displays the caller's number, and carries audio both ways.
  4. Repeat with voicemail and any other answer destination disabled on the test extension. Let the transfer time out and check that the agent offers to take a message. If voicemail picks up first, Hail treats the call as answered.

Restore the route after testing

After the direct call tests, restore the inbound destination you saved immediately before them, or remove the temporary route. Restore any other temporary FreePBX routing changes. Re-enable voicemail if you turned it off for the test. Select Apply Config and call the number to confirm its previous path works. Remove contacts you added only for testing from the Hail agent's handover list.

6. Send the calls you choose to Hail

If you tested on a spare number, select New connection in Hail for the main number. The console adds one number per connection. Create a separate FreePBX trunk with the new credentials, an exact dial pattern, and a Misc Destination for the main number. If you use handover, set up the return path for the new connection with Hail.

During a maintenance window, record the current destination, verify the main number, restore its route, and assign the agent. Then repeat the call tests on the main number and restore its previous route again. If you already tested and restored the main number, use its existing connection and continue to final routing.

Once those checks pass, apply the routing you want. Direct all calls for that number to the Hail destination, use that destination for one phone menu option, or choose it for selected hours with a FreePBX time condition.

If the FreePBX ownership check fails

  • No call arrived. Check the exact inbound DID, route priority, and destination. On the outbound route, check the prefix, trunk order, and that the number sent to Hail starts with + and the country code.
  • The call came in on another connection's trunk. Compare the FreePBX username and password with the Hail connection where you added the number.
  • The check code did not come through. Confirm RFC 4733 under DTMF Mode and check that the call reaches Hail before a queue or phone menu answers.

Restore the original inbound route while you troubleshoot. Follow the Hail ownership check guide before you try again.

FreePBX AI receptionist FAQ

Do I need to move my FreePBX number to Hail?

No. Your number stays with your carrier. FreePBX sends the calls you choose to Hail through a separate PJSIP trunk. See other ways to keep your number.

Can my team still use its FreePBX desk phones?

Yes. Keep your extensions and send only the calls you choose to Hail. To hand calls back to those extensions, set up a return path with Hail. Explore Hail voice for other calling options.

How do I handle texts on a connected FreePBX number?

Your existing provider still handles texts for the number if it supports them. The phone system connection carries calls. To send texts with Hail, use a separate SMS-capable Hail number.

Make your first call.

Connect your assistant and start calling.