Archive for the ‘Network’ 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

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.

Where are my packets going?

If you’ve ever had a slow, unable connection to a server it could be that you’re suffering from some packet loss between you and the server.

This might not be noticeable for web browsing or e-mail but if you’re doing any sort or VOIP or gaming it can be critical to know the quality of the connection between 2 points.

A simple tool for this is mtr. This is normally included in modern Linux ditros - if you’re a RedHat/CentOS/Fedora person just run -

yum install mtr

Now you can fire it up by running -

/usr/sbin/mtr www.digg.com

Continue reading ‘Where are my packets going?’ »