Topics

Custom DTMF Dial Path


VK4DAK
 

Hi all!

I am hoping you may be able to assist with some scripting .....

I have a problem where some locals think its great to key up REF9999 (Parrot) and leave it connected. The problem is that it causes loopbacks. I have created a custom decode so that when 9999 is detected - it is sent to "exit 1" (nothing happens).

The problem with this is that I have had some users wishing to use the 9999 to test their audio levels .... 

Here in is my problem.... some people can't be trusted which is at the detriment to others who do.

I am hoping to create a custom script so that when a discrete DTMF code is punched - it allow the connection to 9999

Any ideas? I have tried creating a script that when the discrete code is entered, it will either $SCRIPT/decode 9999 -- but this then ends up in the "exit 1" pile (nothing happens)

Thoughts, comments, suggestions?


Nosey Nick VA3NNW
 

VK4DAK wrote:
I am hoping to create a custom script so that when a discrete DTMF code is punched - it allow the connection to 9999
Any ideas? I have tried creating a script that when the discrete code is entered, it will either $SCRIPT/decode 9999 -- but this then ends up in the "exit 1" pile (nothing happens)
Thoughts, comments, suggestions?

Well... You could just give it a DIFFERENT NUMBER, EG:

if [ "${1}" = "9999" ]; then exit 1 ; fi # having done nothing
if [ "${1}" = "ABC123" ]; then $SCRIPT/connect_to_reflector ref9999 ; fi

If, on the other hand, you want to keep it as an "enable/disable" idea, maybe use the presence of a file to say "9999 is allowed now" or alternatively "9999 is blocked now"? You can create a file with "touch FILENAME", remove it with "rm FILENAME", check for it like "if [ -f FILENAME ] then ... fi" or considering you already have the "if" statement, you can combine:

CONDITION1 -a CONDITION2 means "CONDITION1 AND CONDITION2"
CONDITION1 -o CONDITION2 means "CONDITION1 OR CONDITION2"

So my UNTESTED example might be...

if [ "$1" = "A999" ]; then touch /tmp/enable9999; exit 1; fi
if [ "$1" = "D999" ]; then rm /tmp/enable9999; exit 1; fi # disable it again
if [ "$1" = "9999" -a -f /tmp/enable9999 ]; then $SCRIPT/connect_to_reflector ref9999; exit 1; fi

Or it might be nice to play some WAVs so it can provide some feedback, and it looks like you don't even need to record any custom ones - there are some provided ones you can use! ... so ALSO UNTESTED...

if [ "$1" = "A999" ]; then
  touch /tmp/enable9999
  $SCRIPT/wavplay 9 9 9 9 enabled
  exit 1
fi
if [ "$1" = "D999" ]; then
  rm /tmp/enable9999
  $SCRIPT/wavplay 9 9 9 9 disabled
  exit 1
fi
if [ "$1" = "9999" ]; then
 if [ -f /tmp/enable9999 ]; then
   $SCRIPT/connect_to_reflector ref9999
  else
    $SCRIPT/wavplay lockout_local
  fi
  exit 1
fi

Incidentally, BASH's "case" statement can make "custom_decode" MUCH neater, I wonder why IRLP doesn't use it? Allows you to combine a big list of "if [ $1 = blah ]; then blah fi" into...

case "$1" in
  A999) touch   /tmp/enable9999; $SCRIPT/wavplay 9 9 9 9 enabled;  exit 1 ;;
  D999) rm      /tmp/enable9999; $SCRIPT/wavplay 9 9 9 9 disabled; exit 1 ;;
  9999) if [ -f /tmp/enable9999 ]; then $SCRIPT/connect_to_reflector ref9999
                                   else $SCRIPT/wavplay reflector disabled
        fi ; exit 1 ;;
esac

Again, UNTESTED, but could probably slowly debug over email if it doesn't work as expected.

Nick VA3NNW

-- 
"Nosey" Nick Waterman, VA3NNW/G7RZQ, K2 #5209.
use Std::Disclaimer;    sig@...
A bug in the hand is better than one as yet undetected.


k9dc
 

