Skip to navigation

Own SIP or phone system

Send calls from Asterisk, FreePBX, 3CX, Cisco, or Mitel to your agent

Send calls from your own phone system to your agent in Vapi for CX: Asterisk, FreePBX, 3CX, Cisco Unified CM behind Cisco Unified Border Element (CUBE), Mitel MiVoice Business, or any session border controller (SBC). Vapi for CX makes a SIP address for the agent, and your phone system sends calls to it. Any phone system can also forward chosen calls to the agent’s phone number.

  • Receive calls: At the agent’s SIP address or its phone number.
  • Transfer to a phone number: Yes, to an outside number that reaches your people.
  • Transfer to a SIP address: Offered on the agent’s SIP address, its starter number, a trunk number, and Twilio and Telnyx numbers. Your phone system must accept the transfer.
  • Return the call to their system: Offered once your phone system is linked. On Asterisk and FreePBX, Asterisk’s Dial documentation describes Dial(...,g) carrying on in the dialplan.
  • Place calls: Over a SIP trunk only.

Send calls to the agent

The agent’s SIP address takes calls from any phone system that can dial a SIP address and answer a sign-in.

1

Make the agent's SIP address

In Vapi for CX, open the agent, choose Connect your phone line, then Another carrier or my own phone system, then A SIP address for this agent. Enter an Address name. To let any username and password pass, turn off Only let calls in with this username and password first; your phone system must still answer the sign-in. Then choose Make the address. The address has the form sip:<name>@sip.vapi.ai.

2

Copy the username and password

Copy the address, the username, and the password. The password is shown only once.

3

Point a route at the address

In your phone system, send the calls the agent should take to the SIP address, and answer the sign-in with the username and password. On Asterisk and FreePBX, answer the sign-in with an outbound_auth setting on the endpoint. To send caller details, add headers whose names start with X-. The agent can read them.

4

Send a call to the address

Choose Send a call to it: check, then send one call to the address from your phone system. Vapi can’t ring a SIP address itself, so Vapi for CX waits for your call. The check passes when your call reaches the agent.

A phone system that signs in only by IP address can’t use a SIP address. Forward calls to the agent’s number instead, or use a SIP trunk (see Other options).

The number the agent sees is whatever your phone system puts in the From header.

Forward calls to the agent’s number

A phone system can forward or transfer chosen calls to the agent’s phone number: its starter number, or a Twilio, Telnyx, or Vonage number connected in Vapi for CX.

On Asterisk and FreePBX, use Dial() in the dialplan to send the call out your outside trunk to the agent’s number. For the g option, see Return the call to their system. For more information, see Asterisk’s Dial.

On a forwarded call, the agent sees the caller’s own number if your phone system and its carrier pass it on. Otherwise it sees your business’s main number.

Hand callers to your team

The agent hands callers to an outside number of your phone system. For how handoffs work, see Handing callers to people.

1

Choose an outside number for your people

In your phone system, pick the outside number of the extension, ring group, or queue that should take the caller. Use a number that doesn’t forward back to the agent.

  • Asterisk: Add a dialplan route for that number.
  • 3CX: Assign a direct inward dialing (DID) number on your trunk to the destination. For an interactive voice response (IVR) menu, ring group, queue, or digital receptionist, go to Admin › Call Handling, select the system extension, then Assigned DID Number(s). For a person, go to Admin › Users, select the user, then the General tab › Assigned DID Number(s). An unassigned DID goes to the trunk’s default route.
  • Mitel MiVoice Business: Use the Trunk Attributes and SIP Peer Profile Assignment by Incoming DID forms. For more information, see Mitel’s configuration note; its option values are examples for one provider.
2

Add the handoff

In Vapi for CX, on the agent’s Call handling tab, choose Add a handoff on the Handing callers to people card. Say when the agent should use it, choose Transfer to a phone number, and enter the outside number. For more information, see Transfer calls.

The number your people see is the caller’s own number when the agent’s line is a Twilio number connected in Vapi for CX. On the starter number, it’s the agent’s number unless the handoff shows the caller’s number. On the agent’s SIP address or a trunk number, your carrier decides. For more information, see Caller ID.

Check it: Once the handoff is live, choose Check on its row, call the agent from your phone, and ask for a person. The check shows Handoff sent when the agent hands you over.

Transfer to a SIP address

Vapi for CX offers Transfer to a SIP address on the agent’s SIP address, its starter number, a trunk number, and Twilio and Telnyx numbers. The agent passes the caller to an address on your phone system.

Vapi can add a summary and named details to the call as X- headers. A Twilio number sends only the call, and a Telnyx number sends named details but no summary. Your phone system must accept the transfer and be set up to keep and read those headers.

Return the call to their system

Vapi for CX offers Return the call to their system once your phone system is linked to the line its calls arrive on. A SIP address made under Another carrier or my own phone system links no phone system by itself.

2

Add the SIP address, if your calls arrive there

If your calls arrive on the agent’s SIP address, go to Organization settings › Telephony, choose Edit on your phone system’s row, tick the SIP address under Its calls arrive on, and choose Save. You don’t need to finish the check on the phone number.

Asterisk’s Dial documentation describes option g: When the called party hangs up, the dialplan carries on at its next step. If your dialplan sends the call to the agent with Dial(...,g), that next step can send the caller on to a queue.

