Here I’m going to show how to setup extension to extension calling between 2 FreePBX systems using an IAX2 trunk.
There are 2 steps to this. First we need to create an IAX2 trunk on each system. Each trunk will configure the inbound and outbound user/connection. Then we will set up an outbound route on each system to tell FreePBX what calls to pass over the trunk. We will need extensions in different number ranges at each site for this to work.
Here are the details of the systems –
IP Address : 126.96.36.199
Extension Range : 3000 – 3999
IP Address : 188.8.131.52
Extension Range : 4000 – 4999
SETTING UP THE TRUNKS
First we create an IAX2 trunk on PBX1 with the following details –
I’ve used a few different Android SIP clients as extensions on FreePBX and my current favourite is CSipSimple
Installation and setup is straight forward. There are several built in configuration profiles for call providers, or you can choose advanced and enter your FreePBX server details to use CSipSimple as a FreePBX extension.
Setting up an Inbound Number with FreePBX can be tricky. There are a few different things to consider and in the past I’ve written some posts for setting up specific call providers. This post will try to describe what the different options mean, and will hopefully help you set up a DDI number with any provider.
The first thing you need to know is that all SysAdminMan templates have “Allow Anonymous Inbound SIP Calls” set to No. This means that an unknown SIP server can not pass a call to your system to be processed. This is to help prevent hackers route calls through your system. It’s strongly recommended that you leave Anonymous SIP calls set to No, unless you really know what the implications are when setting it to Yes.
So, if we don’t let any SIP servers pass calls to us then we need a way to tell FreePBX to allow calls from our DDI provider. We do this by setting up a SIP trunk.
Setting up a SIP trunk
We are going to put all of the settings under “Outgoing settings”, and leave “Incoming settings” blank. This is a little confusing to say the least! but we are not creating a user on our system for the call provider to connect to, we are just allowing their IP. So we add a new SIP trunk and see these details –
When you use a FreePBX server there are various options you have when choosing a device for making calls.
Here are some of them …
Physical desk phone
A physical VOIP desk phone connects to your FreePBX server over a broadband connection. One of my current favourites is the Yealink T22P pictured here. It has softkeys for selecting things like do-not-disturb and call history. There are 3 lines so you can do things like conference in another caller to an ongoing call. The sound quality is great and there is also a built-in speaker phone.
There are other makes and models, ranging from phones with no display to those with full colour displays. Any phone that is ‘SIP compatible’ should work, but some phones will work better with FreePBX, especially things like the voicemail waiting light and the softkey menus.
If you are rolling out a lot of phones it’s worth checking the phone is compatible with the FreePBX module called End Point Manager. This allows you to configure and manage phones centrally (on the FreePBX server) rather than configuring each phone individually.
The phone pictured here costs around £80 GBP.
Benefits : Fairly straight forward to configure. Good sound quality. Lots of features.
Negatives : Can be expensive
An ATA adapter is a device that turns a traditional analogue phone in to a VOIP phone. You plug your phone in to the ATA, and your ATA in to your broadband router.
This is an update the this post (http://sysadminman.net/blog/2012/asterisk-elastix-queue-and-agent-wallboard-3604) which had some code for a basic wallboard. This version is updated a little with better handling of some of the output from Asterisk. It also uses Twitter Bootstrap to make the wall board a little prettier. Here is an example screenshot of the new version –
Today’s (this week’s!) project was to try to allow users to dial out from Asterisk, but prefix the phone number so they can dial out ‘as’ someone else. In our case we want to change the outgoing CLI and also the account code, so someone else on our A2Billing system gets billed for the call. The setup is that there are PA’s who take and make calls on behalf of different clients. The clients are to be billed for any calls a PA makes on their behalf.
The idea was to have a prefix per-client, starting *01* for client 1, *02* for client 2 etc. Whilst a database-linked solution would be better, I am not that good with asterisk dialplan yet, nor with PHP, so here is the down-and-dirty method.
One thing I learned whilst looking at the dialplan, a very useful feature is the dumpvars macro. You can add it into a context (such as the macro-dialout-trunk-predial-hook context in our case) to find out what the status of various variables are just where you are trying to program them. You call it like this:
exten => s,n,Macro(dumpvars)
This information is provided without warranty – although I have been using this configuration successfully for over 12 months.
In FreePBX there is a module which has changed it’s name but remains an extremely useful one. Day/Night control, now called Call Flow Control, allows you to set a toggle-switch to change how a call is routed within the system. Typically this could be a Day or Night mode service, but you might also want a ‘We are closed for Christmas’ message for example. Using an announcement as the ‘night’ destination, using a recording linked to a feature code before going to a voicemail box, gives you a very quick way to temporarily close the office, with whatever message your users want to record themselves.
However, the module has a limitation; it only allows you to setup Callflows 0-9, for a total of 10 call-flow options. Should you need more than this, you would either need to program them manually, or else you can edit the module thus:
(This information was taken from here: http://www.freepbx.org/forum/freepbx/users/number-of-day-night-mode-controls-available-in-freepbx although this guide is a more basic version of the proposed patch)
So you want to create a customised report from your sysadminman VPS, to email you some call stats maybe once per week? You may find this info invaluable.
Setup: Asterisk 1.8, FreePBX 2.9, sysadminman VPS
Goal: some call stats via email
Originally I had wanted to install something like CDRstats or asternic but this is now a critical VPS and my backups aren’t what they should be… so yes I was scared partly and also when I installed CDRstats on a test system I couldn’t really get it to work properly. So I wrote my own, following on from the very basic database querying I started with in this post.
So I will assume some basic knowledge of programming or at least the ability to copy/paste/edit. Familiarity with HTML would be useful.
I like Notepad++ because I use Windows, and so using WinSCP to connect to the box and then right-click to edit my PHP script was very handy rather than editing in an SSH console via nano. Also the MySQL Workbench allows connection via an SSH tunnel to your MySQL database, so you can check that your MySQL queries are going to work.
Create your script in /var/www/html/admin
Mine is called Weekly-call-stats.php
I started doing some training videos on YouTube about a year ago when I was getting more requests for FreePBX and A2Billing training than I could cope with. The videos have proved very popular and today I was looking at some of the reports produced by YouTube.
The graphs below are just for the last 3 months as YouTube only started producing ‘Minutes Watched’ statistics from September 1st.
Just in the last 3 months there have been 10,000 views and over 25,000 minutes watched!
and it looks like VOIP is a pretty male dominated arena –
Click here to check out the SysAdminMan YouTube channel yourself
I have produced some video guides for getting started with AsteriskNOW. These are based on FreePBX 2.10.
There will be some more guides to follow including configuring IVRs, Voicemail and Call Recording.
1 – Configuring an extension
Creating an extension in FreePBX then doing a echo test call with a softphone
2 – Outbound calling
Adding a SIP call provider to the system and making an outbound test call using the extension created earlier
3 – Inbound calling
Setting up a DID/DDI number for the system and making a test call