[How-to] Install Asterisk 13 in a FreeNAS 9.3 Jail

Status
Not open for further replies.

DaveF81

Explorer
Joined
Jan 28, 2014
Messages
56
[How-to] Install Asterisk 13 in a FreeNAS 9.3 Jail

What is Asterisk?

From Wikipedia:

Asterisk is a software implementation of a telephone private branch exchange (PBX); it was created in 1999 by Mark Spencer of Digium.[1][2] Like any PBX, it allows attached telephones to make calls to one another, and to connect to other telephone services, such as the public switched telephone network (PSTN) and Voice over Internet Protocol (VoIP) services. Its name comes from the asterisk symbol, *.

You can find out more information about Asterisk at http://www.asterisk.org/

This is a quick guide on how to install Asterisk 13 into a jail running on FreeNAS. This guide only provides detail on how to install Asterisk, it does not provide instruction on how to configure it.

This guide has been updated for FreeNAS 9.3. I can make no guarantee it will work with earlier versions of FreeNAS.

Last updated 20th December 2015.

Revision history:
  • 20th December 2015 - Attached a sample configuration for use with Canadian VoIP provider, freephoneline.ca. (See asterisk13-config.zip) and removed guide for FreeNAS 9.2.x as it is out of date.
  • 13th December 2015 - GUI for Asterisk 1.8 has been deprecated for some time. Updated How-to to reflect that
  • 1st April 2015 - How-to revised for FreeNAS 9.3
  • 6th April 2014 - Minor edits, typo fixes.
  • 5th April 2014 - Update jail set-up, make Asterisk GUI optional, expand on DAHDI.
  • 30th March 2014 - Initial document.
INSTALL ASTERISK 13 IN A FREENAS 9.3 JAIL
  • Log in to your FreeNAS server
  • Select Jails
  • Select Add Jail and give it a name. Don't select any template. This is a basic FreeBSD jail.
Once your jail is running, open up the shell. You'll need to update the package manager before proceeding:
Code:
pkg update

Once up to date, you can install Asterisk 13 by simply running:
Code:
pkg install asterisk13

Accept to upgrade 'pkg', once done, you'll be prompted to install Asterisk and required dependencies. Accept this to continue.

Add 'asterisk_enable' to /etc/rc.conf, so that Asterisk starts with the Jail:
Code:
sysrc asterisk_enable=YES

You can now start Asterisk, by running:
Code:
service asterisk start

There is no GUI for Asterisk 13. The Asterisk GUI is now deprecated. You can try following the instructions below should you wish, but I advise against it. Learn how to modify the configuration files manually and read the documentation for Asterisk. At the end of the day, there are really only three files to edit: sip.conf, extensions.conf, and voicemail.conf. Example configuration for use with freephoneline.ca is attached.

Troubleshooting/Work-arounds

During the Asterisk installation, some files/directories will not have been assigned the correct permissions. It's recommended that you change ownership of the following files/directories to the Asterisk user:

Code:
# chown -R asterisk:asterisk /usr/local/etc/asterisk/ /usr/local/lib/asterisk /usr/local/share/asterisk /var/lib/asterisk
# chmod 644 /usr/local/etc/asterisk/*
 

Attachments

  • asterisk13-config.zip
    3 KB · Views: 506
Last edited:

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Good writeup m0nkey_. ;)
 

jeremi

Dabbler
Joined
Dec 25, 2013
Messages
14
very good post

i ave hardware question:
wat do i need hardware wise to make this work dose the freenas server need a modem or do i need a cisco sip/voip gateway on my network to make call to the outside world

cisco spa3102 it convert voip through the analog landline
 

DaveF81

Explorer
Joined
Jan 28, 2014
Messages
56
With Asterisk running in a Jail, this will only work with SIP/IAX trunks. Hardware requires kernel module loaded. If you're brave, you can re-mount the FreeNAS root filesystem and load them (not recommended). If you're not sure what SIP trunking is, check http://en.wikipedia.org/wiki/SIP_Trunking
 

sgregory

Contributor
Joined
Apr 3, 2014
Messages
105
Thanks for the post. Worked like a charm. Now to figure out 'asterisk'
 

Chris Dent

Cadet
Joined
Jan 19, 2015
Messages
6
Thanks for your post.

I followed your instructions, but in FreeNAS 9.3. In this version you can't select the type of jail. It makes a standard jail.

At the end, when I run
service asterisk start

It responds:
asterisk does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)


Hope you can help.
 

DaveF81

Explorer
Joined
Jan 28, 2014
Messages
56
I'll have to update the post for 9.3. I'll have it up soon.
 

SilentSam

Cadet
Joined
Feb 8, 2015
Messages
2
Dave,
Any estimated time frame for an updated guide on how to install Asterisk and Asterisk GUI into a jail running on FreeNAS 9.3?
I am about to install FreeNAS as soon as I finish reading the how to install guide for it. I have heard about FreeNAS and Asterisk and read tidbit's about both, but I am former Windows Home Server avid user
and soon to be FreeNAS newbie.
I hope to re-use my HP MediaSmart Server EX475 AMD based cpu.

Hope to hear from you soon. :)
 

Hisma

Explorer
Joined
Mar 23, 2013
Messages
87
Guys,

So if anyone wants to get asterisk up and running on freenas 9.3, it's extremely easy.

I can sum it up really quickly.

After you create your jail and access the shell...

Code:
pkg install libffi

