Connecting Allworx 6x to FreePBX

Posted at 5:05:04 PM in Installations (48)

I have not had a chance to do any trunk to trunk PBX connecting before. A client wanted setup his Allworx 6x and had previously had it setup with POTS lines. He had ordered POTS lines to get the same config as he had in a previous office but that order didn't come through. I suggested we try getting him setup using SIP instead of the POTS lines.

I was unfamiliar with Allworx and tried to find a way to reconfigure the IP phones that came with the system, but quickly found out that wouldn't work. After researching a little about Allworx, I found their systems were SIP 2.0 capable and decided to forage ahead and set that up. It took 2 days. Hopefully this will help anyone needed to setup a similar configuration.

First off, I set this up to be a SIP to SIP trunk (Allworx to FreePBX). The FreePBX was the only source for public telephone access. This information will not address routing extensions between the two PBX systems. They needed 2 DIDs, 5 lines and those 2 DIDs needed to route through the FreePBX. SIP to SIP trunking described here routes calls from the outside to an inside PBX through a FreePBX system and vice versa. The FreePBX system doesn’t know anything about the extensions being used in the hosted PBX box. It would be possible to make the two systems aware of each other, but that would require renumbering the extensions.

The issues I had were:

  1. Creating a network connection
  2. Administer the Allworx PBX system remotely
  3. Establishing a SIP to SIP trunk
  4. Configuring outbound calls
  5. Routing inbound fax numbers to their analog port
  6. Ensuring their Caller ID worked on outbound calls.

Note: The Allworx Software Version is The installed features which may or may not have an impact on this setup are: Internet Call Access and Multi-site Branch.

I did not want to worry about port forwarding through a router, so I set up the Allworx 6x box to act as a router as shown in the attached picture.

 When I started, the Allworx system was set to LAN Host. That setting disables the WAN port and makes the appliance work on the network as a host separate from the internet. NAT/Firewall allowed me to access the appliance directly for admin and routing. The DHCP server on this box is a little flaky. I rebooted my router and effectively disconnected the Allworx box. It didn't bother trying to get another IP address until I could get to it and power cycle the unit.

Once the Allworx box  was connected, I needed remote administration. I tried connecting from the WAN side, but that didn't work. The Allworx appliance comes with one VPN PPTP connection. To enable the PPTP username and password, select an user account and at the bottom of the user account page is an option to enable that account to use PPTP and to enter a password. I used the admin account, I'm not sure if that was necessary or not. The password has to be 14 characters long and is separate from the actual user's password. Once a PPTP connection was established from the WAN side, I could connect to the admin console via the server address at port 8080. i.e. There is only a login password on that screen, no user name.

To connect the trunk, I used SIP Proxies under Home > Phone System > Outside Lines. I kept the Trunk name and username the same in my FreePBX trunk setup. The same name was then entered in the outside lines page in the Allworx box for the Description, User ID and Login ID. The address of the SIP server and port number should be pretty straight forward. The password in the SIP registration just needs to match the password in the PEER details on SIP server SIP Trunk setup.

The following link shows the information on the FreePBX box in the SIP Trunk setup... here:

There is nothing in the Incoming settings on FreePBX. As soon as I set this up, the Allworx connected and all I had to do was set up the inbound routes on FreePBX to this trunk and it worked. On the inbound screen, I modified Set Destination to Trunks and the picked the SIP truck that I created.

The problem with the outbound routes was the context. I used Friend Pairing as found on this site. The setup this provided was to allow extension calls to route down the trunks to the other PBX. And each PBX had its own outbound routes for all other calls. My problem was that the Allworx PBX had no route. It needed something that would allow SIP to SIP transfer, but there is nothing apparent in FreePBX to set that up. You will note at the top of the SIP Trunk setup, there is a warning that no outbound routes are using this trunk. However, when I changed the context in the example from the Friend Pairing site from from-trunk to from-internal, all the outbound calls automatically started routing.

I will get to the fax setup last. My outbound Caller ID was setup correctly on Allworx as can be seen in the link for Outside Lines. For some reason, FreePBX was dropping the Caller ID and replacing it with the trunk default Caller ID. I had tried several options, but the one I used that worked for me was to create a new outbound route using the Caller ID that was getting dropped to make the dial pattern unique and then put the dropped Caller ID in Route CID to override Caller ID on the trunk. Of course, this would be cumbersome if there was a large number of DIDs that needed to be routed.

To accomplish this task, I just duplicated the existing route and added the caller ID that was coming from Allworx. The pattern matched and the new Route CID replaced the trunk default CID.


The Fax problem was all in Allworx. There are 2 ports available on the Allworx 6x (port 7 and port 8) for analog lines. My outside lines configuration had the DID for regular calls and for the FAX calls to come in on separate Routing plans, but I could not find where to associate the physical port with the number.

To fix this, I added a new extension. In the attached picture, you will see the First connection attempt section of Call route. Click add a destination. When I used the pull down, I didn't notice that the slider bar was at the bottom, obscuring the other ports at the top. I was looking for port 07 and port 08, but couldn't find it at first. I scrolled up. They are both at the top of the list. Once I had an extension, I could go back to the routing plan and add the inbound route to the extension and in and outbound faxing started working.


Written by Leonard Rogers on Thursday, March 28, 2013 | Comments (0)

Mozilla Thunderbird default printer

Posted at 9:14:12 AM in How To (2)

Mozilla Thunderbird has a lot of self contained settings and pays no attention the changes in it's environment. Since installing it, I've had the default program to open an attachment to be an issue. Windows knew what program to use, but Thunderbird didn't (of course, this is because the user opened the attachment and picked what they "thought" was the right program, Mozilla grabbed that one and that's the way it stayed until I figured out how to undo it).

