Posted by & filed under Thoughts.

I have worked with a number of hosting companies over the years but none as simple and transparent as DreamHost. As they celebrate their 16th anniversary, I celebrate their easy of use and my 7th year with them. When doing consulting or working with other customers’s current environments, I long for DreamHost instead of where ever I am stuck. And now they are giving me the chance to get something even more back! Who can complain about the chance for a year’s worth of hosting! Happy Sweet 16 DreamHost! #DreamHostSweet16

Posted by & filed under Scripts.

For a long time I have used Broadvoice for my VoIP provider, this is soon to change (more on this later). Before I lose some nice tricks I have come across with them, I wanted to share them so others could benefit from my hours of time trying to figure it out.

With BroadVoice you have typically have a single ‘line’ with a number attached to it. You then have the option to have alternate numbers added to the line so that you can have more than one phone number. The problem with this is that BroadVoice doesn’t exactly handle them like DID as most VoIP providers do in their services. Therefore it becomes very difficult to route calls or know which number the call actually came in on because you could have up to 4 phone numbers on a single ‘line’ from BroadVoice.

With my own ignorance when I was first working with SIP / VoIP, I ended up with 3 lines from BroadVoice, each with a few numbers on them because they were available and seemed cheap ($1.95 per month per alternate number after $9.95 activation). Due to the lack of correct DID support and 3 lines coming in with a multitude of possible numbers it became very difficult to break numbers out into their own call patterns. By using built-in features of FreePBX and some custom Asterisk code, I was able to break out each number into its own call pattern. I have included the code here for my own reference and the benefit of anyone else who may be in a similar situation.

FreePBX Requirements

  • Custom Destinations Module
  • Trunks Configured for Each BroadVoice line (Or any SIP trunk with distintive Ring Support)

Trunk Details

  • Line 1 – Main Number – 0004, Alt Numbers – 0006
  • Line 2 – Main Number – 0003, Alt Numbers – 0000, 0001, 0002
  • Line 3 – Main Number – 0005, Alt Numbers  – 0008, 0009
  • (Last 4 Digits shown only, actual numbers omitted for security, but yes I almost have 0-9 of a sequence)

Configuration Steps:

  1. Install Custom Destinations Module in FreePBX
  2. Create a custom destination for each BroadVoice Line (Ex: Description – BV-Line1, Custom Destination – custom-bv-incoming,s,1)
  3. Configure Incoming Routes for EACH Broadvoice Line – using Primary number on line in DID with ANY for CID, set destination to matching Custom Destination created
  4. Create Macros in extensions_custom.conf as shown below – ;drX is the distinctive ring coming from Broadvoice, I commented out the mappings in the file to help with programming.
  5. Create Incoming Routes for EACH alternate number using the new custom DID defined in the macros – i.e. bv-line2-03, bv-main04 – route to any call destination as desired
  6. Begin testing! I highly recommend watching the Asterisk debug messages through ‘asterisk -vr’ on command line

