Skip to Content

Asterisk-based PBX Systems

Telephony

Transfer calls between RocketAiFlow and Asterisk-based PBX systems through a PJSIP trunk.

This integration was built using a static PJSIP trunk between Asterisk and the remote provider/PBX.

Use this integration when your environment uses Asterisk, FreePBX, or another Asterisk-based PBX and you want RocketAiFlow agents to receive calls, place campaign calls, or hand calls off to real operators.

How call handoff works

RocketAiFlow uses the configured trunk as the telephony path between the AI agent and the PBX.

During a call, the agent can keep the conversation, end the call, or call a transfer function when the customer needs a real operator.

  1. The call enters or leaves RocketAiFlow through the configured Asterisk/PJSIP trunk.
  2. The AI voice agent handles the conversation and decides whether a handoff is needed based on the prompt and enabled functions.
  3. transfer, transfer_call, or transfer_to_service sends the destination extension, number, or service selected by the workflow.
  4. Asterisk routes the destination using the configured context. If no custom transfer context is selected in the function, RocketAiFlow uses the default context raf-internal.
  5. After the test, validate the call in Call Records and check the trunk state in monitoring.

PJSIP configuration and RocketAiFlow trunk

Install this configuration on the Asterisk PBX server you want to integrate.

Place the block in the Asterisk PJSIP configuration, usually /etc/asterisk/pjsip.conf, or in a file included by pjsip.conf. On FreePBX-based systems, use the custom PJSIP include file required by your installation instead of editing generated files directly.

On the RocketAiFlow side, a default trunk named providerPjsip is already prepared. Before enabling it, set the correct IP address of your Asterisk/PBX server, then replace the default password with the password used in this PBX configuration.

The PBX configuration defines transport, AOR, auth, endpoint, and identify rules for RocketAiFlow, which registers or sends calls to that PBX.

RocketAiFlow providerPjsip trunk configuration showing the Server URI field where the Asterisk PBX server IP is configured.
In the providerPjsip trunk, set your Asterisk/PBX server IP in Server URI before enabling the trunk.
Asterisk PBX server
;=============== TRANSPORT SECTION
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
local_net=172.22.0.0/24      ; <--- Replace with your PBX local network
external_signaling_address=YOUR_PUBLIC_IP
external_media_address=YOUR_PUBLIC_IP

; If you use a domain/DDNS instead of a static public IP, use:
; external_signaling_address=pbx.yourdomain.com
; external_media_address=pbx.yourdomain.com

; --- AOR used by RocketAiFlow REGISTER requests ---
[providerPjsip_aor]
type=aor
contact=sip:10.0.0.10:5060      ; <--- Replace with the RocketAiFlow server IP address
qualify_frequency=3

; --- AUTH: same credentials used by RocketAiFlow ---
[providerPjsip_auth]
type=auth
auth_type=userpass
username=providerPjsip
password=CHANGE_ME_PROVIDER_PJSIP_PASSWORD      ; <--- Replace with the RocketAiFlow trunk password

; --- ENDPOINT that receives calls from RocketAiFlow ---
[providerPjsip]
type=endpoint
transport=transport-udp
context=raf-pjsipProvider      ; <--- Dialplan context where calls from RocketAiFlow enter
disallow=all
allow=ulaw
aors=providerPjsip_aor
outbound_auth=providerPjsip_auth
auth=providerPjsip_auth
force_rport=no
direct_media=no
from_user=providerPjsip
from_domain=10.0.0.10      ; <--- Replace with the RocketAiFlow server IP address
rewrite_contact=no
rtp_symmetric=no

; --- IDENTIFY: links the RocketAiFlow IP or host to this endpoint ---
[providerPjsip_identify]
type=identify
endpoint=providerPjsip
match=10.0.0.10          ; <--- Replace with the RocketAiFlow server IP address

;=============== End of configuration file

Set up the integration in RocketAiFlow

After enabling the default providerPjsip trunk, configure the RocketAiFlow workflow based on the direction you want to test.

Inbound path

Open Inbound AiAI Inbound Routing, select the providerPjsip trunk and choose the agent. Every call that arrives on extension providerPjsip and context raf-from-voip-provider is handled by the selected agent.

AI Inbound Routing configuration showing the inbound route name, active state, recording state, concurrent call capacity, and selected agent.
The first part of the route shows whether it is active, whether recording is enabled, the concurrent call capacity, and the agent that handles inbound calls.
AI Inbound Routing configuration showing the providerPjsip trunk name, route metadata, and edit or delete actions.
The second part starts before Trunk Name and shows the selected providerPjsip trunk, route metadata, and available actions.

Outbound path

Open AI Dialer FlowsDialer Campaigns and choose the trunk based on where calls should go. Select providerPjsip if outbound calls must reach your PBX.

For the providerPjsip path, set Context to raf-providerPjsip, then set Exten to the extension or number you want to contact on your server. That extension must be routed by your PBX in the raf-pjsipProvider context.

Outbound campaign settings showing trunk name, context, and exten fields for a providerPjsip campaign.
Use Trunk Name, Context, and Exten to decide where the outbound call is connected after the contact answers.
Outbound campaign schedule settings showing retry minutes, weekdays, hours, start date, until date, timezone, and save action.
Use the schedule fields to control when the outbound campaign is allowed to run.

Transfer functions

When creating transfer functions, select the raf-providerPjsip context and set exten to the extension or number you want to contact on your server. This makes RocketAiFlow dial through the configured trunk, so transferred numbers land on the PBX side in the raf-pjsipProvider context.

Transfer function configuration showing the raf-providerPjsip context selection.
In transfer functions, select raf-providerPjsip as the context so transfers dial through the providerPjsip trunk.

Test the integration

Start with one controlled test before widening the routing or campaign scope.

  1. Confirm the trunk is registered before the test.
  2. For inbound, call the number routed through the Asterisk trunk and confirm the agent answers.
  3. For outbound, start a campaign with one contact and Concurrent Call Capacity set to 1.
  4. Ask the agent to transfer to a real operator or supported department.
  5. Confirm that Asterisk receives and routes the destination correctly.
  6. Review Call Records, transcript, timing, final status, and trunk monitoring after the call.

Next Steps

Last updated on