In order to make and receive calls, please follow this generic guide. Your particular situation may be different from one provider to another.
This guide assumes that you have a FreePBX installed and asterisk running. The IP of the FreePBX server is 192.168.41.8 and the web server is running on the same address. The Gateway router is at 192.168.41.1
The schematics of the call can be presented as follows:
Incoming calls
You have a caller that is trying to make a call to reach you. This call is first finding your VoIP provider and the VoIP provider is trying to establish the contact with your PBX. The PBX box in your case is behind NAT, so the provider reaches your router at WAN address and then gets routed by the router to the specific port on your FreePBX box.
Inside FreePBX box, the Asterisk server finds the inbound route and sends the inbound call to the destination on this route. The destination is usually either an extension or a group of extensions. You can think of the "extension" as a VOIP outlet that is connected to the actual phone. Then using the phone, you either answer the call or reject it or worward, put on hold etc.
Outgoing calls
You are trying to reach someone by dialing the number on your office phone. The extension uses the outbound route to connect to the the VOIP provider. The extension is not connecting to the VOIP provider directly, instead, it uses so called "trunk" to connect there. The trunk is like an extension that connects to a remote FreePBX that is hosted by your VoIP provider. The provider then forwards the call to the recipient.
So, as you can see, you will need to set up a few things on the Asterisk and your firewall.
For the incoming calls on your Asterisk server side you will need:
Inbound route set up.
Here you add a route and set up the destination for it
As you can see, this route takes calls with any DID (phone number) and any CID (caller ID) and passes it to the "ring group". Ring group allows several phones to ring at the same time, or one by one.
In order to set up a ring group, you go to "Applications -> Ring Groups"
Ring groups link together the extensions. In order to manage the Extensions, you go to "Application-> Extensions"
The Extension settings allow you to create credentials that you later input into the phone settings so the phone can connect using this extension.
For example -
Set the caller ID, enable voicemail on the next tab. The password that you put into your Cisco IP Phone is "secret". The other password below - is a user password for web login (not related to the phone making calls). That one is used on web for fax receiving, etc. All you need for your phone settings is Extension number (201 in this case) and "secret".
Practically, you set it up from the end. Create the extensions first, create a ring group, add the extensions to the ring group. Create a route, set up destination as "ring extension".Outbound route set up.
Add new route if needed
Settings - indicate your time zone and trunk you want the outgoing calls to use.
Also, make sure the "Dial patterns" have this for North America . This is important! The other patterns allow you to call 911 etc.Set up
Trunks
Here you will put the settings for your SIP account. Obviously, any time you change the account, these settings will change.
Set up outgoing and incoming sections the way your provider instructs you. For example, this page references on how to do it for Altotelecom . On incoming, place an authentication string properly formed. If the provider authenticate you by IP, you may skip this step.
If your are just changing the VoIP provider, this is the only settings you have to change. The rest of the set up is more related to your office needs and only the trunk binds you to the particular provider.
Again, when setting a new system, you go from the last step to the first. Set up trunks. Set up Routes and choose the trunk in the drop-down box.
Outside Asterisk, you will need to set up the firewall. Allow connections from your VoIP provider to be forwarded to your FreePBX server at 192.168.41.8 port 5060 or 5061 depending on the version of the asterisk and your SIP drivers. Also, open a port range for voice traffic.
[*]Verifying the system works. Go back to your Asterisk and go to Admin->CLI
type the command: pjsip list registrations
You should receive the output similar to this:
I use sip driver on my extensions, so you have to use the similar pjsip command.