Func_args: Can't find trailing parenthesis for function 'SHELL(test -e /etc/asterisk/dialplans/

What is wrong with this piece of code. Pulling my hair out cause I just can’t seem to find the issue.

Dialplan code

same => n,Set(ctbPromptIntro=${SHELL(test -e /etc/asterisk/dialplans/chattabai/prompts/en/${CALLERID(dnid)}.sln && echo '/etc/asterisk/dialplans/chattabai/prompts/en/${CALLERID(dnid)}.sln' || echo 'set something else here'})
same => n,Goto(ctbSessionInit,1,1)

Error

[May  3 20:41:26] WARNING[83859][C-00000027]: pbx_functions.c:460 func_args: Can't find trailing parenthesis for function 'SHELL(test -e /etc/asterisk/dialplans/chattabai/prompts/en/1.sln && echo '/etc/asterisk/dialplans/chattabai/prompts/en/1.sln' || echo 'set something else here''?
    -- Executing [1@chattabai:22] Set("PJSIP/local2-00000026", "ctbPromptIntro=set something else here
    -- ") in new stack
    -- Executing [1@chattabai:23] Goto("PJSIP/local2-00000026", "ctbSessionInit,1,1") in new stack

I don’t really know anything about Asterisk. I’m here to learn. However I’ve been a programmer for 22 years. So I think I might have a valid guess: I think you need another closing parenthesis at the end of line 1. I see 4 opening parenthesis and only 3 closing parenthesis.

Actually it might just be needed after here'} so that it looks like here')}

Try this:

Set(ctbPromptIntro=${SHELL(test -e /etc/asterisk/dialplans/chattabai/prompts/en/${CALLERID(dnid)}.sln && echo '/etc/asterisk/dialplans/chattabai/prompts/en/${CALLERID(dnid)}.sln' || echo 'set something else here')})

Thank you very much. That was indeed the case. Asterisk dialplan code does not have any syntax checker available for my IDE.

you may ant to start using this tool to help find these kind of mistakes

2 Likes

In Emacs, when you position the cursor over a bracketing symbol (opener or closer), it highlights both brackets of the pair in green. If it cannot find a match for that bracket, it highlights it in purple.

This works in any text file; it doesn’t need any special language-specific rules for this.

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