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

[s@macro-dialout-trunk:29] Dial(“Local/xxx@from-internal-00000abc;2”, “IAX2/to_aber/xxx@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

CALLED CONTEXT : CONTEXT

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 [s@macro-dialout-trunk: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 xxx@CONTEXT. 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

OUT_4_SUFFIX=@Gradwell
OUT_5_SUFFIX=@Gradwell_OLD_server <<< no OUT_3 trunk been del;eted
OUT_3_SUFFIX=@Gamma_copy_1 <<< no OUT_3 trunk been del;eted
OUT_1_SUFFIX=@Gamma <<<< mine

[root@freepbx ~]# asterisk -rx “dialplan show globals” |grep OUT_

OUT_6=AMP:SIP/[email protected]
OUT_4_SUFFIX=@xxxxxxx
OUT_4=PJSIP
OUT_2=IAX2/to_card
OUT_1=IAX2/to_aber
OUT_5_SUFFIX=@xxxxxxx_OLD_server
OUT_5=PJSIP
OUT_3_SUFFIX=@xxxxxxx_copy_1
OUT_3=PJSIP
OUT_1_SUFFIX=@CONTEXT <<<< 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]
OUT_4_SUFFIX=@xxxxxx
OUT_4=PJSIP
OUT_2=IAX2/to_card
OUT_1=IAX2/to_aber

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

Ian

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

Thanks.

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

Now marked as resolved in core versions 16.0.65.13 and 15.0.22.17. 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.