On Jun 10, 2020, at 07:44, VK4DAK <vk4dak@...> wrote:
Hi all!
I am hoping you may be able to assist with some scripting .....
I have a problem where some locals think its great to key up REF9999 (Parrot) and leave it connected. The problem is that it causes loopbacks. I have created a custom decode so that when 9999 is detected - it is sent to "exit 1" (nothing happens).
The problem with this is that I have had some users wishing to use the 9999 to test their audio levels ….
There are a couple of ways to handle this.

First is to create and use the lockout_list file. If the file exists, it contains a list of nodes and reflectors you do not want to connect, both outgoing and incoming calls are blocked.

If custom/lockout_list looks like this

ref9605
ref9607
stn4733
stn7530
ref9999
ref9998
ref9990

This nodes cannot be dialed, and incoming calls (from listed nodes) are also blocked. Users will hear the lockout_local recording when dialing “Your node operator does not allow calls to this node” If an incoming call is received (from 4733 or 7530) the calling station hears the lockout_remote recording "The node you are calling does not allow calls from your node"

Simply include ref9999 ref9990 and others you want to block, but leave at least one open that works (I leave 9997 working on my machines).

Second method involves editing custom_decode and mixing up the the dial requirements. Two entries required for each. First, trap out the pattern you want to disallow. Then set up an alternate pattern that works.

