Saturday, December 12, 2009

Black progress bar when playing recordings from FreePBX website(s)

Just wanted to quickly write this tip.

When accessing FreePBX recordings or in any case, playing a QuickTime embedded video via a browser, the indication bar shows all black making it impossible to see the progress bar and what not.

image

This is somehow a bug in Windows 7 and/or Apple Quicktime. I’ve made a support incident on Apple’s website, waiting for a response.

The quick workaround around this is to run your browser in compatibility mode such as Vista SP1, 2..

I personally don’t care, but some customers may just raise an eyebrow. So those who want this “fix” do this below.

How to? Go to your Windows Start button, look for the affected browser/link (must be a link not the exe itself), right click, properties and select compatibility, enable the compatibility by selecting Vista SP1,2…then reload the browser. You should see it now.

image

Cheers and have a good weekend.

Tuesday, December 8, 2009

trunking as a SIP client on asterisk via freepbx

Some of you may purchase a SIP service thus having a SIP extension given to you by your SIP provider. This is not the same as a SIP trunk where an “agreement” is made between two SIP servers. This is a typical SIP client which you configure on a softphone or a hardphone.

If you wish to make Asterisk become the “client” in receiving and making calls from this account you can easily do that with FreePBX and this guide would help you do so.

Firstly, you need the SIP provider account with a minimum user, pass and IP/name of the SIP provider, like what we in Astiostech provide called Astervox.

This account will be used to make and receive calls via an Asterisk and will be then forwarded to an Internal SIP extension. From this extension, you can shoot it out to a queue or whatever you wish to do with it.

Diagram.

image

Let’s say the Astervox (SIP provider) gives us an account like this:

Ext/User: 4000
Pass: 4000abc
Server: voip.astervoxvoiperserver.com

Here’s how to get it working with FreePBX/Asterisk

1) Go to FreePBX, General settings and enable Inbound SIP calls
image

2) Create a new SIP trunk, call it anything you wish, go to the Outgoing Settings (thus becoming the outbound trunk)
 image
host=<yoursipproviderIPorName> [When using name, ensure you can resolve]
username=4000 [the sip account username]
secret=4000abc [the sip account password]
type=peer
qualify=yes
fromuser=4000
fromdomain=myoffice.dyndns.org [this is your Asterisk IP or name or Dyndns]
canreinvite=no
insecure=very
nat=yes

3) For the Inbound (incoming call) part, go to Register String, enter the authentication info again like below and the extension where you wish to shoot the call to.

image [See below for full text]

4000:4000abc:4000@voip.astervoxvoiperserver.com/1001

/1001 is the internal extension that will be dialed when this SIP client 4000 is called (SIP bridging) on the SIP provider. Note, 1001 could also be an Inbound route because 1001 is treated as a DID therefore with an inbound route, you can do more routing and stuff, with it.

4) Save and apply configuration in FreePBX

5) Define Outbound Routes so that you can dial via this Trunk

6) Define Inbound Routes if you like to shoot different CID to different places.

To check if the links/registrations are up, at the command prompt, run:

# asterisk –rx “sip show registry”  [for our inbound - you should see state=registered to your SIP provider]

# asterisk –rx “sip show peers” [for our outbound – you should see status=OK]

Remember! If you are behind a NAT, you must NAT to your Internal Asterisk box UDP/5060 and UDP/10000 to 20000. Otherwise you may get one way audio issues. If required outbound rules also may need to be set and as a minimal the UDP/5060 and the RTP part you should get from your provider, normally with Asterisk its UDP 10000 to 20000.

Done.

Friday, December 4, 2009

Debian software RAID made easy

In this guide, we will setup a mirrored pair of a SATA disk straight from the Debian installer process.

Go through all up to the stage of selecting Partition Disks. Select manual and follow the rest of this guide.

1) Create the initial partition by selecting the disks and saying yes to partition them for both disks.

On both disks

2) Select the first FREE SPACE available

3) Create partition like /boot, /swap and / (root) partitions.

