Play / Rotate ID Scripts ...

Discussion on the ACID distribution package
K5TRY
Posts: 36
Joined: Fri Mar 09, 2012 8:25 am
Location: Springdale, AR

Play / Rotate ID Scripts ...

Postby K5TRY » Sun Oct 07, 2012 1:35 pm

Asterisk Play / Rotate ID Scripts


Here is how to Play and Rotate your AllStar ID's you created from the Text2wav - Alternate Voices thread ...


First thing is backup NODE.
( backup.sh )

---ID-FILES----------

The .ulaw ID files need to be created and named. I used one main message, and created 7 .ulaw id files for said message; each with a different voice -> id1.ulaw - id7.ulaw.

Create a folder to place .ulaw files.

mkdir /etc/asterisk/id

;
; /etc/asterisk/id
;

id1.ulaw
id2.ulaw
id3.ulaw
id4.ulaw
id5.ulaw
id6.ulaw
id7.ulaw

---CUSTOM-SCRIPT-----------idscript---

#!/bin/bash
#
# Script to play Allstar Voice ID, by K0KN 9/2012
#
# Usage - ID [node number]

IDSCRIPT=/home/xxxx/idrotate
ID=/etc/asterisk/id

if [ "$1" == "" ] ; then
echo "Missing Argument(s)"; exit
fi

# Play voice ID
asterisk -rx "rpt localplay $1 $ID"

# Rotate voice IDs
$IDSCRIPT

# done
exit 0
fi

---CUSTOM-SCRIPT----------idrotate---

#!/bin/bash
#
# Script to rotate Allstar Voice IDs, by K0KN 9/2012
#
# Usage - Place numbered ID files in the IDBASE folder in sequential
# order. For example, id1.ulaw, id2.ulaw, id3.ulaw and so forth
# up to the IDMAX number specified. If 8 files are used, for
# example, set IDMAX to 8.
#
# ID is the file specified in RPT.conf for your voice ID.
#
# This script can be called by cron or Asterisk scheduler to rotate
# once an hour, or as often as you like.

CUSTOM=/home/xxxx
IDBASE=/etc/asterisk/id/id # base file names
ID=/etc/asterisk/id.ulaw
IDMAX=7 # max ID number

# Create data file if not found
if [ ! -f $CUSTOM/id_no ] ; then
echo "1" >> $CUSTOM/id_no
else
echo
fi

# Read current ID number from file
IDTOUSE=$(sed -n ""$RAN_ID"p" "$CUSTOM"/id_no)

# Increment Variable
IDTOUSE=$(( $IDTOUSE + 1 ))

# Check for max number
if [ "$IDTOUSE" -gt "$IDMAX" ]
then
IDTOUSE=1
fi

echo "Next ID file will be" $IDTOUSE
echo $IDTOUSE > "$CUSTOM"/id_no
echo "Filename: $IDBASE$IDTOUSE.ulaw"

# Copy ID file
echo " cp -f $IDBASE$IDTOUSE.ulaw $ID"
cp -f $IDBASE$IDTOUSE.ulaw $ID

# done
exit 0
fi

---EDIT-/etc/asterisk/rpt.conf----------

[functions12345]
a0=cmd,/home/xxxx/idscript 12345

[schedule12345]
7 = 00 * * * * ; On the Hour, execute macro 7

[macro12345]
7 = *a0# ;IDSCRIPT

;
;COP commands
;

915=cop,15 ; Scheduler Enable
916=cop,16 ; Scheduler Disable


---CALL-the-SCRIPTS----------

-from user /home/xxxx-

/.idscript
-or-
/.idrotate

-from root-

/home/xxxx/idscript 12345
-or-
/home/xxxx/idrotate 12345

-from dtmf-
*a0
-or-
*57


THANK YOU kYLE!

http://www.qsl.net/k0kn/



73


Image



k5TRY
;(;)
http://qsl.net/k5try
;(;)

Return to “ACID Distribution”

Who is online

Users browsing this forum: No registered users and 1 guest