Gosub arguments

I have taken over a legacy asterisk and one of the Dial applications has this option:


The arguments are separated by commas, whereas the documentation says that arguments are separated by ^. Are commas officially acceptable?

About the second argument, what is the | symbol? Is it a logical OR? In the subroutine, the resulting ${ARG2} from the above invocation appears to contain the extension dialed. What does the 1| mean?


Documentation doesn’t make any reference of using logical operator inside the arguments, or the use commas as valid separator for arguments

A valid argument would be

same => n,Dial(PJSIP/alice,U(my_gosub_routine^my_gosub_arg1^my_gosub_arg2))

You say legacy, what Asterisk version do you use? The separators have been changed from | and ^ to comma, somewhere around 1.6 or 1.8. In some versions from back then, it was possible to use both separators.

The system was created 10 years ago. I have migrated the dial plans to a new 15.7 system and they seem to work.

From what you said, ^ is older than comma. But the latest documentation (I checked version 15) says the separator is ^. I am confused now.

^is the separator for parameters to options, like the pre- and post-dial macros, comma separates everything else. In previous versions the | character was used in place of comma, I don’t remember if | was an alternative to comma, or comma came later. The oldest version of Asterisk I have managed, was a 1.4 system using freepbx as a management interface. In later versions not using FreePBX the separator has been comma.

To sum up:

In the old days this was how to do it:


Today it is

An example of using | to separate can be seen in the sample config for asterisk 1.0, in line 329 https://github.com/asterisk/asterisk/blob/1.0/configs/extensions.conf.sample

That same example is present in sample config for 1.2 and 1.4 as well, but removed in 1.6. So I guess the change happens somewhere around 1.2 or 1.4, but might have been still supported, but deprecated, in 1.6.