(may not even be necessary since the new pkg system installs dependencies automatically. But since it was in the old tutorial it was the first thing I did.
Code:
# pkg install asterisk11

only takes about 5 minutes or so to complete. Not long at all. Again, this is thanks to the new pkg system.
Code:
# pkg upgrade

This makes sure all installed packages are are running their latest version. It will update quite a few things.

That's it. Then you can add asterisk_enable="YES" to rc.conf and it will start no problem.

So basically, 9.3 made things even easier, as far as asterisk goes (getting apache going in 9.3 is a bigger pain than it was in 9.2 though, so it's not all sunshine & roses).

I haven't gotten to installing the GUI yet, but giving y'all a heads up that I got asterisk up and running in about 10 minutes or so using the commands above.
 

Hisma

Explorer
Joined
Mar 23, 2013
Messages
87
actually checking the ports db there is a much newer version of asterisk.

so change "asterisk11" to "asterisk18".

asterisk11 (1.1) is very outdated. This guide even alludes to installing asterisk 1.8.

As for the asterisk GUI, I am going to spring for freepbx, after doing some very light googling around, it seems to be heavily favored among users.

Here's a guide to install freepbx on freebsd 9.1:
http://wiki.freepbx.org/display/HTGS/Installing+FreePBX+on+FreeBSD+9.1

It will obviously take some maneurvering around to get it to work on 9.3, but I reckon it can be done. I'm going to give it a shot tonight.

If anyone wants me to post a "how-to", let me know.
 

Chris Dent

Cadet
Joined
Jan 19, 2015
Messages
6
Thanks a lot!! I see that asterisk is running. But I couldn't install FreePBX. I followed the guide you linked.

Based on that guide I have Apache and Mysql running but not FreePBX.

I would appreciate a lot if you could post the how-to that you kindly offer.
 

Chris Dent

Cadet
Joined
Jan 19, 2015
Messages
6
I installed the Asterisk GUI but it's not accepting the password I placed in manager.conf... :(

Edit:
I placed before secret:
[admin]

Then worked.
 
Last edited:

Chris Dent

Cadet
Joined
Jan 19, 2015
Messages
6
After I login a (never ending) loop happens:

Your configuration will now be upgraded to work with the latest version of GUI.
An automatic backup of your old configuration is available from the backups panel.

Edit:
Solved:
cd /usr/local/share/asterisk/static-http
chmod 777 config/
 
Last edited:

Hisma

Explorer
Joined
Mar 23, 2013
Messages
87
good job guys.

Well I spent nearly the entire day trying to get freepbx working. I got to the point to where I could get it to start, could download packages and poke around the admin panel. But, I couldn't get it 100% functioning. Even to get it to that point, it required significant "hacking" to get it even started.

The fact is that freepbx is developed around centos. on the dev page they recommend installing freepbx on centos. As I said, I was able to get it working, but it took tons of trial and error, editing script files to match bsd directory structure, and installing additional packages that aren't native to bsd to get it working (gng, bash, su, etc). In the end, even if I got it working, I don't think I would be happy w/ the end result, as I would likely encounter issues further down the line.

Suffice to say, unless someone manages to officially port freepbx to freebsd, I wouldn't waste your time like I did.

Stick to asterisk gui which is officially supported by freebsd.

Or, simply make a phpvirtualbox jail, and install the asterisknow OS here:
https://wiki.asterisk.org/wiki/display/AST/Installing AsteriskNOW

It's not as "fulfilling" as getting it all working natively in a regular jail, but I personally plan to go that route as I want the most robust & feature-filled gui I can get. Once I get more familiar with asterisk, I may end up switching to the pure cli.

Oh well, at least we have multiple working solutions here.
 

Hisma

Explorer
Joined
Mar 23, 2013
Messages
87
asteriskNOW is up and running great in my phpvirtualbox jail. I simply downloaded the ISO, made a new linux VM & did a fresh install from the ISO file.

highly recommend it as an alternative to install asterisk straight into a jail, especially for asterisk newbs (like myself)
 

Chris Dent

Cadet
Joined
Jan 19, 2015
Messages
6
Hi,

I tried to install asterisk without JAIL and no success. When I put this command:

pkg install asterisk18

I receive:
Updating local repository catalogue...
pkg: file:///usr/ports/packages/meta.txz: No such file or directory
pkg: repository local has no meta file, using default settings
pkg: file:///usr/ports/packages/digests.txz: No such file or directory
pkg: Unable to update repository local
All repositories are up-to-date.
pkg: No packages available to install matching 'asterisk18' have been found in the repositories

Is it because repository doesn't has asterisk on it? how can I solve this?

Thanks for your help.
 

DaveF81

Explorer
Joined
Jan 28, 2014
Messages
56
Initial post has been updated for FreeNAS 9.3, using Asterisk 13 from the pkg repository. It's only taking me nearly a year to update! :tongue:
 

Chris Dent

Cadet
Joined
Jan 19, 2015
Messages
6
Thanks! I presume this is for JAIL, right?

without JAIL I type:

pkg update

And I receive:

Updating local repository catalogue...
pkg: file:///usr/ports/packages/meta.txz: No such file or directory
pkg: repository local has no meta file, using default settings
pkg: file:///usr/ports/packages/digests.txz: No such file or directory
pkg: Unable to update repository local

Can I use hardware like E1 and FXO cards on JAIL installation?
 

DaveF81

Explorer
Joined
Jan 28, 2014
Messages
56
Yes, in a jail. If you're trying to install it on the root filesystem, you're in for a bad time.

Your hardware devices are not going to work in a Jail, unless of course you can load the kernel drivers in FreeNAS. I'd suggest against trying to load any kind of kernel module loaded as FreeNAS is an appliance, as making changes to the root filesystem may not be preserved with updates.
 
Status
Not open for further replies.
Top