Goto outrt-X,${OUTNUM},1 does not work?

Good afternoon! I want to customize outgoing routing!
I’m trying to do this
extensions_override_freepbx.conf
[macro-dialout-trunk-predial-hook]
exten => s,1,Verbose(0, -----)
same => n,Goto(${outrt-10},${OUTNUM},1)
same => n,MacroExit()

I have such a log
– Executing [[email protected]:1] Macro(“PJSIP/703-00042cbe”, “user-callerid,LIMIT,EXTERNAL,”) in new stack
– Executing [[email protected]:1] Set(“PJSIP/703-00042cbe”, “TOUCH_MONITOR=1635883349.902353”) in new stack
– Executing [[email protected]:2] Set(“PJSIP/703-00042cbe”, “AMPUSER=703”) in new stack
– Executing [[email protected]:3] Set(“PJSIP/703-00042cbe”, “HOTDESCKCHAN=703-00042cbe”) in new stack
– Executing [[email protected]:4] Set(“PJSIP/703-00042cbe”, “HOTDESKEXTEN=703”) in new stack
– Executing [[email protected]:5] Set(“PJSIP/703-00042cbe”, “HOTDESKCALL=0”) in new stack
– Executing [[email protected]:6] ExecIf(“PJSIP/703-00042cbe”, “0?Set(HOTDESKCALL=1)”) in new stack
– Executing [[email protected]:7] ExecIf(“PJSIP/703-00042cbe”, “0?Set(CALLERID(name)=)”) in new stack
– Executing [[email protected]:8] GotoIf(“PJSIP/703-00042cbe”, “18?report”) in new stack
– Goto (macro-user-callerid,s,29)
– Executing [[email protected]:29] NoOp(“PJSIP/703-00042cbe”, “Macro Depth is 6”) in new stack
– Executing [[email protected]:30] GotoIf(“PJSIP/703-00042cbe”, “0?report2:macroerror”) in new stack
– Goto (macro-user-callerid,s,40)
– Executing [[email protected]:40] NoOp(“PJSIP/703-00042cbe”, “Macro Limit Reached. Aborting Call”) in new stack
– Executing [[email protected]:41] Answer(“PJSIP/703-00042cbe”, “”) in new stack
– Executing [[email protected]:42] Wait(“PJSIP/703-00042cbe”, “1”) in new stack
– Executing [[email protected]:43] Gosub(“PJSIP/703-00042cbe”, “macro-user-callerid,lang-playback,1(hook_2)”) in new stack
– Executing [[email protected]:1] GosubIf(“PJSIP/703-00042cbe”, “0?macro-user-callerid,ru,hook_2():macro-user-callerid,en,hook_2()”) in new stack
– Executing [[email protected]:5] Playback(“PJSIP/703-00042cbe”, “im-sorry&an-error-has-occurred”) in new stack

and such a dialplan show
dialplan show [email protected]
[ Context ‘outrt-10’ created by ‘pbx_config’ ]
‘_+790663[1-9]XXXX’ => 1. Macro(user-callerid,LIMIT,EXTERNAL,) [pbx_config]
2. Gosub(sub-record-check,s,1(out,${EXTEN},yes)) [pbx_config]
3. ExecIf($[ “${CALLEE_ACCOUNCODE}” != “” ] ?Set(CDR(accountcode)=${CALLEE_ACCOUNCODE})) [pbx_config]
4. Set(_ROUTEID=10) [pbx_config]
5. Set(_ROUTENAME=BEELINE) [pbx_config]
6. Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})}) [pbx_config]
7. Set(_CALLERIDNAMEINTERNAL=${CALLERID(name)}) [pbx_config]
8. Set(_CALLERIDNUMINTERNAL=${CALLERID(num)}) [pbx_config]
9. Set(_EMAILNOTIFICATION=FALSE) [pbx_config]
10. Set(_NODEST=) [pbx_config]
11. Macro(dialout-trunk,9,${EXTEN},off) [pbx_config]
12. Macro(dialout-trunk,10,${EXTEN},off) [pbx_config]
13. Macro(dialout-trunk,2,${EXTEN},off) [pbx_config]
14. Macro(dialout-trunk,8,${EXTEN},off) [pbx_config]
15. Macro(outisbusy,) [pbx_config]

-= 1 extension (15 priorities) in 1 context. =-

Asking for help, what am I doing wrong? How do I customize the outgoing direction?

It’s conventional to place your dialplan in extensions_custom.conf, not in override.

It looks like you have a dialplan hook that sends calls unconditionally to outrt-10, even calls that are already using that context, and thus you get a loop. I suspect you would have better success with a custom trunk than a dialplan hook, but if you describe your goal, there may be a better approach. What are you trying to do?

Thanks for the answer!
I get from a third-party service the affiliation of the number to the provider via AGI and then I want to direct this outgoing call through the outgoing routing I need
[macro-dialout-trunk-predial-hook] ;
exten => s,1,Verbose(0, -----ASR----------)
exten => s,n,DumpChan()
same => n,Noop(${DIAL_TRUNK},${OUTNUM},${CALLERID(number)})
same => n,AGI(trunk_hook.php,${OUTNUM},${CALLERID(number)})
same => n,Set(var_trunk_operator=${trunk_operator})
same => n,Set(var_trunk_region=${trunk_region})
same => n,Set(var_trunk_operatorID=${trunk_operatorID})
same => n,Set(var_trunk_outrt=${trunk_outrt})
same => n,GotoIf($["${trunk_outrt}" = “pusto”]?pusto:gonext)
same => n(pusto),MacroExit()
same => n(gonext),Noop(${var_trunk_operator},${var_trunk_region},${var_trunk_operatorID},${var_trunk_outrt},${OUTNUM})
same => n,Goto(${var_trunk_outrt},${OUTNUM},1)
same => n,MacroExit()

AGI returns the outgoing routing number for me
var_trunk_outrt = outrt-10

The result is something like this
same => n,Goto(outrt-10,+79066358080,1)

To make a custom trunk, you would use a Custom Dial String of the trunk like this:

Local/[email protected]

And a context in extensions_custom.conf like this:

[admtt76-trunk]
exten => _.,1,Noop(Entering user defined context in extensions_custom.conf)
exten => _.,n,Noop(Outbound dial string in ${EXTEN})
; add whatever lines you want here
exten => _.,n,Hangup

Maybe that will help you.

I think you don’t quite understand me…
I tried it like this
extensions_custom.conf
[from-internal-custom]
exten => _.,1,Noop(ASR-ASR-ASR)
exten => _.,n,Noop(${EXTEN})
exten => _.,n,Goto(${outrt-13},${EXTEN},1)

But the call goes into a loop

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