[arm-allstar] sayip.sh

(KP4TR)Ramon Gonzalez kp4tr.ramon at gmail.com
Mon Jul 28 22:42:13 EST 2014


A cleaner way using Doug's awk entry is this one liner:

./speaktext.sh "IP $(ifconfig eth0 | awk '/inet / {print $2}')" XXXXX

where XXXXX is your local node number......



On 7/28/2014 11:07 PM, Doug Crompton wrote:
> Here is a little script that says the IP address of your BBB using 
> Ramon's script. It is just one example of how to use it.
>
> File name -  sayip.sh     - be sure to make executable - chmod 750 
> sayip.sh
>
> Usage -  sayip.sh node#
>
> *#!/bin/bash
>
> ip=`ifconfig eth0 | awk '/inet / {print $2}'`
>
> cat /var/lib/asterisk/sounds/letters/i.gsm 
> /var/lib/asterisk/sounds/letters/p.gsm 
> /var/lib/asterisk/sounds/address.gsm > /tmp/ip.gsm
>
> asterisk -rx "rpt localplay $1 /tmp/ip"
>
> /etc/asterisk/local/speaktext.sh $ip $1
>
> rm /tmp/ip.gsm
> *
> and here is Ramon's script with localplay mod....
>
> File name - speaktext.sh
>
> #!/bin/bash
>
> #
> # Script to speak letters and numbers from asterisk sounds
> # over a radio node using simpleusb
> # by Ramon Gonzalez KP4TR 2014
> #
>
> #set -xv
>
> ASTERISKSND=/var/lib/asterisk/sounds
> LOCALSND=/tmp/randommsg
>
>
> function speak {
>         SPEAKTEXT=$(echo "$1" | tr '[:upper:]' '[:lower:]')
>         let SPEAKLEN=$(echo "$SPEAKTEXT" | /usr/bin/wc -m)-1
>         COUNTER=0
>         rm -f ${LOCALSND}.gsm
>         touch ${LOCALSND}.gsm
>         while [  $COUNTER -lt $SPEAKLEN ]; do
>                 let COUNTER=COUNTER+1
>                 CH=$(echo "$SPEAKTEXT"|cut -c${COUNTER})
>                 if [[ $CH =~ ^[A-Za-z_]+$ ]]; then
>                         cat ${ASTERISKSND}/letters/${CH}.gsm >> 
> ${LOCALSND}.gsm
>                 fi
>                 if [[ ${CH} =~ ^-?[0-9]+$ ]]; then
>                         cat /var/lib/asterisk/sounds/digits/${CH}.gsm 
> >> ${LOCALSND}.gsm
>                 fi
>
>                 case $CH in
>                 .) cat ${ASTERISKSND}/letters/dot.gsm >> ${LOCALSND}.gsm;;
>                 -) cat ${ASTERISKSND}/letters/dash.gsm >> 
> ${LOCALSND}.gsm;;
>                 =) cat ${ASTERISKSND}/letters/equals.gsm >> 
> ${LOCALSND}.gsm;;
>                 /) cat ${ASTERISKSND}/letters/slash.gsm >> 
> ${LOCALSND}.gsm;;
>                 !) cat ${ASTERISKSND}/letters/exclaimation-point.gsm 
> >> ${LOCALSND}.gsm;;
>                 @) cat ${ASTERISKSND}letters/at.gsm >> ${LOCALSND}.gsm;;
>                 $) cat ${ASTERISKSND}/letters/dollar.gsm >> 
> ${LOCALSND}.gsm;;
>                 *) ;;
>                 esac
>         done
>
> *asterisk -rx "rpt localplay $2 ${LOCALSND}"*
>
> }
>
> if [ "$1" == "" -o "$2" == "" ];then
>         echo "Usage: speaktext.sh \"abc123\" node#"
>         exit
> fi
>
> speak "$1" $2
>
>
>
> *73 Doug
> WA3DSP
> http://www.crompton.com/hamradio*
>
>
> _______________________________________________
>
> arm-allstar mailing list
> arm-allstar at hamvoip.org
> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
>
> Visit the BBB web page - http://www.crompton.com/hamradio/BeagleBoneBlackAllstar/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hamvoip.org/pipermail/arm-allstar/attachments/20140728/579e236b/attachment.html>


More information about the arm-allstar mailing list