Every call the agent ends would follow that path, including calls where the caller had finished, so send that path somewhere that suits both. Your system sees only that the call was answered (DIALSTATUS=ANSWER), not why the agent handed back. FreePBX runs Asterisk underneath, so add the same g option in your own dialplan.

On 3CX, Cisco Unified CM, and Mitel, use Transfer to a phone number. On any system, a call your phone company forwarded for you, such as with carrier call forwarding, can’t return. The phone company has already let that call go.

Limitations

  • A phone system that signs in only by IP address can’t use a SIP address. Forward to the agent’s number or use a trunk.
  • Calls to a phone number carry no summary. A spoken summary needs a Twilio number as the agent’s line and a person, not a queue or a menu, to answer.
  • A trunk needs a fixed public IPv4 address.

Other options

A trunk is a standing SIP connection between your phone system and Vapi. Vapi for CX has no trunk form. Set the trunk up in Vapi’s dashboard (Connect in Vapi), then pick the number in Vapi for CX. The trunk needs a fixed public IPv4 address for your system or its SBC. For addresses, ports, and firewall rules, see SIP trunking and Networking and firewall.

1

Add the trunk

In Vapi’s dashboard, select Integrations, then under Phone Number Providers select SIP Trunk and choose Configure New SIP Trunk. Add a gateway with your phone system’s fixed public IPv4 address and turn on Allow inbound calls (netmask /24 to /32).

2

Add each number

In Vapi’s dashboard, under Phone Numbers, choose Create Phone Number, then BYO SIP Trunk Number, once for each number or extension your system will dial. For an extension such as 7001, select Allow non-E164 phone numbers. Set SIP Trunk Credential to the trunk you added.

3

Pick the number

In Vapi for CX, choose Use a number already in Vapi, pick the number, then Call this number from your phone.

4

Send calls to the trunk

In your phone system or SBC, send calls to sip:<number>@<credential id>.sip.vapi.ai, where <credential id> is the ID of the trunk in Vapi’s dashboard. Use port 5060 over UDP or TCP, and set up the route as follows:

  • Put the dialed number in the To user and the real caller in From.
  • Allow Vapi’s addresses and media ports from the networking guide.
  • Put caller details in X- headers.

Calls out go over the trunk only. In Vapi’s dashboard, add your system’s host or address to the trunk as a gateway for calls out. Your system must allow Vapi’s addresses for your region or challenge for a username and password, then route the call on to its own carrier. The From is the trunk number, and your carrier decides what the person called sees.

  • Asterisk (chan_pjsip): The trunk is an endpoint, an aor with contact=sip:<credential id>.sip.vapi.ai:5060, and an identify section with match= Vapi’s addresses for your region, so calls from Vapi are recognized. Set disallow=all and allow=ulaw. Set direct_media=no so the audio stays with Asterisk (res_pjsip). To send caller details, add X- headers with Set(PJSIP_HEADER(add,X-MyHeader)=value) in a pre-dial handler. For more information, see Asterisk’s res_pjsip configuration examples and PJSIP_HEADER.
  • FreePBX: The same settings apply, because FreePBX runs Asterisk underneath. On version 16 and older, go to Connectivity › Trunks › Add Trunk › Add SIP (chan_sip) Trunk, and use the General tab, Dialplan Manipulation Rules, and SIP Settings. On version 17, choose Add SIP (chan_pjsip) Trunk. For more information, see Sangoma’s SIP trunk set up manually in FreePBX.
  • 3CX: Go to Admin › Voice & Chat › Add Trunk. Name the trunk and set the default route. Under SIP Trunk Details, pick the country and the provider, and sign in by IP address. Enter the main trunk number, add DIDs under DID Numbers › +Add, set Options › Limit to, and Save. A green status indicator means the trunk is registered. On a self-hosted install, run the firewall check first. For more information, see 3CX’s Configuring SIP Trunks.
  • Cisco: Vapi connects to CUBE, not to Unified CM. On CUBE, add Vapi’s addresses to its ip address trusted list, and add caller-detail headers with a SIP profile. On Unified CM (Release 14), start with a Device Pool in place. Set up a SIP Profile, a SIP Trunk Security Profile, and a SIP trunk. On the trunk, set Trunk Type to SIP Trunk, and set Protocol Type, Destination Address, SIP Trunk Security Profile, and SIP Profile. Then send calls to the trunk with a Route Pattern. For more information, see Cisco’s CUBE overview, SIP profiles, Unified CM system configuration guide, Release 14, and Route Pattern.
  • Mitel MiVoice Business (9.0 SP1 PR1): Fill in these forms, in order: License and Option Selection, Class of Service Options Assignment, Network Element Assignment, Trunk Attributes, SIP Peer Profile, SIP Peer Profile Assignment by Incoming DID, ARS Digit Modification Plans, ARS Routes, ARS Route Lists, and ARS Digits Dialed. To keep the caller’s number, don’t use a Default CPN. For more information, see Mitel’s configuration note.

A trunk signs in by IP address only. A username-and-password sign-in, or registering to Vapi like a desk phone, isn’t supported for calls in.

Asterisk 20.16, 21.11, 22.6, 23.0 and later can send call audio over WebSocket. This route is Coming soon. Contact sales to ask about it.