Event throwing ast_yyerrer()

We have what appears to be a “standard” event file which should be generating a file when a remote node is connected:

; ###### Things to do when the System is keyed by a Remote Connection
rmtactive = v|e|${RPT_ALINKS} =~ "\"[TRC]K\""
/usr/local/bin/voter/ctpicker = s|t|rmtactive
touch /temp/rmon.sig  =s|t|rmtactive
rm /temp/rmon.sig  = s|f|rmtactive

Unfortunatly, asterisk is complaining about the rmtactive= evaluation with:

[Feb 29 14:15:36] WARNING[622] ast_expr2.fl: ast_yyerror():  syntax error: syntax error, unexpected '='TILDE, expecting $end; Input:
  =~ "[TRC]K"
  ^
[Feb 29 14:15:36] WARNING[622] ast_expr2.fl: If you have questions, please refer to doc/channelvariables.txt in the asterisk source.

Anyone else seeing this? Any pointers as to what is wrong with the =~ test (it’s really exactly what is found in the cookbook).

You might start by saying the version of software you are using and hardware.

I take it you are using the voter system as well ?

Oh yah- the devil is in the details :slight_smile:

Asterisk reports:
AllStarLink Asterisk Version 2.0.0-beta 03/24/2021 GIT 645450c
Copyright (C) 1999 - 2018 Digium, Inc. Jim Dixon and others
Copyright (C) 2018-2021 AllStarLink Inc.

Looking through our old repeater controller (Debian 10), I’m seeing the same error.
Asterisk 1538, Copyright (C) 1999 - 2008 Digium, Inc. and others.

We have a Doug Hall voter on the primary input, and the voter.conf is also configured for 2 additional nodes.

I am still not clear on your configuration and unable to assist.

Perhaps others with more voter experience will chime in.

But I would make it easy for someone else and state your configuration. Otherwise the error looks like a wild one.

Thanks for following up. It’s probably my lack of experience here - I thought this was a somewhat standard event file. When “things” happen, actions can be triggered.
The file is included from rpt.conf: (Like this)

[events]
#include /etc/asterisk/local/events

the total event file looks like this:


; ###### Event Management configuration file - K8SN

; ###### Things to do when the System is keyed by a LOCAL or RTCM Remote Rptr Site based Signal.
rxactive = v|e|${RPT_RXKEYED}
/usr/local/bin/voter/ctpicker = s|t|rxactive
touch /temp/rxon.sig  =s|t|rxactive
rm /temp/rxon.sig  = s|f|rxactive

; ###### Things to do when the System is keyed by a Remote Connection
rmtactive = v|e|${RPT_ALINKS} =~ "\"[TRC]K\""
/usr/local/bin/voter/ctpicker = s|t|rmtactive
touch /temp/rmon.sig  =s|t|rmtactive
rm /temp/rmon.sig  = s|f|rmtactive

; ###### Things to do when the Transmitter is keyed:
txactive = v|e|${RPT_TXKEYED}
touch /temp/onair.sig  =s|t|txactive
rm /temp/onair.sig  = s|f|txactive

rxactive and txactive work fine, and rmtactive works “most” of the time, except when it doesn’t :slight_smile: When things aren’t “right” I’m finding the ast_yyerrer() message in the log.
I’m really at a loss for what could be wrong with the expression where it works some times and not others.

I did see in an asterisk forum something about Null or None types in comparisons triggering this type of error. If that were the case, I’m thinking v|e|${RPT_ALINKS} is returning a none or null some of the times (which it probably shouldn’t).

Hopefully someone has the solution

What you are posting is code of event management subsystem
Custom code for user decided control…

It would be hard for anyone to know what might be incorrect because it requires knowing the logic of everything connected, which nobody knows just what that is. Or the purpose of the code.

But, I think you are going to have to follow it logically on your own.
It might help to ask the guy who wrote it.

Just guessing, but it is complaining of a syntax error and showing you the error line

  syntax error: syntax error, unexpected '='TILDE, expecting $end; Input:  =~ "[TRC]K"

So, I’m not sure what the function of the tilde is in your code. But it looks like that is what it is complaining about.

https://wiki.allstarlink.org/wiki/Event_Management

Right - that’s the web page that I have copied.
this is my code

rmtactive = v|e|${RPT_ALINKS} =~ "\"[TRC]K\""

this is the example:

TEMPVAR = v|e|${RPT_ALINKS} =~ "\",2001[TRC]K\""

We are looking for “any” node adjacent.

It appears that RPT_ALINKS or v|e|${RPT_ALINKS} is resolving to something that asterisk doesn’t like.
After a bit more digging, it looks like if no adjacent nodes (RPT_ALINKS) connected, the error shows up in the log. Maybe it’s just an annoyance that we have to live with :frowning:

This link is somewhat related Asterisk: Dropping calls with an "ast_yyerror" - Server Fault - similar error, but I don’t believe the resolution is possible in the events file.

I can only say what it shows is a syntax error.
So something is fat fingered.
Review the commands for correctness.

When you first error is a syntax error, the subsequent errors may result because of it not executing.
So, you gotta fix it first.

Could you try one of the tricks from the serverfault post, like using double quotes:
rmtactive = v|e|"${RPT_ALINKS}" =~ "\"[TRC]K\""

encbar5 - thanks for the idea. I had already tried the " and it did not evaluate correctly :frowning:

I think I have figured out the issue. ${RPT_ALINKS} is not defined after startup or reload of asterisk.
doing a rpt xnode shows NO ${RPT_ALINKS}. Connect to a remote node and ${RPT_ALINKS} appears with the correct format, Disconnect from remote node at ${RPT_ALINKS} = 0 (and the error goes/stays away).
I suppose some sort of initialization for this var needs to happen in a config file somewhere… or just live with the errors in the log until a connect actually happens.

If you have a var or global var, you need to double check it’s creation and a default/starting value.
And just when those occur because you can’t set a global var that has yet to be created. Timing…