Archive for the ‘Linux’ Category.

Using callwithus with Asterisk, FreePBX and A2Billing

The instructions below assume that you have got Asterisk, FreePBX and A2Billing installed and working together.

Below are the first steps in setting up a callwithis DID number and passing the call through to A2Billing. This number can then be used as an access number for your calling card clients.

Once you’ve signed up for your callwithus account and purchased your DID number the next thing you want to do is modify how your DID number gets presented to your Asterisk box so you can route it to a2billing.

On the callwithus website, click on DID on the left hand menu and then locate the DID number you want to use and click ‘edit’. Now under ‘DESTINATION’ add ‘/yourdidnumber’ the the end of ‘SIP/youraccountnumber’

This will cause callwithus to append your DID to the call details when it is passed through to your Asterisk server. See the image to the right for details.  

 

 

 

Next we want to go into FreePBX and register A2Billing as a ‘Custom Destination’.

If you don’t have the ‘Custom Destination’ menu in FreePBX you will need to go to the modules menu option and install the ‘Custom Applications’ module.
Enter ‘a2billing’ as the Description and ‘custom-a2billing,${EXTEN},1′ as the custom destination

 

 

Now we want to configure our callwithus trunk.

 

 

 

Configure your trunk as in the images here, obviously using your username and password. More information on how to setup your trunk can be found on the callwithus website here.

 

 

 

Now we just need to configure our inbound route. This inbound route decides what happens to a call when it is presented to your Asterisk server. Give it a meaningful description and then in the ‘DID Number’ box enter your callwithus DID in the same format you used in step one above.

Scroll down to the bottom of the configuration page and you should see the ‘a2billing’ ‘Custom Application’ that you setup earlier. Select this and then click on Submit. Don’t forget to click on ‘Apply Configuration’ at the top of the FreePBX page to get Asterisk to read your changes.

 

And that’s it for now. If you call your callwithus DID it should come to your Asterisk box and then be passed to a2billing. Depending on how you’ve got a2billing configured will determine what happens to that call now.

I’ll discuss in a later post some ideas about how to configure a2billing

Rhapsody, Ubuntu and Firefox 3

If you’re having trouble logging in to the Rhapsody website and you are running Firefox 3 on Ubuntu (or possibly other flavours of Unix) then the following might be useful.

If, every time you try to log in to the Rhapsody website, you are asked to install the Firefox plugin, even after apparently installing it, then the plugin is not getting installed correctly.

To install the plugin manually try -

Start a shell prompt

cd .mozilla/plugins/
wget http://forms.real.com/real/player/download.html?f=unix/rhapx/RhapsodyPlayerEngine_Inst_Linux.xpi&install=rwih
unzip RhapsodyPlayerEngine_Inst_Linux.xpi

Then restart Firefox.

Hopefully, now you should be presented with a username/password box when you try to log in rather than the plugin install prompt.

Delicious bookmarks disappear

I really like the delicious plugin for firefox and have been recommending it to people for a while now.

Recently though using the plugin with firefox 3 on both Windows and Linux (Ubuntu) has been a real pain. “Favorite Tags”  and “Tag Bundles” have been disappearing and losing their settings. This has been going on for a few weeks now and the developers have been working hard on resolving the problem, which turned out to be a corruption in one of the settings files.

They have released a beta fix for this problem, which you currently have to sign up to a Yahoo group to download. Details of the problem and how to obtain the patch can be found here.

Hopefully they will release a mainstream version of this patch soon!

Encrypting traffic with a VPN

Dan Goodin has written an interesting article for theregister.co.uk about the benefits of using a personal VPN for your wireless internet traffic.

There are some downsides to running a VPN server at home. One of these is that all of your data must travel via your home PC/server and most peoples broadband connections will limit the speed that this will work at. The maximum speed of your VPN connection will be limited by the upload speed of your home broadband - which is normally quite slow. Also, dynamic IP addresses, port forwarding and NAT on your broadband router and having to leave your home PC powered on all the time could be a pain.

Another alternative could be to run OpenVPN on your own server (or vps) at a data center or, a cheaper alternative, to buy access to an OpenVPN server that has already been setup and configured.

Running OpenVPN

