Configure your Asterisk
There are two ways to connect a FlyNumber to your Asterisk or FreePBX server. Both use SIP (SIP is the standard that VoIP apps, PBXs and desk phones use).
Forward to your server. In your panel, set the number's Call Handling to Forward to SIP / VoIP Address. Enter your server's public IP or hostname as the Host, and the extension you want to ring as the Username, or leave it blank to receive the call addressed to your FlyNumber. Our VoIP setup guide explains each field. Incoming calls carry no per-minute charge: unlimited incoming minutes*.
Register your server to us. Set Call Handling to FlyNumber SIP instead and we issue SIP credentials. Add them to Asterisk as a registered trunk and calls flow both ways, with outgoing calls showing your FlyNumber as the caller ID. Nothing on your side needs to be reachable from the internet. See the FlyNumber SIP setup docs.
Whichever you pick, allow our server IP, 138.197.42.26, through your firewall and ACL, and limit codecs to G.711 (ulaw and alaw). The examples below cover both approaches.
Examples
All calls from FlyNumber arrive from sip.flynumber.com (138.197.42.26) with no SIP authentication, so the peer is matched by IP. Use the pjsip.conf example on Asterisk 13 and later; chan_sip was removed in Asterisk 21, so the sip.conf example is only for older installs. Test with the from-flynum context first, then route to your own extensions.
extensions.conf
[from-flynum]
; test: answer and echo the caller's audio back for up to 10 minutes
exten => _X.,1,Ringing
exten => _X.,n,Answer
exten => _X.,n,Echo
exten => _X.,n,Wait(600)
exten => _X.,n,Hangup
; production: send every FlyNumber call to extension 101 instead
; exten => _X.,1,Dial(PJSIP/101,30)
; exten => _X.,n,Hangup
pjsip.conf (Asterisk 13 and later)
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
[flynumber]
type=endpoint
context=from-flynum
disallow=all
allow=ulaw
allow=alaw
dtmf_mode=rfc4733
direct_media=no
rtp_symmetric=yes
force_rport=yes
aors=flynumber
[flynumber]
type=aor
contact=sip:138.197.42.26:5060
[flynumber]
type=identify
endpoint=flynumber
match=138.197.42.26
sip.conf (Asterisk 20 and older, chan_sip)
[flynumber]
host=138.197.42.26
type=peer
context=from-flynum
insecure=invite,port
dtmfmode=rfc2833
disallow=all
allow=ulaw
allow=alaw
nat=force_rport,comedia
Forwarding over TLS
If you set Transport to TLS in the panel, your server must answer on port 5061 with a TLS transport and accept SRTP. On PJSIP that means a type=transport section with protocol=tls, a certificate, and media_encryption=sdes on the endpoint. A TLS transport with media encryption left off connects and then fails every call. We don't strictly validate your certificate, so a self-signed one works. UDP is fine for most setups; pick TLS when you need the encryption.
FlyNumber SIP as a registered trunk
With Call Handling set to FlyNumber SIP, copy the username and password from the SIP Accounts card in your panel into a registration. Your PBX then registers to sip.flynumber.com like any softphone would, on port 5061 with TLS (recommended) or 5060 over UDP. Turn on Enable outbound calls for the account if you want to dial out, and dial in full international format, for example 12125551234 or 441138709191.
pjsip.conf
[flynumber-sip-reg]
type=registration
outbound_auth=flynumber-sip-auth
server_uri=sip:sip.flynumber.com:5061\;transport=tls
client_uri=sip:YOUR_USERNAME@sip.flynumber.com
retry_interval=60
expiration=300
[flynumber-sip-auth]
type=auth
auth_type=userpass
username=YOUR_USERNAME
password=YOUR_PASSWORD
[flynumber-sip]
type=aor
contact=sip:sip.flynumber.com:5061\;transport=tls
[flynumber-sip]
type=endpoint
context=from-flynum
transport=transport-tls
outbound_auth=flynumber-sip-auth
aors=flynumber-sip
from_user=YOUR_USERNAME
from_domain=sip.flynumber.com
disallow=all
allow=ulaw
allow=alaw
dtmf_mode=rfc4733
media_encryption=sdes
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
[flynumber-sip]
type=identify
endpoint=flynumber-sip
match=sip.flynumber.com
For UDP instead of TLS, use port 5060, drop \;transport=tls, point transport at your UDP transport and remove media_encryption=sdes. FreePBX users enter the same values in a PJSIP trunk: SIP Server sip.flynumber.com, the username and password from the panel, and Media Encryption set to SRTP via in-SDP when using TLS. The docs' FlyNumber SIP technical reference lists every protocol detail.
Asterisk works with every virtual phone number we offer, in all 90 countries on our coverage page. See pricing for monthly rates and the Rates page for per-minute calling.