Linking two Trixbox servers

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?

You’re done!

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 There is a real lack of good Trixbox recipes!

Cet article, publié dans Configuration, Recette, est tagué , , , . Ajoutez ce permalien à vos favoris.

8 commentaires pour Linking two Trixbox servers

  1. Safeer dit :

    I have the same scenrio, but when I call from one servers extension’s the other side extension showing the local trunk number on CLI of X-lite.

    Where I am lacking? thanks in advance.


  2. Adriel dit :

    Lovely. well said. It worked exactly for me


  3. Andres dit :

    For the love of God!!!! I had been looking for a way to have an extension at home. I almost pull my hair out trying to figure out SIP over NAT. This completely makes seen, having IAX2 take care of all the traffic. Thank you so much!!!!

    p.s: I have a latency of 12ms between home and the office, communications are crystal clear over my fiber connection at home!!!



  4. Chris dit :

    I have this partially working. The problem is my office can’t ever connect to my home server. But I can dial out using the IAX connection. Its like asterisk/freepbx refuses to dial my target home extension. Normally adding a incoming route is easy, but I keep getting the ‘congested’ message

    I’ve been staring at the logs for hours and trying different things, but so far no luck. I have an open incoming route that should match everthing, but it doesn’t.

    Any ideas would helpful.



  5. elecnix dit :

    @Chris Did you follow the steps? The home server should be the one connecting to the office. Or you mean the home server is connected to the office, and the office can’t reach your home? Does your home server see the incoming request from the office? What does it say it’s doing with it?


    • Chris dit :

      Sorry for the delay, I’ve been busy with other projects. My home trixbox is about 2.5 years old since instllation. I found in my case I needed to add this to iax_general_custom.conf :


      After reloading both servers, it worked perfectly.

      At first, I didn’t know anything about trunking to trixboxes together. Thanks for the guide! Hopefully the workaround for my particular version of trixbox will help someone as well.


  6. Haydar Fadhil dit :

    dear frineds i need to know how i can put my real ip (public ip) on my trixbox i need to use the real ip to use this server in my office amd out thanks


  7. Chuan dit :

    how to I make outbound call from home thru office’s outbound trunk?


Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:


Vous commentez à l'aide de votre compte Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s