Asterisk – How to Host a PRI Circuit with a Sangoma Card

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.
/etc/dahdi/system.conf

#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
loadzone=us
defaultzone=us

#Sangoma A102 port 1 [slot:4 bus:6 span:1] 
span=1,0,0,esf,b8zs
bchan=1-23
echocanceller=mg2,1-23
hardhdlc=24

#Sangoma A102 port 2 [slot:4 bus:6 span:2] 
span=2,2,0,esf,b8zs
bchan=25-47
echocanceller=mg2,25-47
hardhdlc=48

Continue reading “Asterisk – How to Host a PRI Circuit with a Sangoma Card”

Adtran Total Access TA924 – SIP Configuration for Asterisk

Here is a scrubbed working configuration for an Adtran TA924 SIP connection to an Asterisk server with a couple of noteworthy points:

  • The internal feature codes of the Adtran have been disabled with the “voice feature-mode network” command. As long as your Adtran’s internal dialplan supports it, feature codes can be passed through to Asterisk.
  • With the “accept $ cost 0” statement on the “NETWORK” trunk group, the Adtran dialplan simply passes off all traffic to the network.
  • Three way calling has been disabled with the “voice call-appearance-mode single” command.
  • Call waiting has been disabled with the “no call-waiting” command per SIP registration.
  • G711u is the only codec enabled by choice.
  • There is an example of how to connect an FXS port to a SIP user.
  • There is an example of how to set transmit/receive gains on an FXS port.
  • There is an example of how to register an extension range of 7000-7023 to an Asterisk server.

Continue reading “Adtran Total Access TA924 – SIP Configuration for Asterisk”

Bash Script – Log Concurrent Asterisk Calls to MySQL and Other Useful One-Liners

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”

Carrier Access Adit 600 – Reset to Factory Defaults

Carrier Access Adit 600
Carrier Access Adit 600

Today I ran into a password issue on a refurbished piece of telco equipment that I got for a great price at refurbphoneexchange.com, the Carrier Access Adit 600.

Just a little background info, these units are great for converting a couple of T1s from a Sangoma or Digium card in an Asterisk server for up to 48 FXS ports and are very solid performance wise. When compared to a Rhino box or other similar device that provide the same functionality, it’s like 1/5th of the cost. As far as I know, the only downside is that they are out of production and there is a limited number of units out there. Also, I haven’t been able to find any firmware updates anywhere for these units on the interweb. The company has been bought and sold so many times it is hard to keep track of who to call for support. It was Dell Force 10 Networks but now the current company that owns rights to the product is Telmar but I’m still having trouble finding answers to my questions.
Continue reading “Carrier Access Adit 600 – Reset to Factory Defaults”

Bash Script – Move Asterisk Call Files into Spool Directory

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.

filename: /etc/init.d/mvcallfile

#!/bin/bash
# Move asterisk call file daemon startup script
# Author: Nathan Thomas

PROG=mvcallfile
 Continue reading "Bash Script – Move Asterisk Call Files into Spool Directory"