Posted: July 21st, 2010 | Author: admin | Filed under: Asterisk VoIP, Linux, Tech | Tags: appointment, appointment reminder calls, asteris, call blasting, office reminder, ontime1405, ontime1405.com, voip, wake up call | 2 Comments »
A while back I had a meeting with a friend in Orlando, FL. He came up with the idea to provide an appointment reminder service to companies that would benefit from such a service. Doctor’s offices, Dentists, Mechanics, Repairmen, etc. I drew up the logistics of the program and began working on it in the fall of 2008. Since then we have had customers use the software to easily call their customers and remind them of appointments and also use the software for call blasting. Call blasting is a feature to call an unlimited amount of numbers and playback a message. Since I have experience in the Asterisk VoIP platform I programmed the system to allow for options and the customer to enter in input with their keypad.
www.ontime1405.com

The purpose of this article is to detail the logistics and share it with the Asterisk community.
Basic overview:
There are a few different ways to originate calls with Asterisk.
-From the Asterisk CLI directly with the “originate” command
-From the AMI (Asterisk Manager Interface)
-From .call files placed in /var/spool/asterisk/outgoing
I went with .call files because of a few reasons:
-I can generate all of the call files ahead of time because they are read based on the timestamp of the file (less load)
-It is straightforward and easy to follow, and also leaves behind the .call file that is archived after the call is finished
-Asterisk will parse and execute based on timestamp, so to burst 100 calls would require much less overhead than through AMI/CLI
There are some negative effects to the .call files too:
-Changes made need to remove and add another .call file (If the customer changes their appointment time after the file was generated)
-The lowest interval to generate calls is every minute, so we can burst to 400 calls/minute (also more difficult to throttle calls)
Now you know how the calls are originating on the system, let’s move on to the database and interface.
I hired someone to program the interface in AJAX and PHP. That way it is secure and saved a lot of time if I were to attempt it myself. The interface is very clean and easy to use for customers. They also have the ability to import 1,000 records at a time via CSV files. Feel free to demo the interface via the link on ontime1405.com for “Demo the Interface”.
The interface stores the call data in MySQL which is then scanned hourly to process and create all of the .call files according to their timestamp. We only care about the calls that will be made by the system in the next hour, so those are the only .call files that are generated. The script is a PHP script that connects to the database with the query of calls to be made, strips them down, then does a loop to create the .call file, set the timestamp based on the variable, then move the .call file to /var/spool/asterisk/outgoing.
The .call files include 1 custom variable that is comma-delimited so we can parse out the appointment time, AM/PM, and any other custom variables.
The other important lines in the .call file point to the context in the Asterisk dialplan that the customer’s announcement and options are defined.
Now you may ask yourself, It will be a pain to manually add customer’s options and dialplan for every sign up, right? It was at first, but I created several automated scripts to generate the dialplan for the customer and “dialplan reload” when complete.
The rest of the accounting/etc is accomplished via bash cleanup scripts that write to the database and provide reporting/etc.
The same system can be used for call-blasting to a large group of number for a survey, snow day announcement, marketing message.
Please let me know if you have any questions or advice/constructive-criticism for me regarding the program.
And feel free to try out the demo interface and hear a reminder call!
Cheers,
Gregg
Posted: January 4th, 2010 | Author: admin | Filed under: Asterisk VoIP, Linux, Mac, Tech | Tags: 2010, donation, new look, no more ads, resolutions | No Comments »
I decided to start off 2010 with a few changes:
1. Choose a new theme for the site…done
2. Remove Ads…done(With the exception of the sweet animation my buddy did)
3. I’m studying AGI scripting with Asterisk and want to share my findings along the way. I hope to have a lot of posts soon for you guys.
4. I hope to have bi-monthly updates to the site at a minimum. Topics include but are not limited to: Asterisk, AGI, PHP, Linux, and anything else I find interesting. 2010 is going to be the year of knowledge.
5. I put a link on the right column, and I’m only going to say it once. If you want to buy me a beer, or contribute to my escapades with a small donation. Then I will smile knowing that someone appreciated the info enough to help me out.
Posted: April 27th, 2009 | Author: admin | Filed under: Asterisk VoIP, Linux, Tech, Uncategorized | Tags: asterisk backup, Asterisk VoIP, at backup asterisk, atd, automated asterisk backup, automated backup, automatic ftp connection, backup asterisk, backup asterisk files, backup asterisk script, backup etc/asterisk, bash, centos, connect ftp bash, cron, cron backup, cron backup asterisk, ftp bash, gz, gz asterisk, interactive backup, Linux, safe1405, tar, tar asterisk, voip | 6 Comments »
Summary:
Safe1405 is a bash script that will backup the popular Asterisk directories and place them in a tar.gz file. The script can be used in 1 of 2 modes.
The first mode is interactive, with a menu to choose:
- Backup Everything (/etc/asterisk, Voicemail, Recordings, Sounds)
- Just VM
- Just Recordings
- Just Sounds
After the file is created, it will prompt to upload to a remote FTP server.
The second mode is silent, and is best suited for automated execution via cron or at.
Just enable the UNATTENDED and PUT_FTP variables by setting them to “1″. You can directly edit the paths to each directory if yours are non-standard.
The script can be directly downloaded here: Safe1405 Download Link
Code:
#!/bin/bash
# Safe1405
# Author: Gregg Hansen - www.thiscoolsite.com
# Safely tar and gzip Asterisk files
# Version 1.0 20090427
#-Backs up all important Asterisk files - Tar/Gz
#-Choose the file name, or Date by default
#-GUI-like. Able to be silent for cron, or interactive
#EDIT the below ABSOLUTE paths to match your directory structure:
VAR_LIB="/var/lib/asterisk"
ETC_AST="/etc/asterisk"
VM="/var/spool/asterisk/voicemail"
MON="/var/spool/asterisk/monitor"
#Date Var
FILEDATE="$(date +%Y%m%d)"
#Your ServerName
#Filename is FILEDATE-SERVERNAME.tar.gz
SERVERNAME="Chicago-Ast01"
#Enable unattended mode/Remote FTP put (useful for Cron):
# Backup of /etc/asterisk ONLY (default)
# 1 = On, 0 = Off
UNATTENDED="0"
PUT_FTP="0"
#FTP Credentials
FTP_IP="127.0.0.1"
FTP_USER="admin"
FTP_PASS="secret"
###--START CODE---###
### Interactive Mode Functions ###
prompt()
{
cat <<EOF
Safe1405 Backup
1) Everything
2) /etc/asterisk
3) Voicemail
4) Recordings
5) Sounds
Q) Quit
EOF
echo -n "Prompt> "
read INPUT
case $INPUT in
1) everything;;
2) etc-ast;;
3) vm;;
4) recordings;;
5) sounds;;
q) exit;;
Q) exit;;
esac
}
everything()
{
FILENAME="$FILEDATE-$SERVERNAME-FULL.tar.gz"
tar cfvz $FILENAME $ETC_AST $VM $MON $VAR_LIB
ftpprompt
}
etc-ast()
{
FILENAME="$FILEDATE-$SERVERNAME-ETC_AST.tar.gz"
tar cfvz $FILENAME $ETC_AST
ftpprompt
}
vm()
{
FILENAME="$FILEDATE-$SERVERNAME-VM.tar.gz"
tar cfvz $FILENAME $VM
ftpprompt
}
recordings()
{
FILENAME="$FILEDATE-$SERVERNAME-REC.tar.gz"
tar cfvz $FILENAME $MON
ftpprompt
}
sounds()
{
FILENAME="$FILEDATE-$SERVERNAME-SOUNDS.tar.gz"
tar cfvz $FILENAME $VAR_LIB
ftpprompt
}
ftpprompt()
{
echo -en "Upload $FILENAME to FTP? (y or n) "
read INPUT
if [ "$INPUT" == "y" ]; then
quietftp
fi
}
### Unattended Mode Functions ###
silent()
{
tar cfvz $FILEDATE-$SERVERNAME-ETC-AST.tar.gz $ETC_AST ##Uncomment##$VM #$MON #$VAR_LIB
FILENAME="$FILEDATE-$SERVERNAME-ETC-AST.tar.gz"
}
quietftp()
{
ftp -ivn <<EOF
open $FTP_IP
user $FTP_USER $FTP_PASS
binary
put $FILENAME
bye
EOF
}
#### Start Program Flow ###
clear
#Unattended Function Call(s)
if [ "$UNATTENDED" == "1" ]; then
silent
if [ "$PUT_FTP" == "1" ]; then
quietftp
exit
fi
exit
fi
#Interactive Function Calls
prompt
exit
###–END CODE—###
Leave a comment if you have questions/suggestions or would like help setting up the script.
-Gregg
Posted: February 4th, 2009 | Author: admin | Filed under: Asterisk VoIP, Linux, Tech | Tags: Asterisk VoIP, balance trunks, distribute calls, freepbx, freepbx round robin, fxo, Linux, load balance, pbx in a flash, round robin, zap, zaptel | 2 Comments »
I’ve seen several posts around the net from users that want to distribute the calls across multiple trunks with FreePBX. The main reason being that they have a deal with a provider, and each line has 4,000 minutes for free, etc. After looking around at the different methods to accomplish this, it become very clear what must happen.
If your trunks are FXO ports/Analog then you are in luck.
Go to the FreePBX interface, click on Trunks.
-Add a trunk
-Put ‘r0′ for the Zap identifier (that’s R zero)
-Submit Changes
-Set the round robin Zap as your outbound route and enjoy!
Simple and clean, enjoy.
Posted: November 13th, 2008 | Author: admin | Filed under: Asterisk VoIP, Linux, Mac, Tech | Tags: blog, blog japan, gaijin, gregg in japan, gregg in japan shutterfly, gregginjapan, japan, japan blog, japan visit, japanese food, kyoto, namba, osaka, osaka castle, shopping osaka, shutterfly, the gaijins point of view, tourism, tourist, umeda, umeda sky building, visitors blog, weekly mansion, weekly mansion osaka, yodobashicamera | 1 Comment »
I’ve been wanting to go to Japan for a while now, its just that I haven’t gotten any of my friends to really commit to going. So about 6 months ago, I decided that I was going to go by myself. After thinking about it, it really is the best way to visit Japan for the first time. I can allow myself to be totally immersed without having someone from my country bring me back to ‘feeling American’ every 5 minutes. I am really glad that I have this opportunity to visit this great country. I’ve been here 5 days now, and I almost feel like I live here.
To share my experiences, I’ve documented everything possible (mostly food) so future prospective-visitors can learn from my time here.
Check http://gregginjapan.shutterfly.com for the daily journal, pictures, and video updates.
Posted: October 24th, 2008 | Author: admin | Filed under: Asterisk VoIP, Linux, Tech | Tags: Asterisk VoIP, automated, call center, centos, dialer, easy, gnudialer, kickstart, Linux, open-source, voip | 11 Comments »
I’ve had the task of installing GNUDialer for testing and call-centers tend want dialers all the time. Many dialer platforms are extremely bloated and their support fees are enormous! I like GNUDialer because they decided to make an open-source dialer platform that is minimal and functional.
Disclaimer: I am not responsible for any loss of data, server explosions, recessions, depressions, or anything negative that may arise from you running the dialer kickstart script. It was meant with good intentions, but I am not going to be liable for any of your actions.
Glad that is out of the way.
You can read through each script that runs and know exactly how the install was done. Make sure you watch the console throughout the install to catch any possible errors that may be thrown out (2)stderr.
Instructions:
–Prerequisites (Have your server connected to a DHCP-enabled network with internet access)
1. Download and Burn CentOS 4.5 or 4.6 ISO CD1 Here or Here.
2. Start the server with the CD and set the BIOS to boot from CD first
3. You will see this screen if it booted from the CD properly. At the prompt type ‘linux ks=http://www.thiscoolsite.com/scripts/ks_dialer/ks.cfg’ just like it did in the screenshot. Then hit enter.

