#!/bin/bash # Asterisk System Recording Tester # Author: Steven Mirabito (smirabito@csh.rit.edu) # Usage usage () { echo "Calls the desired extension and plays an Asterisk system recording." echo "Usage: record-test -e -r [-e language]" exit } # Process arguments while [[ $# > 1 ]]; do key="$1" case $key in -e|--extension) EXTENSION="$2" shift # past argument ;; -l|--language) RECORD_LANG="$2" shift # past argument ;; -r|--recording) RECORDING="$2" shift # past argument ;; *) # unknown option ;; esac shift # past argument or value done if [ -z ${EXTENSION+x} ]; then usage fi if [ -z ${RECORD_LANG+x} ]; then RECORD_LANG="en" fi if [ -z ${RECORDING+x} ]; then usage fi # Place the call echo -e "🛠 \e[1m\e[96mConfiguring call with recording \"${RECORD_LANG}/${RECORDING}\"..." echo "Channel: Local/${EXTENSION}@from-internal/n" > /var/spool/asterisk/tmp/recording-test.call echo "Application: Playback" >> /var/spool/asterisk/tmp/recording-test.call echo "Data: ${RECORD_LANG}/${RECORDING}" >> /var/spool/asterisk/tmp/recording-test.call echo "📲 Placing call to extension ${EXTENSION}..." mv /var/spool/asterisk/tmp/recording-test.call /var/spool/asterisk/outgoing/ echo -e "✅ Done!\e[0m"