How to setup a Centurylink IQ SIP Trunk for Asterisk

Centurylink IQ architecture

I recently struggled to install a Centurylink SIP trunk.  Our rep could only provided us with Cisco configuration instructions.  From there we had to decipher the appropriate settings in Asterisk.  If you are reading this post you are probably in serious trouble right now.  Don’t worry!  Take a deep breath and keep reading!

 This is for Vanilla Asterisk 1.8.x.  I will cover sip.conf and extensions.conf examples.  The reference system is CentOS 7 paired with Asterisk 1.8.28.  This tutorial assumes you have working knowledge of Asterisk and the core configuration files.

Goals of the Post:

  • Configure Centurylink IQ SIP Trunk (sip.conf)
  • Configure Inbound/Outbound dialing (extensions.conf)
  • Set Hosts Mapping (/etc/hosts)




How to connect Asterisk SIP Clients over Duel Layers of NAT

A common problem with SIP is it’s difficulty handling NAT(especially over multiple layers).  A common symptom is no audio stream.  The Asterisk CLI  shows a successful call connection succeeding followed by an error in /var/log/asterisk/messages:

[Jun 14 17:16:26] WARNING[2967] chan_sip.c: Retransmission timeout reached on transmission 4e2a8586-3a91c1cf-e73f6b64@ for seqno 2 (Critical Response) — See
Packet timed out after 6399ms with no response



How to Provision Global Settings using Polycom 4.0 Firmware


Recently I’ve been tasked with figuring out how to provision Polycom phones on the 4.0 firmware.  I’ve resisted for some time because of our existing GUI and templates.  However, the time has come to make the transition.  This tutorial will cover how to create a custom settings file that used to make up sip.cfg.  We will define our own ‘global options’ config referenced from  00000000000-phone.cfg.


Goals of this Post:

  • Create custom global options for Polycom 4.0 firmware



Written by mattb in: Asterisk,Asterisk Post,Linux | Tags: , ,

Asterisk 1.8 T1 w/ PRI + analog fax

It’s been a while since I posted, so I want to come out swinging.  I recently put together a phone system for a medium office.  They have a standard T1 and a 4 port FXS Digium card.  The analog card is for a PA system and two fax machines.  This post is a quick tutorial with examples for installation.

Goals of this post:

  • Configure Digium T1 w/ PRI
  • Configure Analog card channels
  • Asterisk Dahdi setup

This tutorial assumes you have a somewhat recent working build of libpri, dahdi, and Asterisk.



Agent Auto log-off script for Asterisk

Many times an Agent will forget to logoff. This can cause call routing, payroll, and queue statistic problems with Asterisk. With a handy BASH script it is easy to log all the agents out the queues automatically. Below is the shell script and an example of the crontab entry for execution at 6:00 PM every day.


Written by mattb in: Asterisk,Scripts | Tags: , , ,

Asterisk: Holiday Macro

Below is an example of a macro that checks to see if the ‘holiday’ menu is enabled.  I also added extension 2970, a ‘one touch’ utility to enable/disable the holiday macro.  Remember to create a ‘holiday_disabled.wav’ that literally says, “Holiday menu disabled”.  To rercord a message simply disable and enable the utility again.  Enjoy!




;Check if holiday message set

;Check if it is a holiday
exten => s,1,NoOp(Check for Holidays)
exten => s,n,Answer()
exten => s,n,set(HOLIDAY=${DB(closed/1)})
exten => s,n,NoOp(${HOLIDAY})
exten => s,n,gotoIf($[“${HOLIDAY}” = “1”]?main-holiday,s,1)   ; Custom Holiday

exten => s,n,gotoiftime(08:00-19:00,mon-fri,*,*?${ARG1},s,1) ; Main Operating Hours
exten => s,n,goto(${ARG2},s,3)



; usage: macro(holiday,ARG1,ARG2)
; argument one and two are that day and night menu
; Some DID

exten => 12134974061,1,macro(holiday,main-day,main-night)


; One touch Record/Set Holiday Closed Message
exten => 2970,1,NoOp(============ Set Holiday Message ==============)
;exten => 2970,1,authenticate(5678)
exten => 2970,n,Wait(1)

