CentOS CentOS 5.2 Tutorials CentOS 5.3 Tutorials CentOS 5.4 Tutorials CentOS 5.5 Tutorials CentOS 5.6 Tutorials CentOS 5.7 Tutorials CentOS 5.8 Tutorials CentOS 6.0 Tutorials CentOS 6.1 Tutorials CentOS 6.2 Tutorials CentOS 6.3 Tutorials CentOS 6.4 Tutorials Fedora MISC

Transferring Files using Netcat

Netcat is a great cross platform tool, it can be used for just about all things related to or involving TCP or UDP. Its most practical use is transferring files using Netcat from one machine to another via a network. Where non *nix people usually don’t have SSH installed or set-up, it is much faster to transfer files using Netcat than setup SSH. Netcat is just a single executable, and works across all platforms (Windows,Mac OSX, Linux).

On the Netcat receiving end

# nc -l 1234 > out.file

This will start Netcat listening on port 1234.

On the Netcat sending end

# nc -w 3 [destination] 1234 < out.file

This will connect to the receiver and begin transferring files using Netcat.

If you’d like to transfer files quicker (*nix only I am afraid), you can compress the file during sending process

On the Netcat receiving end

# nc -l -p 1234 | uncompress -c | tar xvfp -

On the Netcat sending end

# tar cfp - /some/dir | compress -c | nc -w 3 [destination] 1234

Firewall Migration and Planning Guide

firewallPlan and document existing firewall
Planning and documenting the migration of the firewall is critical, without it you’re doomed. Over time configurations grow as rules and networks are added for specific purposes are often superseded or simply forgotten.

You need to document these as well as any other additional services or features (i.e. DHCP, DNS or VPN). This will assist you while you recreate the policies behind the firewall rules.

You can download a sample Firewall Planning Guide here:

[download id=”4″]


Asterisk LibPRI outbound MOH fix

This is a very simple and effective ‘work around’ for the popular Asterisk outbound Music on Hold (MOH) issue. This is a default Asterisk setting that will play your own MOH on an outbound call, which has proved to be problematic. More often than not, and all the time with certain dialed numbers (depending on the dialed company’s PBX system), the caller (you) is put on hold, and your Asterisk system plays your [default] MOH music. When the call is unholded by the remote party, the call on your side is not retrieved, resulting in your MOH being played indefinitely, loosing the call – very unprofessional, and you are guaranteed this will happen to your CEO, to his most frequent dialed business partners !

Reason: Within the Asterisk Kernel, it is coded to play the [default] Message on Hold (MOH) class, which is the same for all calls made internally to another extension. You can create many MOH classes, but only the [default] is used for external calls. It is also a bug in the way LibPRI processes ISDN on-hold frames, and won’t be fixed in current Asterisk 1.4, but will be an option to turn this off in DAHDI Asterisk 1.6 (so I have read). We have tried and tested 1.6, and was introduced to a whole new range of problems (other advice – stick to 1.4!). Asterisk also has issues interpreting certain DTMF tones, so does not know when to unhold a call, because never receives or interprets the unhold tone sent by remote PBX system. On the ‘Outbound Routes’ option in FreePBX, you can set the MOH to none, but does not work, still uses default.

Relates to:

Elastix – My best choice of a complete Asterisk PBX Solution!
Other Asterisk installed by source, possibly on Ubuntu

All the above are available for ISO download, and based on CentOS 5 Core.


a) Hire a very expensive Asterisk Guru to recode your current Asterisk Kernel to suit you (other issues will arise, and you will have to folk out a lot more money)…


b) Simply do it yourself with the tools provided in three easy steps! After many late nights Googling and trying to figure out the Kernel / Code myself, I came up with a very simple, right in front of you, simple solution. The only downfall here, is that internally dialed extensions (you to a work mate) will not play music on hold, the person on hold will only hear silence, which is worth it!

Create a new Music on Hold class, and configure the music.

Firstly browser to your FreePBX GUI, navigate to ‘Music on Hold’, select ‘Add Music Category’, and give it a name. For now I will name it CompanyA.

In your Linux console, this will create a folder in /var/lib/asterisk/mohmp3/CompanyA/

# ll /var/lib/asterisk/mohmp3/

Copy your music from /var/lib/asterisk/mohmp3/ to this new directory:

# cp /var/lib/asterisk/mohmp3/*.mp3 (or WAV) /var/lib/asterisk/mohmp3/CompanyA

Change ALL your Inbound Lines and Queues

Next Change ALL your Inbound Lines and Queues within FreePBX GUI to use this new MOH class ‘CompanyA’. You dont have to do this for inbound Fax lines if you are making use of Fax to Email, like Hylafax. I left mine as Default.

You can script this, but its a much longer process to create a script, rather than simply doing it via the GUI. If you backup your asterisk folder, or rsync it, then change a field or two in FreePBX, then run rsync again or diff on the files, it changes more than one config file, and just becomes confusing. Get your IT desktop guy to do the manual work, otherwise please post the script!

Edit config file and restart Asterisk

Finally all you need to do is edit a config file, reload Asterisk, and you’re done!

# vim /etc/asterisk/musiconhold_additional.conf

Comment out the [default] MOH class to point to /dev/null (this deactivates the MOH feature completely for this class). Comment out and add for easy roll-back, always think ahead!




FINALLY – in FreePBX, ‘Reload Asterisk’… and you’re done!

Result: From here, when you make an outbound call, and you are put on hold, you will hear the dialed party’s Music on Hold (or whatever they have) instead of yours. This reassures you that the call has not dropped, and you are still on hold. There is no DTMF tones or frames that your Asterisk box has to interpret, taking the fault away from your side. Your CEO will be happy that now he can actually wait on hold for a board member and not be cut off, and wondering why they called person has not come back to him.


IPCop: SARG, Network Graphs and iNode issues resolved

After many a moon I noticed that IPCop wasn’t behaving like it should, so a quick glance at the System Status Graphs showed that the inodes usage was 100%.

After laboriously troubleshooting the various possibilities I found that the SARG for IPCop I installed and then “hacked”, to work with the latest version, was the culprit. This caused the inodes not to be cleaned up correctly, which in turn slowly but surely filled the partition.