if [ "$1" = “9999" ] ; then "$SCRIPT"/wavplay lockout_local ; exit 1 ; fi
if [ "$1" = “12345" ] ; then "$SCRIPT"/connect_to_reflector ref9999 ; exit 1 ; fi

This plays the lockout_local recording when 9999 is dialed (sounds the same a using the lockout_list file above). But if 12345 is dialed it connects to 9999.

custom/custom_decode entries can also be used if you want to use some of the options like “notimeout” on specific destinations.


k9dc
 

Goops. Forgot
de k9dc

On Jun 10, 2020, at 09:26, k9dc <Dave@...> wrote:


On Jun 10, 2020, at 07:44, VK4DAK <vk4dak@...> wrote:
Hi all!
I am hoping you may be able to assist with some scripting .....
I have a problem where some locals think its great to key up REF9999 (Parrot) and leave it connected. The problem is that it causes loopbacks. I have created a custom decode so that when 9999 is detected - it is sent to "exit 1" (nothing happens).
The problem with this is that I have had some users wishing to use the 9999 to test their audio levels ….
There are a couple of ways to handle this.

First is to create and use the lockout_list file. If the file exists, it contains a list of nodes and reflectors you do not want to connect, both outgoing and incoming calls are blocked.

If custom/lockout_list looks like this

ref9605
ref9607
stn4733
stn7530
ref9999
ref9998
ref9990

This nodes cannot be dialed, and incoming calls (from listed nodes) are also blocked. Users will hear the lockout_local recording when dialing “Your node operator does not allow calls to this node” If an incoming call is received (from 4733 or 7530) the calling station hears the lockout_remote recording "The node you are calling does not allow calls from your node"

Simply include ref9999 ref9990 and others you want to block, but leave at least one open that works (I leave 9997 working on my machines).

Second method involves editing custom_decode and mixing up the the dial requirements. Two entries required for each. First, trap out the pattern you want to disallow. Then set up an alternate pattern that works.

if [ "$1" = “9999" ] ; then "$SCRIPT"/wavplay lockout_local ; exit 1 ; fi
if [ "$1" = “12345" ] ; then "$SCRIPT"/connect_to_reflector ref9999 ; exit 1 ; fi

This plays the lockout_local recording when 9999 is dialed (sounds the same a using the lockout_list file above). But if 12345 is dialed it connects to 9999.

custom/custom_decode entries can also be used if you want to use some of the options like “notimeout” on specific destinations.


David Cameron - IRLP
 

I would suggest a separate script that is called that just records and plays back the audio. Using the echo reflector for this is not the best way. The script "audio_level_test" contains all the needed pieces, just needs to be told to play back the audio file instead of the statistics.

For the fun of it, I made one called rx_parrot and put it in the scripts directory to sync to all nodes.

It is not perfect, but will be adjusted over time I am sure. To use it, add this line to custom_decode (replacing A3 with the code you want):

if [ "${1}" = "A3" ]; then $SCRIPT/rx_parrot ; fi

David Cameron
VE7LTD

On 2020-06-10 6:25 a.m., Nosey Nick VA3NNW wrote:
VK4DAK wrote:
I am hoping to create a custom script so that when a discrete DTMF code is punched - it allow the connection to 9999
Any ideas? I have tried creating a script that when the discrete code is entered, it will either $SCRIPT/decode 9999 -- but this then ends up in the "exit 1" pile (nothing happens)
Thoughts, comments, suggestions?
Well... You could just give it a DIFFERENT NUMBER, EG:
if [ "${1}" = "9999" ]; then exit 1 ; fi # having done nothing
if [ "${1}" = "ABC123" ]; then $SCRIPT/connect_to_reflector ref9999 ; fi
If, on the other hand, you want to keep it as an "enable/disable" idea, maybe use the presence of a file to say "9999 is allowed now" or alternatively "9999 is blocked now"? You can create a file with "touch FILENAME", remove it with "rm FILENAME", check for it like "if [ -f FILENAME ] then ... fi" or considering you already have the "if" statement, you can combine:
CONDITION1 -a CONDITION2 means "CONDITION1 AND CONDITION2"
CONDITION1 -o CONDITION2 means "CONDITION1 OR CONDITION2"
So my UNTESTED example might be...
if [ "$1" = "A999" ]; then touch /tmp/enable9999; exit 1; fi
if [ "$1" = "D999" ]; then rm /tmp/enable9999; exit 1; fi # disable it again
if [ "$1" = "9999" -a -f /tmp/enable9999 ]; then $SCRIPT/connect_to_reflector ref9999; exit 1; fi
Or it might be nice to play some WAVs so it can provide some feedback, and it looks like you don't even need to record any custom ones - there are some provided ones you can use! ... so ALSO UNTESTED...
if [ "$1" = "A999" ]; then
 touch /tmp/enable9999
$SCRIPT/wavplay 9 9 9 9 enabled
exit 1
fi
if [ "$1" = "D999" ]; then
 rm /tmp/enable9999
$SCRIPT/wavplay 9 9 9 9 disabled
exit 1
fi
if [ "$1" = "9999" ]; then
 if [ -f /tmp/enable9999 ]; then
  $SCRIPT/connect_to_reflector ref9999
else
$SCRIPT/wavplay lockout_local
fi
exit 1
fi
Incidentally, BASH's "case" statement can make "custom_decode" MUCH neater, I wonder why IRLP doesn't use it? Allows you to combine a big list of "if [ $1 = blah ]; then blah fi" into...
case "$1" in
A999) touch /tmp/enable9999; $SCRIPT/wavplay 9 9 9 9 enabled; exit 1 ;;
D999) rm /tmp/enable9999; $SCRIPT/wavplay 9 9 9 9 disabled; exit 1 ;;
9999) if [ -f /tmp/enable9999 ]; then $SCRIPT/connect_to_reflector ref9999
else $SCRIPT/wavplay reflector disabled
fi ; exit 1 ;;
esac
Again, UNTESTED, but could probably slowly debug over email if it doesn't work as expected.
Nick VA3NNW
--
"Nosey" Nick Waterman, VA3NNW/G7RZQ, K2 #5209.
use Std::Disclaimer;sig@...
A bug in the hand is better than one as yet undetected.


Steve Jones
 

Nick,

  Good point about using ‘case’ instead of a bucket load of  if-then-fi statements.  I have been using the case statement in my custom_decode since building my node on CentOS-4…  It runs quicker and less CPU intensive and allows reg-exp selections, like

 

000|9|9[0-5])  $CUSTOM/tx_info $1       # Play node information recordings

           exit 1 ;;

 

which responds to 000,9,and 90-95 , all in the same line.  I too wondered why it was not used from the start..

 

Steve  VK2YLD

   Node 6732

 

