I placed the following in my rpt.conf

and restarted asterisk. But it doesn’t play the message (the command works from the command line) when RX goes active

[events]
/usr/sbin/asterisk -rx “rpt playback 1100 /etc/asterisk/audio/newsfiles/newsline_10” = s|e|${RPT_RXKEYED}

I also tried this but COS isn’t set as a global variable either

COS = g|e|${RPT_RXKEYED}

What duplex mode are you using for this node ? (rpt.conf) duplex= ?

Duplex =0 with linktolink = yes

I think I see what the (my) problem is - I expected a global variable to be accessible by the shell, but apparently it is only accessible by the Asterisk AMI or AGI. But I can see it in the Asterisk CLI

Maybe Event Management isn’t what I want but I am after a way to have a bash script I’m running know if RX is active or not

Take a look at https://www.qsl.net/k0kn/swissarmy there might be some hints in there to do what you want to do.

Thanks for the link. However, as a test I tried one other thing

Under the node stanza:

events = events1234

Then the new stanza:

[events1234]
COS = g|e|${RPT_RXKEYED}
touch /home/test/test = s|t|COS

/home/test is writable to the world

This does not create a file “text” in said directory, though the CLI shows:

Setting global variable ‘COS’ to ‘1’

I found the solution.

This does NOT work:

[events1234]
COS = g|e|${RPT_RXKEYED}
touch /home/test/test = s|t|COS

THIS does work:

[events1234]
touch /home/test/test = s|t|RPT_RXKEYED

This doesn’t seem to be in line with the Wiki

I see your text of what works for you, but as far as I can see, you are creating a file ‘test’ on RPT_RXUNKEYED

But to know why or how that worked, I would need to see the rest of the judgement you are making when the statement is not true, for the file still exists from 'touch’ing it.
You are not removing it as well when the statement is untrue.

Well… I was just touching a file to verify the feature was working. (I certainly wouldn’t touch and delete a file every time RX went active/inactive on an SD card).

What I ultimately wish to do is set a variable that can be read by a bash script to determine RX activity. But from my above test, it seems that variables don’t work as the Wiki says they should. At least not for me

I kinda got the idea.

Here is a method I used, writing to a file so I could tail it for live evaluations.
It’s kinda old but should work as well.

while read -r line
do
asterisk -rx “rpt showvars 1000” > livestat.txt
stat="$line"
if $stat = “RPT_TXKEYED=0”; then
exit 1
fi
done < “$statname”

You would have to convert it a bit to fit your shell purpose. But you get the idea.
Perhaps it would keep you from fiddling with onevent.

I should mention that there is a method to carry a var back into asterisk from a shell.
But I would use a global declaration for it.
I’m sure that gets additional wheels turning.

@AH6LE you can always put the file on a RAMdisk. That’s very easy to do on Linux, especially if you have ramfs available (certainly seen it on anything Debian based). Software such as Pi-Star makes extensive use of RAMdisks for logging and other frequently written directories.

Can touch and delete to your heart’s content. :slight_smile:

Great idea guys, thanks for the idea

I created ramdisk at /etc/ramdisk and allocated it 1 meg. In my rpt.conf file:

touch /etc/ramdisk/cor = s|t|RPT_RXKEYED
rm /etc/ramdisk/cor = s|f|RPT_RXKEYED

I just check for the existence of /etc/ramdisk/cor in my script and voila!

2 Likes

Glad to see it worked out. I may be interested in your idea, where and how are those lines inserted into rpt.conf?

Sure! Here are the entries in my rpt.conf

[events1234]

;the following lines create/erase file cor for either Allstar RX or TX
touch /etc/ramdisk/cor = s|t|RPT_RXKEYED
touch /etc/ramdisk/cor = s|t|RPT_TXKEYED
rm /etc/ramdisk/cor = s|f|RPT_RXKEYED
rm /etc/ramdisk/cor = s|f|RPT_TXKEYED

The reason for using both RX and TX is to make sure ASL sees activity locally or coming from another connected node

Thanks, I’m looking to rebuild my IRLP node and upgrade my ASL node to ASL2.0, and this functionality could be useful to support IRLP’s busy channel lockout.