; check to see if holiday message is set
exten => 2970,n,set(HOLIDAY=${DB(closed/1)})
exten => 2970,n,NoOp(${HOLIDAY})
exten => 2970,n,NoOp(${HOLIDAY})
exten => 2970,n,NoOp(${DB(closed/1)})
exten => 2970,n,gotoIf($[“${HOLIDAY}”=”1”]?utilities,2970(disable),1:utilities,2970(enable),1)

; if disabled record a new greeting
exten => 2970(enable),1,Record(en/custom/holiday_message:gsm)
exten => 2970(enable),n,Wait(1)
exten => 2970(enable),n,set(DB(closed/1)=1)
exten => 2970(enable),n,Playback(en/custom/holiday_message)
exten => 2970(enable),n,wait(1)
exten => 2970(enable),n,Hangup

; disable the holiday message and alert the caller

exten => 2970(disable),1,set(DB(closed/1)=0)
exten => 2970(disable),n,Playback(en/custom/holiday_disabled)
exten => 2970(disable),n,Hangup


Asterisk: How to setup Agent Status on Polycom Idle Display

Polycom Soundpoint IP 550 idle display screen


This tutorial describes how to configure the idle display screens on Polycom phones to subscribe to a XHTML file that reads their Agent status from Asterisk.  When the phone is not in active use it displays the web page.

My tutorial has three components.  A specific Polycom option(found in sip.cfg) added to the configuration file of each phone, a BASH script I wrote, and a little Asterisk configuration.  This tutorial assumes you have a working Asterisk 1.6+ PBX with a basic queue setup.  It also assumes you are using automatic web provisioning of your Polycom phones.

Here is a link to my previous article on  configuring Polycom SoundPoint IP phones for Asterisk:

How to configure a Polycom SoundPoint IP phone for Asterisk on Fedora 10

To get the idle display screen to work correctly we will need to modify our standard configuration file a bit.  Navigate to the FTP/HTPP directory you provision your phones from.  Edit an Agent phone similar to the following,

Written by mattb in: Asterisk,Scripts | Tags: , , , ,

Asterisk: How to Install Queuemetrics and Qloader

queuemetrics login

Queuemetrics is by far the best Call Center software Linux.  My only complaint might be that Java is huge resource hog when it parses the Asterisk. ‘/var/log/asterisk/queue_log’.  Luckily Loway provides an excellent PERL script called Qloader.

Today we will walk through installing Queuemeteics,MySQL,and Qloader daemon. My installation instructions are basically a quick rundown of the excellent infomation on Loways site: 

My Setup:
Fedora 14 – (32 bit)
Asterisk 1.6
QEMU-KVM virtual machine on Intel i7



BASH script to logout Dynamic Agents

This is a simple script for logging out Dynamic Agents in Asterisk.  The most common use would be to logout Agents automatically each day in case they forget or are on PAUSE.  Edit the “LOGGEDIN” variable below to match the correct length of digits.  By default it is three,  ‘SIP/…’.

You can add as many or as few Queues in place of QUEUE1, QUEUE2, & QUEUE3.  This is the ‘foreach’ section of the script.  Whatever that is here will be applied to each instance of SIP/xxx detected by grep.  Good luck.




#set -x

# Execute from the command line, Asterisk or by cron

LOGGEDIN=$(/usr/sbin/asterisk -rx “queue show” | /bin/grep -o ‘SIP/…’)

for i in $LOGGEDIN


echo “$i removed”

#  Add in all queues that should be included

/usr/sbin/asterisk -rx “queue remove member $i from QUEUE1”
/usr/sbin/asterisk -rx “queue remove member $i from QUEUE2”
/usr/sbin/asterisk -rx “queue remove member $i from QUEUE3”




Resample MP3’s for Polycom Ringtones with Audacity

A customer of VoiceIP Solutions sent me this useful tutorial for re-sampling Polycom Ringtones.   If you have an MP3 you like, it can be re-sampled for use with a Polycom IP SIP phone!  The procedure is pretty straight forward, Install Audacity with yum or your favorite package manager, re-sample the track, then edit the proper Polycom Soundpoint boot files.

Goals of this Post:

– Install Audacity Digital Audio Editor
– Convert a MP3 to Polycom compatible track
– Enable custom special Ringtone on Polycom Soundpoint IP SIP phone