User defined functions in dialplan

Hi to all.
I’m new in the community.
I’m developing my own Asterisk application and a I need to create a code to manage strings. I’ve seen alternatives with macros and subroutines (gosub) but I’m not sure how to return a value to the calling context. Is there a way to create user define functions like Asterisk defined? (I.e CUT(), LEN(), etc). Thanks in avance.

Not sure if I understood your request 100 %, but you can use Gobsub
Unlike Macro(), the GoSub() dialplan application does not return automatically once it is done executing. In order to return from whence you came, you need to use the Return() application, then use the ${GOSUB_RETVAL} channel variable, which is set whenever you pass a value to the Return() application:

Yes, you are right. I think Return() application with a value as parameter for passing the result of funtion, it’s a very good choice for my requeriment. I’ll try it.
Thank you for your clear response

1 Like