Asterisk ON pfSense2.0.1
-
Yes, it is.
You will have to find a way to create or copy/backup db on asterisk startup and shutdown
-
Since my asterisk setup is quite simple, no database used really, I redirected everything that needs to be written to /tmp, don't mind if that's lost at reboot. Hope that workaround will be suitable.
-
I didn't bind Asterisk to any interface. It binds to all, so no firewall settings are required at all.
Phones connect through LAN, telco providers connect through WAN. Asterisk itself routes the SIP/RTP traffic.
-
So, It's working as expected(sip gateway/proxy/server) with no audio issues?
-
So, It's working as expected(sip gateway/proxy/server) with no audio issues?
Running with no issues so far for 4 days:
- gateway/router/nat
- OpenVPN server and client simultaneously
- asterisk
I also plan running Snort, but I need to upgrade RAM on the box first…
-
I wrote a small php status page integrating in pfSense's webGUI, for anyone interested.
-
Some tweaks, to make Asterisk 1.8.8.1 run smoothly on pfSense box. In my case, it's a nanobsd-system, but they should work just as well on normal systems.
/usr/local/etc/asterisk/asterisk.conf:
[directories] astetcdir => /usr/local/etc/asterisk astmoddir => /usr/local/lib/asterisk/modules astvarlibdir => /usr/local/share/asterisk astdbdir => /tmp astkeydir => /usr/local/share/asterisk astdatadir => /usr/local/share/asterisk astagidir => /usr/local/share/asterisk/agi-bin astspooldir => /tmp astrundir => /var/run/asterisk astlogdir => /var/log/asterisk
Make sure to create all the directories above if they don't exist, they are needed in order to run properly. astlogdir contains the base path where the call logs go, if that's a read-only location, simply create a symlink cdr-csv which points to a writable directory, in my case /tmp is just fine (I don't mind if I loose the file while rebooting). So it means that asterisk will look at the factory path /var/log/asterisk/cdr-csv/Master.csv actually in /tmp/Master.csv. Main asterisk log file usually goes also in astlogdir but that can be overridden below:
/usr/local/etc/asterisk/logger.conf by the end of the file:
console => notice,warning,error ;console => notice,warning,error,debug ;messages => notice,warning,error /tmp/log_asterisk => notice,warning,error
Where /tmp/log_asterisk is the logfile. Note that in my status_asterisk_log.php page it looks for this file so if you change location, don't forget to update the php script too.
/usr/local/etc/asterisk/modules.conf:
noload => res_ael_share.so noload => res_adsi.so noload => res_agi.so noload => res_calendar.so noload => res_crypto.so ;noload => res_fax.so noload => res_jabber.so noload => res_monitor.so ;noload => res_stun_monitor.so noload => res_smdi.so noload => res_speech.so noload => res_odbc.so noload => res_musiconhold.so noload => app_celgenuserevent.so ;noload => app_confbridge.so ;noload => app_minivm.so ;noload => app_originate.so ;noload => app_playtones.so ;noload => app_readexten.so ;noload => app_waituntil.so ;noload => bridge_builtin_features.so ;noload => bridge_multiplexed.so ;noload => bridge_simple.so ;noload => bridge_softmix.so noload => cdr_adaptive_odbc.so noload => chan_jingle.so ;noload => chan_bridge.so noload => chan_unistim.so ;noload => codec_g722.so ;noload => format_g719.so noload => format_sln16.so noload => format_siren14.so noload => format_siren7.so ;noload => func_aes.so ;noload => func_audiohookinherit.so ;noload => func_blacklist.so ;noload => func_config.so ;noload => func_devstate.so ;noload => func_dialgroup.so ;noload => func_dialplan.so ;noload => func_extstate.so ;noload => func_iconv.so ;noload => func_lock.so ;noload => func_module.so ;noload => func_shell.so ;noload => func_speex.so ;noload => func_sprintf.so ;noload => func_sysinfo.so ;noload => func_version.so ;noload => res_curl.so noload => func_vmcount.so noload => func_volume.so noload => res_clialiases.so noload => res_config_curl.so noload => res_config_ldap.so noload => res_config_sqlite.so ;noload => res_limit.so ;noload => res_phoneprov.so noload => res_realtime.so noload => res_timing_pthread.so ;noload => app_adsiprog.so ;noload => app_alarmreceiver.so ;noload => app_amd.so ;noload => app_authenticate.so ;noload => app_cdr.so ;noload => app_chanisavail.so ;noload => app_channelredirect.so ;noload => app_chanspy.so ;noload => app_controlplayback.so noload => app_db.so ;noload => app_dial.so ;noload => app_dictate.so ;noload => app_directed_pickup.so ;noload => app_directory.so ;noload => app_disa.so ;noload => app_dumpchan.so ;noload => app_echo.so ;noload => app_exec.so ;noload => app_externalivr.so ;noload => app_festival.so ;noload => app_followme.so ;noload => app_forkcdr.so ;noload => app_getcpeid.so ;noload => app_ices.so ;noload => app_image.so ;noload => app_macro.so ;noload => app_milliwatt.so ;noload => app_mixmonitor.so ;noload => app_mp3.so ;noload => app_morsecode.so ;noload => app_nbscat.so ;noload => app_parkandannounce.so ;noload => app_playback.so ;noload => app_privacy.so ;noload => app_queue.so ;noload => app_read.so ;noload => app_readfile.so ;noload => app_record.so ;noload => app_sayunixtime.so ;noload => app_senddtmf.so ;noload => app_sendtext.so ;noload => app_setcallerid.so ;noload => app_sms.so ;noload => app_softhangup.so noload => app_speech_utils.so ;noload => app_stack.so ;noload => app_system.so ;noload => app_talkdetect.so ;noload => app_test.so ;noload => app_transfer.so ;noload => app_url.so ;noload => app_userevent.so ;noload => app_verbose.so ;noload => app_voicemail.so ;noload => app_waitforring.so ;noload => app_waitforsilence.so ;noload => app_while.so ;noload => app_zapateller.so ;noload => cdr_csv.so noload => cdr_custom.so ;noload => cdr_manager.so noload => cdr_pgsql.so noload => cdr_radius.so noload => cdr_sqlite.so noload => cdr_sqlite3_custom.so noload => cdr_syslog.so ;noload => cel_custom.so ;noload => cel_manager.so noload => cel_odbc.so noload => cel_pgsql.so noload => cel_radius.so noload => cel_sqlite3_custom.so noload => cel_tds.so ;noload => chan_agent.so noload => chan_gtalk.so noload => chan_iax2.so ;noload => chan_local.so ;noload => chan_mgcp.so ;noload => chan_multicast_rtp.so noload => chan_oss.so ;noload => chan_sip.so noload => chan_skinny.so ;noload => codec_a_mu.so ;noload => codec_adpcm.so ;noload => codec_alaw.so ;noload => codec_g726.so ;noload => codec_gsm.so ;noload => codec_lpc10.so ;noload => codec_speex.so ;noload => codec_ulaw.so ;noload => format_g723.so ;noload => format_g726.so ;noload => format_g729.so ;noload => format_gsm.so ;noload => format_h263.so ;noload => format_h264.so ;noload => format_ilbc.so noload => format_jpeg.so ;noload => format_ogg_vorbis.so ;noload => format_pcm.so ;noload => format_sln.so ;noload => format_vox.so ;noload => format_wav.so ;noload => format_wav_gsm.so ;noload => func_base64.so ;noload => func_callcompletion.so ;noload => func_callerid.so ;noload => func_cdr.so ;noload => func_channel.so ;noload => func_curl.so ;noload => func_cut.so noload => func_db.so ;noload => func_enum.so ;noload => func_env.so ;noload => func_frame_trace.so ;noload => func_global.so ;noload => func_groupcount.so ;noload => func_logic.so ;noload => func_math.so ;noload => func_md5.so noload => func_odbc.so ;noload => func_pitchshift.so ;noload => func_rand.so ;noload => func_realtime.so ;noload => func_sha1.so ;noload => func_srv.so ;noload => func_strings.so ;noload => func_timeout.so ;noload => func_uri.so noload => pbx_ael.so ;noload => pbx_config.so ;noload => pbx_dundi.so ;noload => pbx_loopback.so ;noload => pbx_realtime.so ;noload => pbx_spool.so ;noload => res_clioriginate.so noload => res_config_pgsql.so ;noload => res_convert.so ;noload => res_mutestream.so ;noload => res_rtp_asterisk.so ;noload => res_rtp_multicast.so ;noload => res_security_log.so ;noload => res_snmp.so noload => cdr_odbc.so noload => cdr_tds.so noload => chan_h323.so noload => res_config_odbc.so
Tons of modules there, the ones uncommented in the config file will not be loaded by Asterisk. I don't use these anyways, so less memory usage, less conflicts and no errors at all with this setup.
/usr/local/etc/asterisk/sip.conf the most important one:
[general] alwaysauthreject=yes language=hu maxexpiry=600 defaultexpiry=100 registerattempts=250 registertimeout=15 allowguest = no bindport=5060 bindaddr=0.0.0.0 localnet=192.168.1.0/255.255.255.0 localnet=192.168.2.0/255.255.255.0 externhost=your.domain.name.can.be.dyndns.too externrefresh=600 jbenable=yes disallow=all allow=g729 allow=ulaw allow=alaw
If you have multiple LAN subnets, add them all here as localnet, if SIP phones are on them. It's important for security reasons.
Note bindaddr=0.0.0.0, that means Asterisk will listen directly on all interfaces of pfSense box. That means no firewall configuration is needed at all (no rules, no nat etc): clients inside LAN and servers out there will be able to talk to each other through Asterisk, nothing needs to be routed anywhere./usr/local/etc/asterisk/extensions.conf requires nothing special, just configure it as you wish.
Look in your logfile periodically. If Asterisk complains about something, a Google search on the error message usually throws back usable suggestions. Any security issues may show up in the logs too if it's the case.
Good luck!
-
I can help you on first package relase.
It's basically a XML file That install php files, create menus and install the asterisk files.
Isn't better start a topic on packages section instead of nat?
-
A moderator please move the topic in the right place.
-
I can help you on first package relase.
It's basically a XML file That install php files, create menus and install the asterisk files.
How to do that?
-
take a look on pfsense-packages at github.com
https://github.com/bsdperimeter/pfsense-packages
I'll create the xml file to install your php files.
-
Sweeeet!
I think you have achieved more stability that I coul din my original hack/post, cheers!
Maybe 2.0.1 helps, or you VoIP provider is better/closer and/or you directory redirections help….
I'll give a shot to these improvements.But most important for me, using a very poor country side 3M/128k DSL line, I really have to enable QoS in order to shut down/lower any non-VoIP traffic while a call is taking place....any input? Wizards seemed of no use for me...
-
But most important for me, using a very poor country side 3M/128k DSL line, I really have to enable QoS in order to shut down/lower any non-VoIP traffic while a call is taking place….any input? Wizards seemed of no use for me...
In sip.conf, general section add this:
[general] disallow=all allow=g729
Make sure to keep the correct order, disallow first, allow the second.
And of course check your SIP phones and your VoIP provider, do they support g729 codec (Linksys/Cisco and most SIP phones support it).
g729 is actually mpeg-compressed audio in 8kpbs, while alaw and ulaw are uncompressed pcm at 64kbps - sound quality is the same. Don't use alaw and ulaw unless you have plenty of bandwidth. -
-
Concerning the /usr/local/etc/asterisk/modules.conf, you really mean this is the whole content, or do you suggest to add your snipset at the end of any existing modules.conf file ?
same for the others ? (thouI guess you Sip.conf _is_longer than that…) -
I posted only parts of the config files, which are affected by my modifications.
In modules.conf, yes: just add what I posted at the end of the file.
In sip.conf I posted my general section, which should be at the beginning of each file. The other sections are each dependent of the particular setup, because every section defines a separate SIP client account (for a SIP phone device, for example).There's no point thus, to post my entire config files, they are mostly irrelevant for others. What I suggested, are changes which actually make the thing work at all on pfSense nanobsd.
But if one looks into asterisk's documentation, everything will become straight clear.
-
First package release is out. :)
http://forum.pfsense.org/index.php/topic,47210.msg248054.html#msg248054
I did some changes to improve stability and checks for nanobsd or normal install.