From: IRLP@irlp.groups.io [mailto:IRLP@irlp.groups.io] On Behalf Of Nosey Nick VA3NNW
Sent: Wednesday, 10 June 2020 11:26 PM
To: IRLP@irlp.groups.io
Subject: Re: [IRLP] Custom DTMF Dial Path

 

VK4DAK wrote:

I am hoping to create a custom script so that when a discrete DTMF code is punched - it allow the connection to 9999
Any ideas? I have tried creating a script that when the discrete code is entered, it will either $SCRIPT/decode 9999 -- but this then ends up in the "exit 1" pile (nothing happens)
Thoughts, comments, suggestions?

Well... You could just give it a DIFFERENT NUMBER, EG:

if [ "${1}" = "9999" ]; then exit 1 ; fi # having done nothing
if [ "${1}" = "ABC123" ]; then $SCRIPT/connect_to_reflector ref9999 ; fi

If, on the other hand, you want to keep it as an "enable/disable" idea, maybe use the presence of a file to say "9999 is allowed now" or alternatively "9999 is blocked now"? You can create a file with "touch FILENAME", remove it with "rm FILENAME", check for it like "if [ -f FILENAME ] then ... fi" or considering you already have the "if" statement, you can combine:

CONDITION1 -a CONDITION2 means "CONDITION1 AND CONDITION2"
CONDITION1 -o CONDITION2 means "CONDITION1 OR CONDITION2"

So my UNTESTED example might be...

if [ "$1" = "A999" ]; then touch /tmp/enable9999; exit 1; fi
if [ "$1" = "D999" ]; then rm /tmp/enable9999; exit 1; fi # disable it again
if [ "$1" = "9999" -a -f /tmp/enable9999 ]; then $SCRIPT/connect_to_reflector ref9999; exit 1; fi

Or it might be nice to play some WAVs so it can provide some feedback, and it looks like you don't even need to record any custom ones - there are some provided ones you can use! ... so ALSO UNTESTED...

if [ "$1" = "A999" ]; then
  touch /tmp/enable9999
  $SCRIPT/wavplay 9 9 9 9 enabled
  exit 1
fi
if [ "$1" = "D999" ]; then
  rm /tmp/enable9999
  $SCRIPT/wavplay 9 9 9 9 disabled
  exit 1
fi
if [ "$1" = "9999" ]; then
 if [ -f /tmp/enable9999 ]; then
   $SCRIPT/connect_to_reflector ref9999
  else
    $SCRIPT/wavplay lockout_local
  fi
  exit 1
fi

Incidentally, BASH's "case" statement can make "custom_decode" MUCH neater, I wonder why IRLP doesn't use it? Allows you to combine a big list of "if [ $1 = blah ]; then blah fi" into...

case "$1" in
  A999) touch   /tmp/enable9999; $SCRIPT/wavplay 9 9 9 9 enabled;  exit 1 ;;
  D999) rm      /tmp/enable9999; $SCRIPT/wavplay 9 9 9 9 disabled; exit 1 ;;
  9999) if [ -f /tmp/enable9999 ]; then $SCRIPT/connect_to_reflector ref9999
                                   else $SCRIPT/wavplay reflector disabled
        fi ; exit 1 ;;
esac

Again, UNTESTED, but could probably slowly debug over email if it doesn't work as expected.

Nick VA3NNW

-- 
"Nosey" Nick Waterman, VA3NNW/G7RZQ, K2 #5209.
use Std::Disclaimer;    sig@...
A bug in the hand is better than one as yet undetected.


David Cameron - IRLP
 

Case is good, but it is also easier to make syntax errors in (in my opinion). If/then is also easier to understand for someone not familiar with logic programming.

Also, when talking about processor load and if/then versus case statements - keep in mind this is maybe run at most a few times an hour, and the processors in any of these nodes is capable of running through tens of thousands of if/then lines using bash variables per second....

We are out of the ARPAnet days where your paid your provider by how many processor cycles you use :)

David Cameron
VE7LTD

On 2020-06-10 4:19 p.m., Steve Jones wrote:
Nick,
  Good point about using ‘case’ instead of a bucket load of  if-then-fi statements.  I have been using the case statement in my custom_decode since building my node on CentOS-4…  It runs quicker and less CPU intensive and allows reg-exp selections, like
