IAX issue with called Contxt being set

Hi I have a weird problem with IAX2 trunking between 2 new servers

when a call is made the call fails because of the varible ${OUTNUM}${OUT_${DIAL_TRUNK}_SUFFIX} is being set to a value that I cannot find anywhere in the configs see below @CONTEXT is added

[[email protected]:29] Dial(“Local/[email protected];2”, “IAX2/to_aber/[email protected]CONTEXT,300,b(func-apply-sipheaders^s^1,(1))U(sub-send-obroute-email^xxx^xxx^1^1660836863^xxxxxxx^xxxxxx)”) in new stack

in macro-dialout-trunk the line that created this is…

  1. Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM}${OUT_${DIAL_TRUNK}_SUFFIX},${TRUNK_RING_TIMER},${DIAL_TRUNK_OPTIONS}b(func-apply-sipheaders^s^1,(${DIAL_TRUNK}))U(sub-send-obroute-email^${DIAL_NUMBER}^${MACRO_EXTEN}^${DIAL_TRUNK}^${NOW}^${CALLERID(name)}^${CALLERID(number)})) [extensions_additional.conf:34967]

The offending variable is ${OUTNUM}${OUT_${DIAL_TRUNK}_SUFFIX}

so ours is ${OUTNUM}${OUT_to_aber_SUFFIX}

in in the iax2 packet we get


But I cant find reference anywhere for this variable or the value either .

Calls only work id i set context=CONTEXT in the user section of the iax trunk

anyone have any idea where that variables value is drawn from.

asterisk is Asterisk 16.27.0 and freepbx is FBX15 with all modules upto date

BTW whats set is not CONTEXT thats just for this , the real value is not on the server anywhere or in teh asterisk DB or the mysql !

Hi Ian

As a test, I set up a very simple IAX trunk and outbound route. I don’t see the same log line at all

Dialplan looks the same:

29. Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM}${OUT_${DIAL_TRUNK}_SUFFIX},${TRUNK_RING_TIMER},${DIAL_TRUNK_OPTIONS}b(func-apply-sipheaders^s^1,(${DIAL_TRUNK}))U(sub-send-obroute-email^${DIAL_NUMBER}^${MACRO_EXTEN}^${DIAL_TRUNK}^${NOW}^${CALLERID(name)}^${CALLERID(number)}))

results in this log line:

Executing [[email protected]:29] Dial("PJSIP/6002-00000002", "IAX2/iaxname/456,300,Tb(func-apply-sipheaders^s^1,(4))U(sub-send-obroute-email^456^##88456^4^1660842320^Oberon^6002)") in new stack

That’s what you should be seeing, the outbound dialed digits in this case are 456 but in your case appear to be [email protected]. There is something in the global variables that’s confusing the IAX dial string with a PJISP dial string. Do you have any custom global vars set? Maybe recreate the IAX trunk and see if you get the same issue?

OK im close to reason

seems when a trunk is deleted the SUFFIX isnt

[email protected]
[email protected]_OLD_server <<< no OUT_3 trunk been del;eted
[email protected]_copy_1 <<< no OUT_3 trunk been del;eted
[email protected] <<<< mine

[[email protected] ~]# asterisk -rx “dialplan show globals” |grep OUT_

OUT_6=AMP:SIP/[email protected]
[email protected]
[email protected]_OLD_server
[email protected]_copy_1
[email protected] <<<< my problem one

Seems Just a apply config may not rewrite these in the dialplan globals

as after a fwconsole restart we now have

OUT_6=AMP:SIP/[email protected]
[email protected]xxxxx

so now no CALLED CONTEXT : CONTEXT in the iax2 debug

So sorted . but took a restart

so from this I learn that if a customer “cleans” up a system be careful if adding IAX trunk after a sip trunk is deleted if first trunk programmed was a PJSIP one

deleting trunks require a restart it seems

This is a bug. Can you open a ticket pls.

Will do after the weekend


Done [FREEPBX-23675] Clean up global vars when trunks are deleted - Sangoma Issue Tracker

Looks to be a long standing bug since pjsip trunks were added to FreePBX.

1 Like


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

Now marked as resolved in core versions and In the near term, you will need to enable it in advanced settings:

1 Like

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