FreeSWITCH connects to the calling platform with one SIP profile. After that, call campaigns go through your PBX: from your numbers, through your carrier and at your own call rates, while the platform handles scenarios, speech recognition, the AI agent and reports.
How the call works
We start the call. The platform sends your FreeSWITCH an INVITE where the called number is the contact's number. Your dialplan must send this call out through your carrier's gateway. If the scenario transfers the contact to an operator, a call to an extension comes over the same trunk.
No registration is needed: we identify your PBX by its static public IP, and you identify us by ACL.
Connection settings
| Signaling address | pbx.autocall.kz |
| IP for the firewall | 109.233.108.218 |
| Port on our side | 5060 — UDP,
5061 — TLS
|
| Voice (RTP) | subnet 109.233.108.208/28, ports 10000–20000 |
| Codec | OPUS or PCMA (alaw) |
| Number format | +7XXXXXXXXXX |
Step 1. Firewall
Signaling comes from one address and voice from a subnet. Below is the profile port 5070, which we set up in the next step; if you keep the profile on the standard port, adjust the rule.
# signaling to the autocall profile udp dport 5070 ip saddr 109.233.108.218 accept # voice udp dport 10000-20000 ip saddr 109.233.108.208/28 accept
Step 2. ACL
conf/autoload_configs/acl.conf.xml holds the list the profile uses to let our calls in without authentication:
<list name="autocall" default="deny"> <node type="allow" cidr="109.233.108.218/32"/> </list>
Apply: fs_cli -x "reloadacl". Check that the list is visible: fs_cli -x "acl autocall list".
Step 3. A separate SIP profile
conf/sip_profiles/autocall.xml. A separate profile instead of editing external, so you don't change the behavior of peers that already work for you.
<profile name="autocall">
<settings>
<param name="sip-ip" value="$${local_ip_v4}"/>
<param name="rtp-ip" value="$${local_ip_v4}"/>
<!-- if the PBX is behind NAT, enter your public address -->
<param name="ext-sip-ip" value="YOUR_PUBLIC_IP"/>
<param name="ext-rtp-ip" value="YOUR_PUBLIC_IP"/>
<param name="sip-port" value="5070"/>
<param name="context" value="from-autocall"/>
<param name="dialplan" value="XML"/>
<!-- calls come from a trusted address, no password asked -->
<param name="auth-calls" value="false"/>
<param name="apply-inbound-acl" value="autocall"/>
<!-- OPUS if mod_opus is loaded (the standard build has it), otherwise PCMA only -->
<param name="inbound-codec-prefs" value="OPUS,PCMA"/>
<param name="outbound-codec-prefs" value="OPUS,PCMA"/>
<param name="inbound-codec-negotiation" value="generous"/>
<param name="rtp-timeout-sec" value="300"/>
</settings>
</profile>
Start the profile: fs_cli -x "sofia profile autocall start", then check: fs_cli -x "sofia status". You'll need to enter port 5070 in the dashboard when connecting the PBX.
You can also make do with the external profile: add apply-inbound-acl to it, and in the dialplan of the public context pick out our calls with a condition on ${network_addr}. A separate profile simply overlaps less with what already works for you.
Step 4. Dialplan
conf/dialplan/from-autocall.xml has two entries: extensions, and everything else out.
<include>
<context name="from-autocall">
<!-- transfer to an extension from the scenario -->
<extension name="autocall_internal">
<condition field="destination_number" expression="^(\d{3,4})$">
<action application="bridge" data="user/$1@$${domain}"/>
</condition>
</extension>
<!-- call campaign: the contact's number goes out through your carrier -->
<extension name="autocall_outbound">
<condition field="destination_number" expression="^\+?(7\d{10})$">
<!-- your number instead of the platform's internal tag -->
<action application="set" data="effective_caller_id_number=7XXXXXXXXXX"/>
<action application="set" data="effective_caller_id_name=7XXXXXXXXXX"/>
<action application="bridge" data="sofia/gateway/your-carrier/$1"/>
</condition>
</extension>
</context>
</include>
Apply: fs_cli -x "reloadxml". Adjust the ^(\d{3,4})$ pattern to the length of your extensions, and check the dialing format in your contract with the carrier: some need the number with +, some without, some with a leading 8.
CallerID override is required. In our INVITE the “from” field holds an internal tag like 59336790 (the call's number in our system). It's handy for matching CDRs against our export, but it is not a phone number. Without effective_caller_id_number the carrier will reject the call.
Encryption: TLS and SRTP
TLS parameters go into the profile, and voice encryption is enabled in the dialplan with a variable:
<!-- in the profile settings --> <param name="tls" value="true"/> <param name="tls-only" value="true"/> <param name="tls-sip-port" value="5061"/> <param name="tls-version" value="tlsv1.2"/> <!-- in the extension, before bridge --> <action application="set" data="rtp_secure_media=true"/>
In the dashboard, choose the TLS transport and, if you need SRTP, the matching voice encryption mode.
SRTP works only together with TLS. The encryption key travels right inside the SIP message: over unencrypted signaling it would go out in plain text next to the “encrypted” stream. At the same time, TLS without SRTP is a normal option, and a lot of equipment works exactly that way.
Step 5. Add the PBX in the dashboard
Go to “PBX” → “Connect a PBX”: the PBX's IP, the profile port (5070 in our example), transport, a login and password if needed, plus the limit of concurrent channels and the dialing rate. Set them no higher than your carrier allows, and we won't exceed them.
Once saved, the PBX status appears in the list: “Responding” means FreeSWITCH answers our connection checks. Then, when you create a call campaign, choose your PBX, and the estimate is calculated right away at the discounted per-second rate.
If calls don't go through
- Silence in response to our checks. The profile didn't start or listens on the wrong address:
sofia statusshows its state and port. - 403 Forbidden on INVITE. The ACL didn't match. Check
acl autocall listand that the profile hasapply-inbound-acl. - The call arrives and ends right away. No matching entry was found in the dialplan:
sofia global siptrace onandconsole loglevel debugshow which context was searched. - The carrier rejects calls. CallerID isn't overridden.
- The call connects, but there's silence. The voice subnet isn't open, or
ext-rtp-ipandext-sip-iparen't set when running behind NAT.
What it costs
When you call through your own PBX, you pay your carrier for the call minutes, and only the platform's work remains on our side, so a second costs several times less than usual. Retry attempts through your own PBX are free: the line is yours, so there is no reason to pay for the persistence of our line.
Why a separate profile instead of external?
So you don't change the behavior of peers that already work for you. A separate profile listens on its own port and has its own context and ACL. Using external also works: then pick out our calls in the dialplan by ${network_addr}.
Is registration or authentication needed?
No, calls are accepted by ACL with auth-calls=false. If you want the platform to authenticate, enable authentication on your side and enter the login and password in the dashboard.
Why does the call arrive but end right away?
The call landed in a context with no matching entry. Check the context parameter in the profile and the rules for numbers like +7XXXXXXXXXX.
Which codec should I use?
OPUS and PCMA (alaw). The platform offers both, OPUS first: it gives cleaner voice. Set OPUS,PCMA in the profile's inbound and outbound preferences. If mod_opus isn't loaded, keep only PCMA.
Are TLS and SRTP supported?
Yes: TLS in the profile, SRTP with the rtp_secure_media variable. SRTP only over TLS, otherwise the encryption key travels in plain text.
If something doesn't add up, write to support and attach the sofia global siptrace on output from a test call. It shows whether the INVITE arrived, what your FreeSWITCH answered and at which step it all ended.