These are just a few quick notes of mine on how to host a PRI circuit from a Sangoma card in an Asterisk server to another Asterisk server or wherever for that matter.
This config here is for a Sangoma A102 with two ports and Asterisk will provide the clocking source. Channels 1-23 will be the B channels and channel 24 will be the D channel for signaling. Echo cancelling will be enabled as well.
#autogenerated by /usr/sbin/wancfg_dahdi do not hand edit
#autogenrated on 2015-08-28
#Dahdi Channels Configurations
#For detailed Dahdi options, view /etc/dahdi/system.conf.bak
#Sangoma A102 port 1 [slot:4 bus:6 span:1]
#Sangoma A102 port 2 [slot:4 bus:6 span:2]
Continue reading “Asterisk – How to Host a PRI Circuit with a Sangoma Card”
Here is a quick and dirty bash script I threw together today to log the concurrent calls for each of my long distance trunks in Asterisk to a MySQL database to be able to quickly analyze usage trends. Sure there is probably other open-source software out there that can do this and give pretty little graphs and what not (cdr-stats or maybe queue metrics come to mind), but where’s the fun in that? As I mentioned, the script is extremely primitive (just the bare minimum as I didn’t have much time to spend on it) and contains no error checking whatsoever but it could also be used as a pretty handy one-liner in bash.
Show all active SIP Calls on a single trunk
asterisk -x "core show channels verbose" | grep "^SIP/yourSIPTrunkName-"
Show concurrent number of SIP Calls on a single trunk
asterisk -x "core show channels verbose" | grep -c "^SIP/yourSIPTrunkName-"
Show all active DAHDI calls on channels 1-24
Continue reading “Bash Script – Log Concurrent Asterisk Calls to MySQL and Other Useful One-Liners”
For the longest time, I was having trouble getting the log rotate daemon to work properly with Asterisk. I tried using both postrotate and prerotate options on Ubuntu Server and no matter what, I always ended up with dozens or even hundreds of files if I wasn’t keeping a close eye on them. I never figured out why or wanted to spend a ton of time searching for answers but for some reason, the numbering on the log files would always get messed up and it would start adding extra periods on the end of the filenames and everything would get all out of whack.
Continue reading “Bash Script – An Alternative to Logrotate.d for Asterisk Log Files”
After running into permission issues trying to get PHP’s shell_exec command to chown call files as the asterisk user(which only root can do), I decided to make this script.
As a side note, you should be able to get the shell_exec command to work using sudo by adding the www-data user to the sudoer’s file without a password but that wouldn’t work in my particular environment. The server I was working on was extremely outdated and didn’t even have sudo installed.
Add this to /etc/sudoers
www-data ALL=NOPASSWD: /path/to/script
The following code runs the script as a daemon. You will need to update rc to start this script at default run levels and also make sure to chmod +x this file to make it executable.
# Move asterisk call file daemon startup script
# Author: Nathan Thomas
Continue reading "Bash Script – Move Asterisk Call Files into Spool Directory"