Topics

Problem with custom code - connect status


Kevin Magloughlin
 

Good evening all,

Here's the problem: Code 88 calls the script "check_irlp"

The reason this is 88 rather than *A is because many have 4X3 keypads instead of the 4X4 keypads, hence no A, B C D.

The problem is this command only plays the first three digits of the connected node or reflector.

I modified the script with what should have worked but does not.  I am sure this is something simple to fix and am overlooking it.

Here's the script:

if [ -f "$LOCAL"/active ]; then
  CONNECTED=`cat "$LOCAL"/active`
  echo Your node is already connected to $CONNECTED
  killall ispeaker >&/dev/null 2>&1
  killall ispeaker_PCI >&/dev/null 2>&1
  killall sfswrapper >&/dev/null 2>&1
  if [ ! -f "$AUDIO"/"$REMOTE".wav ] ; then
      eval `echo $CONNECTED | awk '//{print "NUMBER="substr($CONNECTED,4,3)}'`
      eval `echo $NUMBER | awk '//{
                         print "NUM1="substr($NUMBER,1,1);
                         print "NUM2="substr($NUMBER,2,1);
                         print "NUM3="substr($NUMBER,3,1);
                         print "NUM4="substr($NUMBER,4,1)}'`
      IDFILE="connected nodenum $NUM1 $NUM2 $NUM3 $NUM4"
      "$SCRIPT"/wavplay $IDFILE
  else
      "$SCRIPT"/wavplay connected "$CONNECTED"
  fi
  "$SCRIPT"/sfswrapper
  exit 1
else
  killall ispeaker >&/dev/null 2>&1
  killall ispeaker_PCI >&/dev/null 2>&1
  killall sfswrapper >&/dev/null 2>&1
  echo Link off.
  "$SCRIPT"/wavplay linkoff
  "$SCRIPT"/sfswrapper
exit 1
  fi
 
Okay, what am I missing?

Kevin KA0JQO 
Node 4442, 4288



 

If you run bash -x ./scrip_name

What error do you get?


On Mon, Jul 20, 2020 at 9:21 PM <krmjqo@...> wrote:
Good evening all,

Here's the problem: Code 88 calls the script "check_irlp"

The reason this is 88 rather than *A is because many have 4X3 keypads instead of the 4X4 keypads, hence no A, B C D.

The problem is this command only plays the first three digits of the connected node or reflector.

I modified the script with what should have worked but does not.  I am sure this is something simple to fix and am overlooking it.

Here's the script:

if [ -f "$LOCAL"/active ]; then
  CONNECTED=`cat "$LOCAL"/active`
  echo Your node is already connected to $CONNECTED
  killall ispeaker >&/dev/null 2>&1
  killall ispeaker_PCI >&/dev/null 2>&1
  killall sfswrapper >&/dev/null 2>&1
  if [ ! -f "$AUDIO"/"$REMOTE".wav ] ; then
      eval `echo $CONNECTED | awk '//{print "NUMBER="substr($CONNECTED,4,3)}'`
      eval `echo $NUMBER | awk '//{
                         print "NUM1="substr($NUMBER,1,1);
                         print "NUM2="substr($NUMBER,2,1);
                         print "NUM3="substr($NUMBER,3,1);
                         print "NUM4="substr($NUMBER,4,1)}'`
      IDFILE="connected nodenum $NUM1 $NUM2 $NUM3 $NUM4"
      "$SCRIPT"/wavplay $IDFILE
  else
      "$SCRIPT"/wavplay connected "$CONNECTED"
  fi
  "$SCRIPT"/sfswrapper
  exit 1
else
  killall ispeaker >&/dev/null 2>&1
  killall ispeaker_PCI >&/dev/null 2>&1
  killall sfswrapper >&/dev/null 2>&1
  echo Link off.
  "$SCRIPT"/wavplay linkoff
  "$SCRIPT"/sfswrapper
exit 1
  fi
 
Okay, what am I missing?

Kevin KA0JQO 
Node 4442, 4288




--
** Dave Parks **
1-734-219-2010
IRLP Node: 8139 - AllStar: 44108
Correspondent Amateur Radio Newsline


Kevin Magloughlin
 

Here is the output from the test.

root@stn4442:/home/irlp/custom# bash -x ./check_irlp
++ /usr/bin/whoami
+ '[' root '!=' repeater ']'
+ echo This program must be run as user 'REPEATER!'
This program must be run as user REPEATER!
+ exit 1
root@stn4442:/home/irlp/custom# su repeater
repeater@stn4442:~/custom$ ./check_irlp
Your node is already connected to ref9204
repeater@stn4442:~/custom$

What's next?


 

If you don't get an error and the3 script plays through what is $NUM4 showing?

On Mon, Jul 20, 2020 at 9:31 PM Dave Parks - WB8ODF via groups.io <wb8odf=gmail.com@groups.io> wrote:
If you run bash -x ./scrip_name

What error do you get?

On Mon, Jul 20, 2020 at 9:21 PM <krmjqo@...> wrote:
Good evening all,

Here's the problem: Code 88 calls the script "check_irlp"

The reason this is 88 rather than *A is because many have 4X3 keypads instead of the 4X4 keypads, hence no A, B C D.

The problem is this command only plays the first three digits of the connected node or reflector.

I modified the script with what should have worked but does not.  I am sure this is something simple to fix and am overlooking it.

Here's the script:

if [ -f "$LOCAL"/active ]; then
  CONNECTED=`cat "$LOCAL"/active`
  echo Your node is already connected to $CONNECTED
  killall ispeaker >&/dev/null 2>&1
  killall ispeaker_PCI >&/dev/null 2>&1
  killall sfswrapper >&/dev/null 2>&1
  if [ ! -f "$AUDIO"/"$REMOTE".wav ] ; then
      eval `echo $CONNECTED | awk '//{print "NUMBER="substr($CONNECTED,4,3)}'`
      eval `echo $NUMBER | awk '//{
                         print "NUM1="substr($NUMBER,1,1);
                         print "NUM2="substr($NUMBER,2,1);
                         print "NUM3="substr($NUMBER,3,1);
                         print "NUM4="substr($NUMBER,4,1)}'`
      IDFILE="connected nodenum $NUM1 $NUM2 $NUM3 $NUM4"
      "$SCRIPT"/wavplay $IDFILE
  else
      "$SCRIPT"/wavplay connected "$CONNECTED"
  fi
  "$SCRIPT"/sfswrapper
  exit 1
else
  killall ispeaker >&/dev/null 2>&1
  killall ispeaker_PCI >&/dev/null 2>&1
  killall sfswrapper >&/dev/null 2>&1
  echo Link off.
  "$SCRIPT"/wavplay linkoff
  "$SCRIPT"/sfswrapper
exit 1
  fi
 
Okay, what am I missing?

Kevin KA0JQO 
Node 4442, 4288




--
** Dave Parks **
1-734-219-2010
IRLP Node: 8139 - AllStar: 44108
Correspondent Amateur Radio Newsline



--
** Dave Parks **
1-734-219-2010
IRLP Node: 8139 - AllStar: 44108
Correspondent Amateur Radio Newsline


Kevin Magloughlin
 

Had a good phone call with Dave Parks and together we found the problem.  

Here's the fix...

Original line:
  eval `echo $CONNECTED | awk '//{print "NUMBER="substr($CONNECTED,4,3)}'`

Revised line: 
  eval `echo $CONNECTED | awk '//{print "NUMBER="substr($CONNECTED,4,4)}'`

Change that 3 to a 4 and now it appears to be work.

Thank you Dave.  Big help.

Kevin KA0JQO