For Asterisk 17 CHAN_SIP (Vanilla) click here
For Asterisk version 14 click here
For Asterisk version >= 1.6.2, 1.8, 10 click here
For Asterisk version 1.6 - 1.6.1 click here
For Asterisk versions 1.4 and 1.2 click here
|
GENERAL INFORMATION |
|
Asterisk is an extremely powerful piece of open source software that gives you the ability to run a full-featured software based PBX on your computer.
Asterisk is NOT plug and play software and because of its extremely versatile nature, it can be difficult for first-time users to setup.
Below is a basic setup guide, as well as links to several resources that you can use to assist you in configuring your Asterisk system. Due to the complexity and dynamic nature of the Asterisk Platform, unfortunately we cannot assist in fully customizing your install.
DID based routing with Asterisk
Please note, Callcentric is not responsible for preventing unwanted physical or remote access to your IP PBX. If your IP PBX is compromised, you will be responsible for all associated damages.
Please be sure to read this guide regarding securing your IP PBX solution.
|
|
RESOURCES |
|
Websites
Asterisk Homepage
Help / Support:
Asterisk Support Page
Asterisk Forum
Asterisk Wiki
Broadband Reports VoIP Forum
|
|
Configuring Asterisk 17 - (chan_pjsip) |
|
|
The instructions below are meant to assist you with the basic configuration of Asterisk (PJSIP). We recommend reading each step through in its entirety before performing the action(s) indicated within the step.
We also recommend checking which version of Asterisk your PBX is based on, as there are significant differences between each revision. To check which version your PBX is based on, please log into your PBX's command line interface and execute the command core show version. In doing so, you should see an output similar to the following:
Asterisk 17.5.1 built by root @ server on a x86_64 running Linux on 2020-06-19 22:40:24 UTCC
STEP 1 |
Setting up your trunk and global options |
|
Edit the pjsip.conf file with your favorite text editor and make the following changes:
- Add the following underneath the [global] section of your pjsip.conf file:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
- Underneath that, add the following section to define the Callcentric trunk/peer:
; -----------------------------------
; CALLCENTRIC TRUNK
; -----------------------------------
[callcentric]
type=registration
transport=transport-udp
outbound_auth=callcentric_auth
retry_interval=60
expiration=3600
auth_rejection_permanent=yes
contact_user=1777MYCCID
server_uri=sip:sip.callcentric.net
client_uri=sip:[email protected]
[callcentric_auth]
type=auth
auth_type=userpass
password=SUPERSECRET
username=1777MYCCID
[callcentric]
type=endpoint
transport=transport-udp
context=from-callcentric
disallow=all
allow=ulaw
outbound_auth=callcentric_auth
aors=callcentric
from_domain=sip.callcentric.net
from_user=1777MYCCID
sdp_owner=1777MYCCID
direct_media=no
ice_support=no
send_rpid=yes
rtp_symmetric=yes
force_rport=yes
timers=no
[callcentric]
type=aor
contact=sip:[email protected]
[callcentric1]
type=identify
endpoint=callcentric
match=204.11.192.0/22
[callcentric2]
type=identify
endpoint=callcentric
match=199.87.144.0/21
NOTE: Any instance of 1777MYCCID should be replaced with the 1777 number assigned to you by Callcentric. EXT is the three digit extension you are trying to register this UA to.
For example, 17770001234101 would register to "extension 101" on account "17770001234". However, if you are registering towards the main/default extension of your Callcentric Account (extension 100), you can simply use your 1777 number without the 3 digit extension suffix (example: 17770001234). You CANNOT register to your Callcentric Account by only using the extension number; the full 1777 number ALWAYS needs to be included.
Also be sure to replace SUPERSECRET with your Extension's SIP Password. Your Extension's SIP Password is the password you created for the extension you are trying to use. You can edit your Extension's SIP Password by logging into your Callcentric Account and clicking on the Extension menu link and then selecting the extension you would like to update.
- Add an extension to handle calls to/from your SIP phone. We've detailed a sample below (100 and 101 are extensions of your phones); for further information please refer to the documentation for both Asterisk and your SIP Phone.
; ========================
; EXTENSIONS
; ----------------------
; Extension 100
; ----------------------
[100]
type=endpoint
aors=100
auth=100-auth
allow=ulaw
context=to-callcentric
callerid="First Extension" <100>
ice_support=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
dtmf_mode=rfc4733
[100-auth]
type=auth
auth_type=userpass
password=PASSWORD
username=100
[100]
type=aor
max_contacts=1
remove_existing=yes
qualify_frequency=60
; ----------------------
; Extension 101
; ----------------------
[101]
type=endpoint
aors=101
auth=101-auth
allow=ulaw
context=to-callcentric
callerid="Second Extension" <101>
ice_support=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
dtmf_mode=rfc4733
[101-auth]
type=auth
auth_type=userpass
password=PASSWORD
username=101
[101]
type=aor
max_contacts=1
remove_existing=yes
qualify_frequency=60
NOTE: Replace any instances of PASSWORD with the desired password for each individual extension.
- Once completed, please make sure to save your changes.
|
STEP 2 |
Configuring call handling |
|
Edit the extensions.conf file with your favorite text editor and make the following changes:
- Add the following section to route calls FROM Callcentric TO your SIP Phone with extension 100:
[from-callcentric]
exten => 1777MYCCID,1,Dial(PJSIP/100)
- Alternatively, if you've acquired DIDs from us and would like to perform a DID Based Routing Solution (route inbound calls towards a specific destination based on the number that was dialed) you can use the following:
[from-callcentric]
exten => 1777MYCCID,1,Set(Var_TO=${CUT(CUT(PJSIP_HEADER(read,To),@,1),:,2)})
exten => 1777MYCCID,2,GotoIf($["${Var_TO}" = "1777MYCCID"]?to-100,s,1:3)
exten => 1777MYCCID,3,GotoIf($["${Var_TO}" = "DID1"]?to-100,s,1:4)
exten => 1777MYCCID,4,GotoIf($["${Var_TO}" = "DID2"]?to-101,s,1:5)
exten => 1777MYCCID,5,Hangup
[to-100]
exten => s,1,Dial(PJSIP/100,20)
exten => s,n,Hangup
[to-101]
exten => s,1,Dial(PJSIP/101,20)
exten => s,n,Hangup
NOTE: Any instance of 1777MYCCID should be replaced with the 1777 number assigned to you by Callcentric. EXT is the three digit extension you are trying to register this UA to.
For example, 17770001234101 would register to extension 101 on account 17770001234. However, if you are registering towards the main/default extension of your Callcentric Account (extension 100), you can simply use your 1777 number without the 3 digit extension suffix (example: 17770001234). You CANNOT register to your Callcentric Account by only using the extension number; the full 1777 number ALWAYS needs to be included.
Where DID1, and DID2 are located, please replace it with the number(s) you've acquired from our service. For example, if you've acquired the number 12125551000, the following line:
exten => 1777MYCCID,3,GotoIf($["${Var_TO}" = "DID1"]?to-100,s,1:4)
Would look something like:
exten => 17770000001,3,GotoIf($["${Var_TO}" = "12125551000"]?to-100,s,1:4)
NOTE: To explain the context above, as we will always send the phone number that is being dialed in the TO header of the SIP INVITE packet; the context will extract the DID from the TO header of the SIP INVITE packet and then perform a comparison. From the example above, if DID1 was extracted, it will send the call to the context labeled to-100, which then sends the call to extension 100.
- Add the following section to route calls FROM your SIP phone TO Callcentric:
[to-callcentric]
exten => _X.,1,Dial(PJSIP/${EXTEN}@callcentric)
- Once completed, please make sure to save your changes. If necessary restart (or start) the asterisk server using the proper command: /etc/init.d/asterisk restart, restart asterisk, service asterisk restart... etc.
|
STEP 3 |
Connect to your Asterisk PBX and verify connections |
|
To connect to your PBX System, use the IP Address (or hostname) for your Asterisk Server in conjunction with "100" (the extension created earlier which is the username) and the password for the "100 extension".
- Connect to the asterisk console by running the following from the command line:
asterisk -r
- Verify that Asterisk is registered to Callcentric with the console command pjsip show registration
*CLI> pjsip show registrations
<Registration/ServerURI..............................> <Auth..........> <Status.......>
=========================================================================================
callcentric/sip:sip.callcentric.net callcentric Registered
- Verify that your SIP phone is registered to Asterisk with the console command pjsip show endpoints
Endpoint: <Endpoint/CID.....................................> <State.....> <Channels.>
I/OAuth: <AuthId/UserName...........................................................>
Aor: <Aor............................................> <MaxContact>
Contact: <Aor/ContactUri...............................> <Status....> <RTT(ms)..>
Transport: <TransportId........> <Type> <cos> <tos> <BindAddress..................>
Identify: <Identify/Endpoint.........................................................>
Match: <ip/cidr.........................>
Channel: <ChannelId......................................> <State.....> <Time(sec)>
Exten: <DialedExten...........> CLCID: <ConnectedLineCID.......>
=========================================================================================
Endpoint: 100/100 Not in use 0 of inf
InAuth: 100-auth/100
Aor: 100 1
Contact: 100/sip:[email protected]:1030;line=jybz6e1w Avail 22.749
Identify: 100-identify/100
Endpoint: 101/101 Not in use 0 of inf
InAuth: 101-auth/101
Aor: 101 1
Contact: 101/sip:[email protected]:5260 Avail 7.933
Identify: 101-identify/101
If your output is not similar to that which is detailed above, then your SIP phone is not configured correctly.
- Disconnect from Asterisk by typing exit. Asterisk will remain running in this case.
|
STEP 4 |
That's it! You can now make a phone call |
|
You can make a test call to 17771234567, or if you are signed up for one of Callcentric's rate plans you
can place a call to a traditional landline or mobile phone by dialing either:
1 + the area code and number for calls to the US
Or
011 + the country code, area code, and number for calls worldwide
(you may also use 00 instead of 011).
|
|
|