000|9|9[0-5])  $CUSTOM/tx_info $1       # Play node information recordings
           exit 1 ;;
which responds to 000,9,and 90-95 , all in the same line.  I too wondered why it was not used from the start..
Steve  VK2YLD
   Node 6732
*From:*IRLP@irlp.groups.io [mailto:IRLP@irlp.groups.io] *On Behalf Of *Nosey Nick VA3NNW
*Sent:* Wednesday, 10 June 2020 11:26 PM
*To:* IRLP@irlp.groups.io
*Subject:* Re: [IRLP] Custom DTMF Dial Path
VK4DAK wrote:
I am hoping to create a custom script so that when a discrete DTMF
code is punched - it allow the connection to 9999
Any ideas? I have tried creating a script that when the discrete
code is entered, it will either $SCRIPT/decode 9999 -- but this then
ends up in the "exit 1" pile (nothing happens)
Thoughts, comments, suggestions?
Well... You could just give it a DIFFERENT NUMBER, EG:
if [ "${1}" = "9999" ]; then exit 1 ; fi # having done nothing
if [ "${1}" = "ABC123" ]; then $SCRIPT/connect_to_reflector ref9999 ; fi
If, on the other hand, you want to keep it as an "enable/disable" idea, maybe use the presence of a file to say "9999 is allowed now" or alternatively "9999 is blocked now"? You can create a file with "touch FILENAME", remove it with "rm FILENAME", check for it like "if [ -f FILENAME ] then ... fi" or considering you already have the "if" statement, you can combine:
CONDITION1 -a CONDITION2 means "CONDITION1 AND CONDITION2"
CONDITION1 -o CONDITION2 means "CONDITION1 OR CONDITION2"
So my UNTESTED example might be...
if [ "$1" = "A999" ]; then touch /tmp/enable9999; exit 1; fi
if [ "$1" = "D999" ]; then rm /tmp/enable9999; exit 1; fi # disable it again
if [ "$1" = "9999" -a -f /tmp/enable9999 ]; then $SCRIPT/connect_to_reflector ref9999; exit 1; fi
Or it might be nice to play some WAVs so it can provide some feedback, and it looks like you don't even need to record any custom ones - there are some provided ones you can use! ... so ALSO UNTESTED...
if [ "$1" = "A999" ]; then
 touch /tmp/enable9999
  $SCRIPT/wavplay 9 9 9 9 enabled
  exit 1
fi
if [ "$1" = "D999" ]; then
 rm /tmp/enable9999
  $SCRIPT/wavplay 9 9 9 9 disabled
  exit 1
fi
if [ "$1" = "9999" ]; then
 if [ -f /tmp/enable9999 ]; then
  $SCRIPT/connect_to_reflector ref9999
  else
    $SCRIPT/wavplay lockout_local
  fi
  exit 1
fi
Incidentally, BASH's "case" statement can make "custom_decode" MUCH neater, I wonder why IRLP doesn't use it? Allows you to combine a big list of "if [ $1 = blah ]; then blah fi" into...
case "$1" in
  A999) touch   /tmp/enable9999; $SCRIPT/wavplay 9 9 9 9 enabled;  exit 1 ;;
  D999) rm      /tmp/enable9999; $SCRIPT/wavplay 9 9 9 9 disabled; exit 1 ;;
  9999) if [ -f /tmp/enable9999 ]; then $SCRIPT/connect_to_reflector ref9999
                                   else $SCRIPT/wavplay reflector disabled
        fi ; exit 1 ;;
esac
Again, UNTESTED, but could probably slowly debug over email if it doesn't work as expected.
Nick VA3NNW
--
"Nosey" Nick Waterman, VA3NNW/G7RZQ, K2 #5209.
use Std::Disclaimer;sig@... <mailto:sig@...>
A bug in the hand is better than one as yet undetected.


VK4DAK
 

Thanks all for your input. I have learnt a bit from reading this - Including using parts of existing scripts to solve the problem.

Looks like I have managed to resolve my problems - thanks to all for the input!