Initial Commit

master
Jay 2 years ago
commit c3757839e2

@ -0,0 +1,14 @@
# Asterisk Bash Scripts
A collection of shell scripts to use with Asterisk.
## About
This is a small collection of scripts I've written for vario
- userwizard.sh: Write a new user to pjsip.conf from ID, password, and context
- mohstream.sh: Contains both the icecast/mplayer and ogg123/sox varients.
- userwizard.sh needs to be run as root.
- mohstream.sh is called as custom application from musiconhold.conf

@ -0,0 +1,16 @@
#!/bin/bash
### USE THIS SECTION FOR THE PREFERRED METHOD WITH ICECAST/ICES ###
PIPE="/tmp/asterisk-pipe.$$"
mknod $PIPE p
mplayer -playlist http://host:port/mount.ogg.m3u -really-quiet -quiet -ao pcm:file=$PIPE -af resample=8000,pan=1:0.5:0.5,channels=1,format=mulaw 2>/dev/null | cat $PIPE 2>/dev/null
rm $PIPE
### THIS IS THE MORE INTENSIVE OGG123/SOX VERSION ###
#ogg123 -qZ -d pulse -o sink:moh1 -d au -f - -@ /etc/asterisk/list.m3u 2>/dev/null | sox -r 16000 -t au - -r 8000 -c 1 -t raw - 2>/dev/null
# I really can't stress how much this version isn't that great. It's CPU intensive and requires pulseaudio and a bunch of other junk.
# Seriously; this uses a stupid amount of processor to get the job done.

@ -0,0 +1,22 @@
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
pjsip() {
printf "\n\n[$ID]\ntype=endpoint\ncontext=$CONTEXT\ndisallow=all\nallow=ulaw\nallow=alaw\nallow=g722\nauth=$ID\naors=$ID\n\n"
printf "[$ID]\ntype=auth\nauth_type=userpass\npassword=$PASSWORD\nusername=$ID\n\n[$ID]\ntype=aor\nmax_contacts=3"
} >> /etc/asterisk/pjsip.conf
printf "Asterisk PJSIP User Wizard - Quick-N-Dirty (Like your mom!)\n\n"
printf "Enter User ID: "
read ID
printf "Enter default context: "
read CONTEXT
printf "Auth Password: "
read PASSWORD
pjsip;
Loading…
Cancel
Save