Macros Placed in extensions_custom.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[custom-bv-incoming]
exten => s,1,Set(foo=${SIP_HEADER(Alert-Info)})
exten => s,2,GotoIf($["${foo}" = ""]?5:3)
exten => s,3,GotoIf($["${foo}" = "<http://127.0.0.1/Bellcore-dr4>"]?8:4)
exten => s,4,GotoIf($["${foo}" = "<http://127.0.0.1/Bellcore-dr3>"]?11:14)
exten => s,5,Set(CALLERID(name)=2424 - ${CALLERID(name)})
exten => s,6,NoOp(${CALLERID(all)})
exten => s,7,Goto(from-pstn,bv-main04,2)
exten => s,8,Set(CALLERID(name)=0007 - ${CALLERID(name)})
exten => s,9,NoOp(${CALLERID(all)})
exten => s,10,Goto(from-pstn,bv-main07,2)
exten => s,11,Set(CALLERID(name)=0006 - ${CALLERID(name)})
exten => s,12,NoOp(${CALLERID(all)})
exten => s,13,Goto(from-pstn,bv-main06,2)
exten => s,14,Set(CALLERID(name)=0010 - ${CALLERID(name)})
exten => s,15,NoOp(${CALLERID(all)})
exten => s,16,Goto(from-pstn,bv-main10,2)
;dr1 = 0004
;dr2 = 0010
;dr3 = 0006
;dr4 = 0007
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[custom-bv-line2-incoming]
exten => s,1,Set(foo=${SIP_HEADER(Alert-Info)})
exten => s,2,GotoIf($["${foo}" = ""]?5:3)
exten => s,3,GotoIf($["${foo}" = "<http://127.0.0.1/Bellcore-dr4>"]?8:4)
exten => s,4,GotoIf($["${foo}" = "<http://127.0.0.1/Bellcore-dr3>"]?11:14)
exten => s,5,Set(CALLERID(name)=0003 - ${CALLERID(name)})
exten => s,6,NoOp(${CALLERID(all)})
exten => s,7,Goto(from-pstn,bv-line2-03,2)
exten => s,8,Set(CALLERID(name)=0002 - ${CALLERID(name)})
exten => s,9,NoOp(${CALLERID(all)})
exten => s,10,Goto(from-pstn,bv-line2-02,2)
exten => s,11,Set(CALLERID(name)=0001 - ${CALLERID(name)})
exten => s,12,NoOp(${CALLERID(all)})
exten => s,13,Goto(from-pstn,bv-line2-01,2)
exten => s,14,Set(CALLERID(name)=0000 - ${CALLERID(name)})
exten => s,15,NoOp(${CALLERID(all)})
exten => s,16,Goto(from-pstn,bv-line2-00,2)
;dr1 = 0003
;dr2 = 0000
;dr3 = 0001
;dr4 = 0002
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[custom-bv-line3-incoming]
exten => s,1,Set(foo=${SIP_HEADER(Alert-Info)})
exten => s,2,GotoIf($["${foo}" = ""]?5:3)
exten => s,3,GotoIf($["${foo}" = "<http://127.0.0.1/Bellcore-dr4>"]?8:4)
exten => s,4,GotoIf($["${foo}" = "<http://127.0.0.1/Bellcore-dr3>"]?11:14)
exten => s,5,Set(CALLERID(name)=0005 - ${CALLERID(name)})
exten => s,6,NoOp(${CALLERID(all)})
exten => s,7,Goto(from-pstn,bv-line3-05,2)
exten => s,8,Set(CALLERID(name)=0009 - ${CALLERID(name)})
exten => s,9,NoOp(${CALLERID(all)})
exten => s,10,Goto(from-pstn,bv-line3-09,2)
exten => s,11,Set(CALLERID(name)=0008 - ${CALLERID(name)})
exten => s,12,NoOp(${CALLERID(all)})
exten => s,13,Goto(from-pstn,bv-line3-08,2)
exten => s,14,Set(CALLERID(name)=Avail - ${CALLERID(name)})
exten => s,15,NoOp(${CALLERID(all)})
exten => s,16,Goto(from-pstn,bv-Avail,2)
;dr1 = 0005
;dr2 = Available
;dr3 = 0008
;dr4 = 0009

Posted by & filed under Thoughts.

School had taken over my time and has kept me from having time for hobbies. In addition to finishing my undergraduate, I am just about to finish my MBA, followed by starting a full-time position and to top it off, get married. I hope that this summer I will be able to have more opportunity for my own projects and hobbies again. I will be moving as well which will required a complete disassemble of my home network and will probably cause some redesign. Here is to taking another attempt at having free time for posting.

Posted by & filed under Notes.

I have a very unique internet setup at my house, I currently have two Road Runner connections. One is for all the roommates and the other is for me, paid out of pocket for my consulting work. There are plenty of products out there that would allow failover but my version of failover, is like I said, unique.

I want both connections active, at all times. The problem is that sometimes only one of the connections goes down or I am doing maintenance on one but don’t want to disconnect everyone. The solution for me was a combination of static routes, two layer 3 Cisco switches and IPCop.

