IAX2 Trunk use the wrong context

Goodmorning everyone!
I’m try to configure 4 FreePBX server to comunicate each other. I configured a 3 IAX2 Trunks in every PBX with type=friend and host=ip.remote.pbx and context=custom-context.
Then I configure the routes to use the trunks, I want to use a prefix to “select” the pbx and then the remote extensions like this: 20100 to call the 100 extension in the second pbx; 30100 to call the 100 extension in the third pbx and so on.
Well, so far so good, I added in the extension_custom.conf the custom context with the option “exten => _.,n,Set(CALLERID(num)=20${CALLERID(num)})” but when a call arrive in the remote pbx, it wrongs the trunk context and use the context of the last iax trunk added.
Thanks to all for the support!!!

Share a call trace via pastebin of what you’re talking about. Its likely you’re setting the CID too early in the call flow, and it gets rewritten based on the macro at the outbound route. Providing Great Debug - Support Services - Documentation

I would like to help you Andrea but I’m pretty new on FreePBX, but Maybe You can help me to connect two Freepbx server. I already have the [email protected] Trunk but on the outbound route I always get the busy tone. My server 1 has the extension 7000 7001 and server 2 extension 3000 , 3001, 3002. I cant call any extension 300x from my server 1 and the same in the other direction. Any advise please?

Hi Igaetz,
I think you’re right I manipulate the caller CID to early. What is the best practice to manipulate the CID from incoming call from IAX2 trunk? Thanks!

Hi Giancarlorm,
You’ve tried to analyze how the call arrive in the destination FreePBX? For analize it usually I connect via SSH to the FreePBX server and then launch the asterisk CLI with the command asterisk -rvvvvv on linux console.
When the Asterisk CLI is “started” I start the iax debug with the command iax2 set debug on.
When you have finish the debug analysis stop it with iax2 set debug off.

Thank you very much, when I have half day free I try it!
Thanks again

Hi @lgaetz, I’ve tried but I’m doing still something wrong.
I started the asterisk cli and then start the iax2 debug and the result was very strange!
If I call from the remote pbx number 1 the call incoming like this:
Executing [[email protected]:1] NoOp(“IAX2/RemotePBX1”, “”) in new stack, and up to here everything works.
But if i call from the remote pbx number 2 the call incoming like this:
Executing [[email protected]:1] NoOp(“IAX2/RemotePBX2”, “”) in new stack but in the trunk RemotePBX2 I’ve specify context=from-remote-pbx2.
Any suggestion? Thanks!

I will try this weekend, Thanks for your help

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.