I’ve been playing with OpenVPN for the past couple of weeks and I’m pretty impressed. OpenVPN allows you to create a private network between 2 computers. These could be 2 servers or a client and a server. A few of the reasons for wanting to do this are -

  • bypassing your ISPs traffic shaping
  • making your traffic appear to originate from a different country
  • encrypting your laptop traffic over an insecure link - such as a coffee shop wifi connection
  • anonymous web surfing
  • bypassing a countries web access controls

Setup and configuration of the server component can be fairly complicated depending how you want to manage the certificates and networking on there. It’s possible to install it on Linux or Windows although I’ve only tested it on Linux. Running the server on Linux you also need to configure iptables to translate your private ‘vpn’ ip address to an external ip address on the vpn server.

Continue reading ‘Running OpenVPN’ »

ffmpeg and streaming video

I’ve been interested in trying to stream some of my videos from my server rather than from YouTube. YouTube is great but the video quality is pretty poor.

I’m running CentOS 5.2 and decided to just try installing ffmpeg from rpmforge rather than compiling it. Lazy but easy!

rpmforge is a repository where you can find lots of prebuilt packages that are not part of a standard Redhat/CentOS install. You can find instructions for setting it up here.

So, with rpmforge configured, this was all I needed

# yum install ffmpeg
#

Then I looked round for a player to stream the video (which were going to be in flash format). Flowplayer looked pretty nice. I just wanted something simple that would have only the video and controls on the page.

After looking over the sample html pages that come with flowplayer it was easy to create a page with just the video on there. So I uploaded my videos which were in mpg format.

Running the command

# ffmpeg -i video.mpg -s 320x288 -b1200000 -ar 44100 video.flv
#

converted the video to flash format with a pretty high quality but without making the files too large. I’m sure I could probably find better settings if I played around a bit more.

And here some examples of the end result -

http://sysadminman.net/video/takeoffsywell.html

http://sysadminman.net/video/alconbury.html

http://sysadminman.net/video/fisty_nuts.html

Just out of interest - the aircraft is a Pegasus Quantum 582 which you can see a picture of here.

I no longer own it and and miss the summer evenings flying around the english countryside.

Asterisk on a VPS

I get a lot of people asking me about running Asterisk on a VPS. It’s a great way to get started and experiment with Asterisk and find out what it can do.

If you’ve used something like Skype or Vonage before then you’ll have an idea what you can do with VOIP but running your own Asterisk server makes things so much more flexible.

If you combine Asterisk with FreePBX, a great web interface for configuring Asterisk, then you’ll have an extremely capable PBX. There are many plugin modules available for FreePBX which provide an easy way to setup advanced features such as voicemail, IVRs, follow-me, time conditions, conferencing …

It is possible to run Asterisk on pretty much any VPS but you’ll definitely have a better experince using a VPS specifically designed for running Asterisk. A couple of features that may not be available with a ‘normal’ VPS is the ztdummy driver and high quality bandwidth.

Continue reading ‘Asterisk on a VPS’ »

iptables for asterisk

If you’re running Asterisk on a VPS or a dedicated server then setting up your iptables firewall can be a tricky.

I thought I’d post my firewall script to help get you started. I save this script as /usr/local/bin/firewall.sh and then add a line to run it from /etc/rc.local

It allows SSH’ing to the machine plus rules required for SIP connections (you will need other rules if you use IAX) plus some basic “bad stuff” filtering.

I’ve commented it so, hopefully, you’ll be able to figure out and chages you need.

Continue reading ‘iptables for asterisk’ »

ssh: connect to host … port 22: Connection refused - UPDATE

As someone pointed out here another possibilty for these kind off error messages is that, if you’ve just changed the SSH port from 22 to something else for security, then there’s a good chance your firewall may be blocking the connection.

Redhat5/CentOS5 cetainly has a firewall enabled as default. Try ‘iptables –list’ to see if you’ve got iptables running

vps monitoring

If you have your website, e-mail system, etc. running on your own VPS or dedicated server it’s good to know when that server is unavailable so you can contact your server provider asap.

The best way to do this is use an external monitoring company. I’ve been using Hyperspin for a couple of months now and it’s been working great.

You can pick what services/ports on your server to monitor (SMTP, HTTP, HTTPS, etc.) and you can chose how to be alerted when they are not available. Obviously you need to make sure that you’re alerted via an out of band method (in other words don’t rely on an e-mail to an e-mail account on your VPS to know that your VPS is down!)

The Hyperspin website isn’t very pretty but overall their system is reliable and easy to use.