In our case, we will setup 2GB for /boot (enable bootflag), 2GB for /swap and the rest is for / (root). Now, we do not need to mirror /swap so our guide will skip that and our RAID will only monitor and mirror /boot and / (root)

When partitioning, under enter Use as, select physical volume for RAID. See screens below;

clip_image001

4) Select use as.

clip_image002

5) Set the boot flag on for /boot for both disks when creating them. For /swap and / (root) you don’t do that. Now, setup /swap and / (root) for both disks as well. Here, since swap is not RAIDed (when selecting -Use as- for the swap partition, select swap area instead) See below for the entire physical architecture.

/boot – use as physical volume for RAID with boot flag on >> becomes sda1 or sdb2

/swap – use as swap >> becomes sda2 or sdb2

/ – use as physical volume for RAID >> becomes sda3 or sdb3

clip_image003

Important: We should have at least a boot, swap and root partition and do this for all other partitions that you want/have.

Enable the RAID virtual volumes

6) Now, select Configure RAID

7) Since we are enabling RAID for 2 partitions, we need to create two Multidisk (MD).

clip_image004

Select Create MD device.

clip_image005

Select RAID1 - Mirror

clip_image006

Select accordingly (in mirroring case would naturally be 2), i select 2

clip_image007

Select spare devices if you have any, i select 0

clip_image008

The first MD, md0, we assign it to /boot which are sda1 and sdb1. The second MD, md1, we assign it to /sda3 and sdb3. The above diagram, we are setting up md0, go through creating a new MD, this time, we are left with the rest unassigned partitions.

Configuring the RAID volumes

Once you’ve set it up correctly, you disk layout should look like this;

clip_image009

Notice, we have RAID 1 device 0 – which is our /boot and we have RAID 1 device 1 which is our / (root).

8) Now in RAID device 0, select #1 and set that up with Ext3 and select mount point /boot.

clip_image010

Now, on RAID device 1, select #1 and set that up with Ext3 and select mount point / (root).

9) Eventually, the disk architecture would look like this;

clip_image011

Beside the SCSI 1 and SCSI 2 devices, we now have RAID1 device 0 and device 1 with /boot and / (root) setup.

10) Finally, select Finish….and continue Debian setup till the end, reboot and now you have a RAID 1 configuration.

PS>> The installer might complain about kernel not knowing this and that. Just continue.

After RAID
To check the status of your raid, run

# cat /proc/mdstat

Disk recovery on software RAID
To resync new disks (due to failure whatever), you must do a couple of things. One involves adding the disk to the M0 and M1 volumes and telling grub to install itself in the new disk that you just installed. Here’s how.

Assuming the first disk (sda) failed, and we have replaced and rebooted the server, here’s what all we need to do.

First, we copy the partition structure from sdb (the exiting non failed one) to sda (the new)

# sfdisk -d /dev/sdb | sfdisk --force /dev/sda

Now, we remove any existing raid configs on this new drive (just in case)

# mdadm --zero-superblock /dev/sda1
# mdadm --zero-superblock /dev/sda2
# mdadm --zero-superblock /dev/sda3

[If you get an error, just ignore, meaning you don’t have existing RAID configs in it]

Now, we add back these partition to the RAID MD volumes accordingly

# mdadm -a /dev/md0 /dev/sda1
# mdadm -a /dev/md1 /dev/sda2
# mdadm -a /dev/md2 /dev/sda3

Now, we would like to see the raid resyncing

# cat /proc/mdstat

After that, we must tell grub to enable itself on the newly added disks.

# grub

[The above grub command will end you up in the grub shell, once in this shell, enter the following info]

grub> root (hd0,0)
grub> setup (hd0)
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

This means, i am setting up grub on hd0 and hd1 and so on if you do other types of raid or have more disks etc.

That should get the recovered disks back to speed. Before rebooting, ensure disk sync is completed, keep running

# cat /proc/mdstat

[===========>........] 

If the above is happening, it’s still syncing. Don’t reboot yet until these are done.

Good luck.