# Problems using tonemacro, rptinactmacro, and event management to manage connections with scripts

**URL:** https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154
**Category:** AllStarLink
**Created:** [February 1, 2022, 6:07pm UTC](https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154 "2022-02-01T18:07:18Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Buhalo](https://community.allstarlink.org/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@Buhalo](https://community.allstarlink.org/u/Buhalo)
#### Post date: [February 1, 2022, 6:07pm UTC](https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154/1 "2022-02-01T18:07:18Z")

</div>

I use event management to manage connections when certain events occur.  
To manage connections, scripts are executed that execute a series of commands to the asterisk.

Below is an example of using the event.

[1997001]  
events=events

[events]  
REMOTEKEYED\_VAR = v|e|${RPT\_ALINKS} =~ “”,1997002[TRC]K""  
sudo -u root /bin/bash /etc/asterisk/Scripts/event\_1.sh \> /dev/null 2\>&1 = s|t|REMOTEKEYED\_VAR

SCRIPT: event\_1.sh

#!/bin/bash

tempfile=/tmp/hub\_conn

/usr/sbin/asterisk -rx “rpt nodes 28554” \> $tempfile

grep “1200” $tempfile \> /dev/null ||  
CONNECTSTATUS=0

grep “1200” $tempfile \> /dev/null &&  
CONNECTSTATUS=1

if [[“$CONNECTSTATUS” == “0”]]  
then  
exit  
fi

if [[“$CONNECTSTATUS” == “1”]]  
then  
/usr/sbin/asterisk -rx “rpt cmd 1200 ilink 1 28554”&&  
/usr/sbin/asterisk -rx “rpt cmd 1200 ilink 11 28554”  
fi

exit

To restore the previous connection configuration, I use rptinacttimer. Below is an example of its use.

[1200]  
rptinacttimer=1  
rptinacttime=180  
rptinactmacro=\*D9901#  
macros=macros

[macros]  
D9901 = cmd,/etc/asterisk/Scripts/act\_timer.sh \> /dev/null 2\>&1

SCRIPT: act\_timer.sh

#!/bin/bash

tempfile=/tmp/hub\_conn

/usr/sbin/asterisk -rx “rpt nodes 28554” \> $tempfile

grep “1200” $tempfile \> /dev/null ||  
CONNECTSTATUS=0

grep “1200” $tempfile \> /dev/null &&  
CONNECTSTATUS=1

if [[“$CONNECTSTATUS” == “1”]]  
then  
exit 0  
fi

if [[“$CONNECTSTATUS” == “0”]]  
then  
/usr/sbin/asterisk -rx “rpt cmd 1200 ilink 18 28554”  
fi

exit 0

The problem is that after some time, it can be 4-10-20 hours, problems occurs, expressed in crackles and sound distortions or short interruptions of the subtone at the transmitter output.  
These problems appear all the time, not just when an event triggers a script, and are fixed by restarting the asterisk.

When this functionality is disabled, the node works as expected.  
I had exactly the same problem when I used tonemacro and similar script to manage connections using subtones.

What could be the problem?

---

<div class="post-metadata">

### Author: ![Mike](https://community.allstarlink.org/user_avatar/community.allstarlink.org/mike/32/1569_2.png) [@Mike](https://community.allstarlink.org/u/Mike)
#### Post date: [February 1, 2022, 10:46pm UTC](https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154/2 "2022-02-01T22:46:07Z")

</div>

I think for a clue, you might want to check cpu utilization and memory usage while it is occurring.  
Compare to when it is not.  
DSP functions are going to use more of both and perhaps in a Pi (guessing you are using), it’s not enough with other background processes.

---

<div class="post-metadata">

### Author: ![WD6AWP](https://community.allstarlink.org/user_avatar/community.allstarlink.org/wd6awp/32/5_2.png) [@WD6AWP](https://community.allstarlink.org/u/WD6AWP)
#### Post date: [February 2, 2022, 1:57pm UTC](https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154/3 "2022-02-02T13:57:17Z")

</div>

If you are using a Pi, try the ASL beta6. If fixes the stuttering problems. Download from the [AllStarLink Wiki](https://wiki.allstarlink.org/wiki/Main_Page).

---

<div class="post-metadata">

### Author: ![Buhalo](https://community.allstarlink.org/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@Buhalo](https://community.allstarlink.org/u/Buhalo)
#### Post date: [February 6, 2022, 9:55pm UTC](https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154/4 "2022-02-06T21:55:14Z")

</div>

Did more testing. ASL version beta6. RAM, CPU and HDD usage are the same as always.  
The problem occurs on two nodes, the first one hosted on ESXi, the second one on rpi.

---

<div class="post-metadata">

### Author: ![Mike](https://community.allstarlink.org/user_avatar/community.allstarlink.org/mike/32/1569_2.png) [@Mike](https://community.allstarlink.org/u/Mike)
#### Post date: [February 6, 2022, 11:17pm UTC](https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154/5 "2022-02-06T23:17:01Z")

</div>

Well, I’m outta ideas.  
With exception to looking at the sound fob having issues.

---

<div class="post-metadata">

### Author: ![Buhalo](https://community.allstarlink.org/letter_avatar_proxy/v4/letter/b/dbc845/32.png) [@Buhalo](https://community.allstarlink.org/u/Buhalo)
#### Post date: [February 7, 2022, 12:54pm UTC](https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154/6 "2022-02-07T12:54:43Z")

</div>

Sound devices work fine. When this functionality (macros/events+scripts) is disabled, both nodes work fine.

---

<div class="post-metadata">

### Author: ![Mike](https://community.allstarlink.org/user_avatar/community.allstarlink.org/mike/32/1569_2.png) [@Mike](https://community.allstarlink.org/u/Mike)
#### Post date: [February 8, 2022, 8:57pm UTC](https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154/7 "2022-02-08T20:57:10Z")

</div>

While this is revolving in my mind from time to time,  
Can you say which PL tone you are using ?  
And are you also using a ASL audio filter in your set-up ?

---

<div class="post-metadata">

### Author: ![Mike](https://community.allstarlink.org/user_avatar/community.allstarlink.org/mike/32/1569_2.png) [@Mike](https://community.allstarlink.org/u/Mike)
#### Post date: [February 8, 2022, 10:45pm UTC](https://community.allstarlink.org/t/problems-using-tonemacro-rptinactmacro-and-event-management-to-manage-connections-with-scripts/19154/8 "2022-02-08T22:45:19Z")

</div>

> [@ASL 2.0.0 Beta USBradio CTCSS?](https://community.allstarlink.org/t/asl-2-0-0-beta-usbradio-ctcss/18271/6):
>
> Thanks Kevin, Quick question, my reason for generating the CTCSS TX code in Allstar is that I’m using an MTR2000 and want to inject the composite signal into the A17 backplane connector. Will that meet the requirement for no HP or LP filtering?

> [@ASL 2.0.0 Beta USBradio CTCSS?](https://community.allstarlink.org/t/asl-2-0-0-beta-usbradio-ctcss/18271/7):
>
> Hardware dependent DAHDI timing issues were originally repaired by Steve (N4IRS) and Mike (N4IRR) in the DIAL release for X86 and the original Pi release. This patch is necessary as some hardware doesn’t accommodate for VoIP audio streaming properly as a hardware function. Somehow along the way, this fix got lost, broken, or corrupted in later ASL 1.0 Raspberry Pi distributions. Adam KC1KCC found and fixed this in his version which ultimately became ASL 2.0.0. DAHDI timing issues result in a stuttering of the transmitted audio stream, sometimes sounding like a machine gun in the background.
> 
> The wide bandwidth rules are an invention of Jeff (WN3A) and are available to widen both the receive and transmit audio path (local) when the usbradio channel driver is used. This is well documented here:  
> [AllStarLink](https://wiki.allstarlink.org/wiki/Audio_Filters)

wiki

### Receiver Audio High Pass Filter Options:[[edit](https://wiki.allstarlink.org/index.php?title=Audio_Filters&action=edit&section=3)]

- rxhpf=0; 300 Hz cutoff. Default value to reduce sub-audible signals for retransmission, and also in the receiver speaker.
- rxhpf=1; 250 Hz cutoff for additional received and retransmitted bass response. We recommend using this filter with a **CTCSS tone no higher than 186.2 Hz**.