This time is was the default printer. Same user. Brand new workstation setup. Apparently, a different printer was set as default when Thunderbird was installed and so, it grabbed that one and wouldn't let it go. This will also be an issue whenever there is a printer change...

Here are the steps to reset the default printer in Mozilla Thunderbird...

1. In Thunderbird, go to Tools - Options.
2. Under Advanced, on the General tab, click on the Config Editor button.
3. Scroll down to the line starting with print.print_printer. If you don't have that line, then everything should already be set correctly.
4. Right-click on the print.print_printer line & choose Reset.

I got this info from here.

Written by Leonard Rogers on Thursday, March 28, 2013 | Comments (0)

Connecting Copfilter's SpamAssassin to Gmail's IMAP folders for Bayes Scoring

Posted at 2:06:51 PM in Installations (48)

 I had an issue connecting my copfilter to gmail's folders in an effort to setup bayes scoring. Initially, the problem was with the need for a secure connection. Previous to V2, we could not use SSL. After upgrading to V2, I was still having issues connecting.

I was able to connect with these settings:


  • IMAP server:
  • Require SSL: Yes
  • User name: your Gmail account name
    • The account name is what precedes "" in your Gmail address. If your Gmail address is "", for example, the corresponding account name is "nospam".
  • Password: your Gmail password (no special characters in the password - there's still a problem with that)

Here is a screen shot including the folder names which are called labels in Gmail. These folders are top level labels.


Written by Leonard Rogers on Tuesday, March 19, 2013 | Comments (4)

Credit Memo - Net Credit Due

Posted at 3:11:10 PM in Software (15)

 I submitted a request to Peachtree support about what appears to be an obvious programming oversight. I'm posting to see if perhaps I over looked something. My question is about Credit Memo's in Peachtree 2012 Complete Accounting.  Here is the original question:


When I'm in the report customization in Peachtree. The money field "Money applied to credit memo" is always empty. No matter if there is a invoice applied, cash applied or a GL applied, it's always zero. Consequently, the Net Credit due is always the full amount of the credit memo and it never matches the credit memo info that we can plainly see on the computer screen.

Please advise


 At first, they couldn't find the report I was talking about, so I walked them through each step to get to it. Once they found what I was talking about, this was their response.


I did find the field name “Money Applied to Credit Memo” under form design. Note: this is a form not report.

This field will not show data when printing Credit Memo, you can add the same field in the Invoice form then credit amount applied against this invoice will be printed.


I'm not even sure why there'd be a field like that in the Credit Memo if it's not going to show data. The same named field doesn't exist on the invoice. Instead, it's called "Money applied to Invoice" and it's only going to show the amount up to the total amount on the invoice. There is nothing to indicate a credit balance.

After thinking this through, I now realize that there's nothing I can do. Peachtree support is basically saying this is the way it's suppose to work. Of course, it's not, but if you tell them there's a problem and they stick their head in the sand, then... that's the way it's going to work, whether it's right or not.

I submitted a rebuttal with a screen shot which I will show here. Basically, the answer they gave doesn't address my issue which was to show the net Credit Due on the credit memo. That's just not going to happen in Peachtree.

Written by Leonard Rogers on Friday, March 15, 2013 | Comments (0)

Working with Arrays in a Select Statement for Postgre

Posted at 11:17:40 AM in SQL (4)

This post is for PostgreSQL

I had a field in a database that consisted of city and state in the same field. It's a lot easier to create a single field out of two fields than it is constantly have to split that field up. For example, If you have a field called city and a field called state, you could easily make a citystate field that could be represented thusly: city+', '+state. The other way around requires finding the comma, removing the leading space, handling the exception that there is no comma or that there is no state or that there is only a state and no city (and those exceptions may have to be looked at for making a composite field like citystate, but it is easier to not print a comma if one fields [city or state] is missing).

What I decided to do was create an array out of the already composite field and split it on the comma. In Postgres, that function is string_to_array. However, string_to_array(citystate,',') produced an array that had double quotes around the state, in order to preserve the leading space. So I reverted to this: string_to_array(replace(citystate,' ',''),',') which gave me a nice 1 dimensional array with 2 elements (city in element 1 and state in element 2), but extracting an element from a function call is quite another problem. Since the function is inside of a select query there is no feature which allows us to make temporary assignments so we could assign the return value of a function to a temporary variable in order to do more operations on that variable. Of course, this is what stored procedures (or stored functions for Postgre) are for. We could easily pass this into a stored function and get the value back out, but is it possible to get the element out of the select statement without using a stored function?

Our table has 2 elements:

CREATE TABLE capitals (
id serial,
citystate character varying

INSERT into capitals (citystate) values ('LOS ANGELES, CA');

SELECT string_to_array(replace(citystate,' ', ''),',') as data from capitals;



Dang it, I stepped in it big time.

I was hoping the get the element out of the select statement by appending the element index on the end of the function, which I thought wouldn't work... and it didn't, like so:

SELECT string_to_array(replace(citystate,' ', ''),',')[1] as data from capitals;

Which returns an error. I just read on this post here that surrounding the entire expression would return the element like so:

SELECT (string_to_array(replace(citystate,' ', ''),','))[1] as data from capitals;

And this worked. This is what I ended up doing which made me decide maybe a stored function would be a better answer, but I got this from the Postgre documentation and then convoluted it to fit my situation, here it is for the dart board:

SELECT (SELECT f1[1] as city from (SELECT string_to_array(replace(citystate,' ',''),',') as f1) as ss) from capitals;

It worked of course, but I didn't want to do it again for the state.  I got the sample I followed from this site. As all the functions and examples always returned arrays, I needed one that returned the value of an element and there was only one on that page that did it. 

Written by Leonard Rogers on Thursday, March 7, 2013 | Comments (0)