Below is the quick overview of steps. I will add a network diagram later.

  1. Add static route on each Cisco switch pointing to an IPCop
  2. Place green IPCop segment in isolated Vlan accessing only one switch.
  3. Configure IP address on isolated vlan
  4. Add static route on IPCop to point the internal network to the linked switch
  5. Configure 2nd IPCop and switch in the same manner
  6. Setup IP Standby on Cisco switches

I did this set up a month or so ago so the exact steps are hazy but this should get you through assuming you have worked with IPCop and Cisco switches before.

The configuration for the direct vlan. Notice the subnet mask. We only need 2 hosts in this vlan so there is no use wasting a full 256 addresses. This mask gives us addresses at .1 and .2, we can then use the same again and have .5 and .6 for use with IPCopB and SwitchB, as show in the 2nd snippet.

1
2
3
4
ip route 0.0.0.0 0.0.0.0 10.0.255.1
interface Vlan255
description Direct to IPCopA
ip address 10.0.255.2 255.255.255.252
1
2
3
4
ip route 0.0.0.0 0.0.0.0 10.0.255.5
interface Vlan256
description Direct to IPCopB
ip address 10.0.255.6 255.255.255.252

This code provides ‘up’ status checking. With just one check things failed over too often so I adjusted to an OR statement of two hosts. Both must be unreachable before the link is considered down. The two IPs are a RR DNS server and an IP of the Google website cluster that was returned by a ping of Google.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
track 101 rtr 101 reachability
!
track 102 rtr 102 reachability
!
track 200 list boolean or
object 101
object 102
!
ip sla 101
icmp-echo 24.92.226.40
frequency 120
ip sla schedule 101 life forever start-time now
ip sla 102
icmp-echo 72.14.207.99
frequency 120
ip sla schedule 102 life forever start-time now

Here is the code for the HSRP on Switch A

1
2
3
4
5
6
7
8
9
10
standby 1 ip 10.0.1.1
standby 1 priority 200
standby 1 preempt
standby 1 authentication password
standby 1 name Consulting-Gateway
standby 1 track 200 decrement 150
standby 11 ip 10.0.1.11
standby 11 preempt
standby 11 authentication password
standby 11 name Roommate-Gateway

Here is the code for the HSRP on Switch B

1
2
3
4
5
6
7
8
9
10
standby 1 ip 10.0.1.1
standby 1 preempt
standby 1 authentication password
standby 1 name Consulting-Gateway
standby 11 ip 10.0.1.11
standby 11 priority 200
standby 11 preempt
standby 11 authentication password
standby 11 name Roommate-Gateway
standby 11 track 200 decrement 150

More information and explanations to follow.

Diagram:

Useful Links:
Cisco 3560 – HSRP Manual

Posted by & filed under Notes.

Anyone who uses trixbox within the recent months has probably read about the battle between Phillip at FreePBX and Kerry at Fonality, which owns trixbox. Fonality forked FreePBX in order to better brand the product into trixbox. Not something I am interested in. I want all the latest features and bug fixes that FreePBX and their team is able to provide, I don’t want to wait for Fonality to include them. These instructions were initially posted here, but I wanted to make them easier to find both for myself and anyone else feeling the same way. I didn’t follow all their steps but it seems to work just fine.

  1. Download trixbox 2.6.0.7 .ISO – It still has the original FreePBX.
  2. Install trixbox 2.6.0.7
  3. yum update –exclude=tbm-pbxconfig –exclude=trixbox – this will get you all the current modules except for the forked FreePBX – trixbox has a dependency with tbm-pbxconfig, so that is why it is excluded
  4. Enjoy!

They say you need to install net-config but when I ran the update it seems to have resolved itself. I will make changes if I find there is a need for those packages again.

Update: Sounds like FreePBX comes to the rescue again. They have made an upgrade module to get back on their line of code instead of Fonality.

Update 2: I would continue to run the above yum command for any system updates to avoid breaking anything. I put the command in a file and just execute that instead when I need to update the system.

Update 3: I have stopped using Trixbox as I didn’t like the direction they were going in deviations. I now use the FreePBX Distro