Route IAX call through a call flow but potentially just 'leave it alone'?

I am assuming you have set up the IAX trunk with context “from-internal” based on the scenario you described. In this context the extensions will take priority.

Try this!

Admin - Custom Destinations: create one that looks like this:

Then set up your time condition:

Now you have a time condition that will route to the dialed extension during day hours, and route to an announcement during night hours. The next thing to do is direct your IAX trunk to it.

Edit /etc/asterisk/extensions_custom.conf and add this at the top or bottom:

[from-iax-partner-pbx]
exten => _X.,1,Goto(timeconditions,1,1)

What is important here is the first “1” after “timeconditions”. To figure out what number to place there, you look at the URL in FreePBX when you are at the screen where you would edit that time condition. On mine, the URL is /admin/config.php?display=timeconditions&view=form&itemid=1 and the “1” comes from the itemid= at the end. If yours says itemid=5 then in your custom file you would put “timeconditions,5,1”

Finally edit your IAX trunk and where it says “context=from-internal” change that to “context=from-iax-partner-pbx”.

Last note: this assumes you are only sending extension-to-extension traffic across the trunk. The time condition will intercept everything. If you want to be more selective you just edit the custom from-iax-partner-pbx context to match the extension range and go to the time condition, and match other patterns and go to from-internal or whatever makes sense in your environment.

2 Likes