4. If you typed the command incorrectly you will see this screen asking you to ‘test your media’. If you see this screen reboot your server and try typing the command again, but correctly.

5. After a minute you should see a screen that looks like this. That means you typed the ‘linux ks’ command correctly and it is installing in txt mode. It will take at least 10 minutes, then it will look like it is paused at the end of the install. Don’t worry, it is using yum to install all the latest packages you need to run Asterisk and Gnudialer. The install will reboot itselft, so don’t mess with it.

Upon first boot, the main script runs that will be doing the MySQL databse config, Asterisk install, astcrm, and GNUDialer installs. The script will exit and you will be prompted with a login screen. The default user is ‘root’ and password is ‘star1405′.
Change your root password immediately with the ‘passwd’ command.
Once you are logged in you can check to see that Asterisk is running by typing Asterisk -r and getting in to the console. You can then start the gnudialer daemon for the first time by typing ‘gnudialer –safe’. You should be up and running now! Good Job.
Navigate to http://InternalIPAddress/gnudialer to login to the management interface. Password is ‘gnudialer’.
Make sure you read all of the readme and install files in /usr/src/gnudialer so you can actually setup working campaigns and use the settings properly. Also, a few people are always available for live help in IRC.freenode.net’s #gnudialer channel. Be aware, ignorance is not allowed. If you didn’t attempt to troubleshoot the issue yourself or read everything available to you on the internet, you will be chastised and humiliated in front of your peers. <G>
As always, leave a comment with your email and I will try to help in any way that I can.
Happy automated-dialing trails…to you!
-Gregg