We have a Trixbox server at the office, and I have one at my home too. They have been working fine independently of each other for a while, but I figured if they could talk to each other over the internet instead of our VoIP provider, I could save few bucks each year and get a higher geek score.
Well, there’s a good reason I wanted this: I wanted my home extension to not only ring my cell phone, but also my office phone, but the office has a single number and a menu where you have to compose an extension. I haven’t found how to tell Trixbox to compose an extension after dialing a number, so linking both Trixbox server made sense.
I’m going to describe how I did it, because I need to explain this to a co-worker, and there’s generally a lack of good documentation on the internet.
My office has a static IP address, so my home server will be connecting to the office. This should fit most people with dynamic IP addresses at home. I did this from the office and created an SSH tunnel to the web interface of my trixbox home server:
ssh -L8080:trixbox:80 me@home.
Open UDP port 4569 in the office firewall
Open UDP port 4569 in the office firewall and map it to your Trixbox server. This will allow anyone on the internet to connect to your Asterisk server with the IAX2 protocol. To increase security, I suggest you limit who can connect to the block of IP addresses of your ISP, or to your IP address it you have a fixed IP address.
Create an extension in the office server
On your office Trixbox web interface, enter Admin mode and go to PBX > PBX Settings, then go in Extensions, click Add Extension and pick Generic IAX2 Extension. Enter your real name in the Display Name, put your home phone number in User Extension, create a password (numeric only?) in the field named secret and click Submit. Apply your changes.
Add a trunk in your home server
On your home Trixbox web interface, enter Admin mode and go to PBX > PBX Settings, then go in Trunks, click Add Trunk and Add IAX2 Trunk.
In the Outbound Caller ID field, enter Your Name . Enter office for the Trunk Name and fill the PEER Details form by specifying your office IP address or host name for the host, the extension number you just created on you office server for the user, and the extension password for the secret.
Name your USER Context something like office-in, and fill the USER Details just like you did with PEER Details, except this one doesn’t need the host. Next, fill the Register String with « extension:password@host_or_ip », where host_or_ip is the host or IP address of your office. Submit and apply your changes.
Check that the IAX2 connection was made
On your home Trixbox web interface, enter Admin mode and go to PBX > PBX Status, and in the IAX2 Registry section, check that you new trunk is in state Registered. If it is not, I suggest you check the logs of both the office and the home server to figure out what went wrong. This is where you need ninja skills. Leave a comment here if you need help.
Create an inbound route at home
Now, if someone composes your new extension at work, it will reach your home server, but you’ll get a message saying « All circuits are busy » because you haven’t said where to route the call. On you home server, you need to go to PBX > PBX Settings, Inbound Routes and click Add Incoming Route. Enter « office » in Description.
Ideally, you would specify a DID Number, but I’m not yet sure what the office server passes in so I left it blank for now. This means the Inbound route will match all incoming calls. I also have other routes with a DID Number specified and they are still functional, so the catch-all shouldn’t be a problem for you too.
Now choose what you want to do. Most likely, you’ll want to ring an existing extension, or a ring group. Submit and apply your changes. From the office, calling the IAX2 extension should ring your home extension. If it doesn’t, check the logs on both servers and mentally prepare yourself to bang your head on a wall. Fortunately, I didn’t have to.
Create an outbound route at home
Now that you can call your extension at home, you’ll want to be able to call the office from home. For this, you need a new Outbound Route. Go to PBX > PBX Settings, Outbound Routes and click Add Route. A nice name for this would be « office ». As for the Dial Patterns, I have three:
The first line means the route will match that exact number. The second line is mostly useful if I don’t have line three, which is a shortcut for line two: Dialing any number prefixed with « 7 » will be sent to your office server with the « 7 » stripped.
Next, the Trunk Sequence only needs your Office trunk. Submit and apply your changes. Go home and dial « 7 » followed by an extension that exists at your office. If it doesn’t ring, bang your head in the wall. If it doesn’t make it work, bang again. You know how this works. Did I mention to check your asterisk log files?
Well, perhaps not. Anyway, this should have helped getting you pretty close to what you wanted.
I did more: I added « 7203# » in the follow-me settings of my home extension. « 7 » selects the office trunk, 203 is my office extension, and the pound sing tells Trixbox this is not an extension, but an external call. It means someone calling me at home will also ring my office phone. Since the follow-me also includes my cell phone (« 95141234567# »), I’m reachable more than ever.
At the office, my follow-me settings also include my cell phone, and now include the IAX2 extension of my home server. I’m reachable more than ever.
Feel free to share your questions as a comment below, share your experiences, or copy/modify/translate this post to a wiki or else. I’m also reachable through micro-blogging at Identi.ca. There is a real lack of good Trixbox recipes!