FreePBX | Register | Issues | Wiki | Portal | Support

FreePBX using wrong username on Trunk



I am running two FreePBX servers (, one in London and one in Manchester on Asterisk 11.23.1. I have a strange issue were calls are being made out via trunks using the wrong username. This only seems to happen if the initial call came in down an intra-company route.

For example: User has a call forward set to their mobile phone. If their extension is called from another extension on the same PBX, the forward works, but if the call came from the other PBX down an intra-company route, the forward never happens.

Another example (which I have logs for): We have some departments split over the two sites, so we have ring groups setup in both sites with one site (Manchester in this case) having the number of the other site (London) ring group in the extension list with an # on the end. Users call the Manchester ring group which then rings phones in both sites. If the call is from an extension in Manchester, it all works fine, but if it is from a London extension (so call goes down the intra-company route to Manchester, then the London ring group is called from there) then the London ring group never rings.

For the test:
Calling London Extension: 2292
Manchester Ring Group: 3289
London Ring Group: 2289

Looking in the logs I have, you can see the call going out from London 2292 to Manchester 3289 and the phones in the ring group, including 2289# being dialled but the call to 2289 is rejected.

   -- Executing [s@macro-dialout-trunk:23] Dial("Local/2289@from-internal-0000658b;2", "SIP/LondonSIP/2289,300,rwWxXTt") in new stack
   -- Called SIP/LondonSIP/2289
   -- Local/2289@from-internal-0000658b;1 is ringing
WARNING[2466][C-000067fa]: chan_sip.c:23242 handle_response_invite: Received response: "**Forbidden**" from '"Help:IT Build Room" <sip:**2292@**>;tag=as4373543e'
 == Everyone is busy/congested at this time (1:0/0/1)
   -- Executing [s@macro-dialout-trunk:24] NoOp("Local/2289@from-internal-0000658b;2", "Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 21") in new stack

You can see from where I have highlighted, the wrong username is being sent to the other PBX. The username on the Trunk is set to ‘ManchesterSIP’ but FreePBX is sending 2292 which is the extension number of the original caller.

On the London end you can see the incoming call being rejected because the username is wrong:

WARNING[24684][C-0000457a]: chan_sip.c:16588 check_auth: username mismatch, have <**2292**>, digest has <**ManchesterSIP**>
NOTICE[24684][C-0000457a]: chan_sip.c:25801 handle_request_invite: Failed to authenticate device "Help:IT Build Room" <sip:2292@>;tag=as313a0dc2

I can’t see any setting to change this behaviour, so I am guessing it is either a bug, or I am missing something fundamental in my setup.

Any help or advice would be appreciated.


(Lorne Gaetz) #2

Have you tried adding the fromuser parameter to the trunk peer details? This should force the username regardless of the call details.


Having just looked at the sip.conf documentation that is an excellent suggestion and I will give it a try out of hours.

My only question is the documentation says it only works if the type=peer is set, and we use type=friend.



(Lorne Gaetz) #4

The two main auth mechanisms are peer and user, and the third type friend combines the two. It may work, but if it doesn’t you can separate your trunk details into two parts, and populate the peer details with type peer, and the user details with type user.