Skip to content

Instantly share code, notes, and snippets.

@crawc
Created February 1, 2022 13:28
Show Gist options
  • Save crawc/e2f97f69820ef2f5a7ff1e2d7e2c0242 to your computer and use it in GitHub Desktop.
Save crawc/e2f97f69820ef2f5a7ff1e2d7e2c0242 to your computer and use it in GitHub Desktop.
#!/bin/bash
# [email protected]
# https://highsecurity.blogspot.com/2013/09/asteriskfreepbx-post-voicemail-trigger.html
# invokes sending to webserver socket when there's a change in voicemail events for user
# v.1.0
# prequalify if this is a reload or not, if reload, we don't do anything
server=10.10.10.1:6050
fullstring="$1 $2 $3 $4 $5"
isreload=`echo "$fullstring" | grep -c "@"`
#
if [[ "$isreload" -gt "0" ]]; then
exit 1
else
context="$1"
ext="$2"
newvm="$3"
oldvm="$4"
#
myurl="vmnotify.php?ext=$ext&new=$newvm&old=$oldvm"
sendurlnow=`/usr/bin/curl --silent --connect-timeout 15 http://$server/$myurl`
if [[ "$sendurlnow" == "" ]]; then
echo "ERR"
exit 1
else
echo "SUCECSS"
exit 0
fi
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment