Categories
Knowledge Base Technical

Nagios plugin for reading the Asterisk Database

This is a simple plugin that is based on one by Jason Rivers We have changed it now to read the ASTDB (Asterisk internal Database and then based on ok and Critical keys it will report OK or Critical staus reports to Nagios.

This was written for reporting if an Elastix system is in Day or Night mode.

You can define the Database Family, Key, Critical value and OK value. This means you can cutomise it to what ever you need to report.

 

The Code is below, make you may need to change /usr/bin/nc for what ever you use for netcat.

any issues email us, but dont forget this is given for free not supported for free.

#!/bin/bash
#
# Program : check_asterisk_ami
# :
# Author : Original code by Jason Rivers < jason@jasonrivers.co.uk >
# : Modified by Cyber-cottage.co.uk for checking the asterisk Database
# :
# Purpose : Nagios plugin to return Information from an Asterisk host using AMI
# :
# Parameters : --help
# : --version
# :
# Returns : Standard Nagios status_* codes as defined in utils.sh
# :
# Licence : GPL
#
# Notes : See --help for details
#============:==============================================================
PROGNAME=`basename $0`
PROGPATH=`echo $0 | /bin/sed -e 's,[\/][^\/][^\/]*$,,'`
REVISION=`echo '$Revision: 1.1.0.6 $' | sed -e 's/[^0-9.]//g'`
. $PROGPATH/utils.sh
print_usage() {
echo "Usage: $PROGNAME [-H hostname] [-u username] [-p password] [-P port] [-k DBkey] [-c critical] [-o ok] [-f family]"
echo " -H Hostname"
echo " -u AMI Username"
echo " -p AMI Password"
echo " -P (optional) AMI PORT"
echo " -k Database key"
echo " -f Database family"
echo " -c Critical Key"
echo " -o OK KEY"
echo ""
echo "SupportedCommands:"
echo " Most DB familiys that toggle such as DayNight in elastix"
echo "Usage: $PROGNAME --help"
echo "Usage: $PROGNAME --version"
}
print_help() {
print_revision $PROGNAME $REVISION
echo ""
echo "Nagios Plugin to check Asterisk ASTDB using AMI"
echo ""
print_usage
echo ""
echo "Asterisk Call Status Check. orignal version by © Jason Rivers 2011 changes to do ASTDB by cyber-cottage.co.uk"
echo ""
exit 0
# support
}
# If we have arguments, process them.
#
exitstatus=$STATE_WARNING #default
while test -n "$1"; do
case "$1" in
--help)
print_help
exit $STATE_OK
;;
-h)
print_help
exit $STATE_OK
;;
--version)
print_revision $PROGNAME $REVISION
exit $STATE_OK
;;
-V)
print_revision $PROGNAME $REVISION
exit $STATE_OK
;;
-H)
REMOTEHOST=$2;
shift;
;;
-P) AMIPORT=$2;
shift;
;;
-u) AMIUSER=$2;
shift;
;;
-p) AMIPASS=$2;
shift;
;;
-c)
CRITICALNAME=$2
shift;
;;
-o)
OKNAME=$2
shift;
;;
-k)
DBKEY=$2;
shift;
;;
-f)
FAMIL=$2;
shift;
;;
*)
echo "Unknown argument: $1"
print_usage
exit $STATE_UNKNOWN
;;
esac
shift
done
if [ "${AMIPORT}" = "" ]; then
AMIPORT="5038"
fi
if [ "${FAMIL}" = "" ]; then
##WARNING
echo="CRITICAL: Unknown KEY"
print_help
exit=$STATE_CRITICAL
else
## Checking Astdb
CHANNELS=`/bin/echo -e "Action: login Username: ${AMIUSER} Secret: ${AMIPASS} Events: off Action: DBGet Family: ${FAMIL} Key: ${DBKEY} Action: Logoff " | /usr/bin/nc $REMOTEHOST ${AMIPORT} | awk '/Val/ {print $2}'|tr -d " "`
if [ "$CHANNELS" = "" ]; then
echo "UNKNOWN: Unable to get ASTDB status"
exit $STATUS_UNKNOWN
fi
if [ "$CHANNELS" = "${OKNAME}" ]; then
exitstatus=$STATU_OK
MSG="OK: ${DBKEY} Asterisk Emergency message not active"
elif [ "$CHANNELS" = "" ]; then
exitstatus=$STATU_WARNING
MSG="WARNING: Asterisk Unknown status"
elif [ "$CHANNELS" = "$CRITICALNAME" ]; then
exitstatus=$STATU_CRITICAL
MSG="CRITICAL: ${DBKEY} Asterisk Emergency message active"
fi
fi
echo $MSG
exit $exitstatus

Categories
Design Installation Services Support Technical

Gradwell Approved Professional

A Gradwell Approved Professional (GAP) has a core set of knowledge required to succeed with the Gradwell product set and systems. To become a Gradwell Approved Professional partners must pass an examination and show an in depth knowledge of Gradwell Products and Voip Support.

This means you can be confident that they can:

  • Achieve consistent roll outs of reliable business telephony services.
  • Confidently resolve end user technical issues within an acceptable time frame.

To signup to Gradwell services with us CLICK HERE

Categories
Peripherals Products

The Algo 8180 SIP Audio Alerter

The 8180 SIP Audio Alerter is a loud ringing, paging and intercom device for use with SIP telephone systems. It has two main uses. The first is as a loud ringer for use in places such as warehouses. The second use is as a paging and intercom system. It can operate in both these modes at the same time by appearing as two different extensions on your phone system at the same time.

When registered with a SIP server, one endpoint will play an audio file from internal memory upon ring detection. The second endpoint will auto-answer for voice paging or full intercom (two way audio).

Equipped with a high efficiency integrated amplifier and tuned high quality loudspeaker, the 8180 is typically eight times louder than a telephone speaker. Several audio files are pre-loaded into the 8180 internal memory for ring sounds but users may also record or upload custom audio files, music, sound effects, or voice announcements.

Ambient noise monitoring

The advanced features of the 8180 include SoundSureTM technology which automatically adjusts loud ring and loudspeaker volume to compensate for background ambient noise. Ideal for variable noise environments (restaurants, workshops, classrooms, etc.), SoundSureTM ensures that ringing or paging is always heard but not unnecessarily loud.

Applications / Usage scenario

  • Loud Ringer in noisy or variable noise environments (classroom, restaurant, machine shop)
  • Voice Paging (warehouse, workshop)
  • Outdoor ringing or paging
  • Multi-cast wide area notification

Easy to Install

  • Network managed SIP endpoint
  • Configuration is possible using the feature buttons or web interface
  • PoE eliminates local power supply

Features

  • Voice Paging with talkback capability
  • High efficiency and high output wideband speaker
  • Multicast receive or broadcast capability
  • Outputs for external speaker, slave amplifier, or visual alerter
  • Dual purpose loud ringing and/or talkback voice paging
  • Significantly louder (eight to twenty times) than typical telephones
  • Low frequency tones outperform traditional shrill electronic ringers
  • SoundSureTM ambient noise compensation adjusts output for noise level
  • Multicasting capability for wide area notification

Customisable

  • Pre-loaded with several ring tones including bell, chime, gong, buzzer, warble, and dogs
  • Supports custom uploaded WAV files or recorded messages
  • Selectable/customisable alert tones or announcements

Please contact for pricing and avalibility

Categories
Case Studies Technical

Man In The Middle

Man In The Middle Server, What does he mean I hear you ask?

Well its the best term for it, as it describes what it is and does. Basicly we have an AsteriskServer sitting in between the incoming lines and the main  PBX. Idealy We would have liked to replace the existing PBX but in some cases this just isnt possible and we have to accept this.

So why may we need to do this, Well we have used this solution to allow customers to have follow the sun  support call centers.  Calls arrive to a dedicated DDI number that is for support in that country and depending on the time of day it is routed to the call center that is open in another part of the world over a voip network. This is done by Asterisk checking the called number of all calls and if a match is made the call is passed off to Asterisk to handle the call in its dialplan, all other unmatched calls are passed on to the main system.

We have also used this method of connection to play prompts to callers before the call is sent to the main system. Calls in this case can be identified by CallerID name or number. So for example calls from the BT operator, International payphones or even just a certain CallerID Number are played a specific message and then either forwarded on or passed on to a IVR (Interactive Voice Response menu) to be handled in a specific manner.

A another often used reason for this type of connection is when migrating from a legacy pbx to and Asterisk server. The line connections are the same and the call flow is controlled by the dialplan, Routing calls on teh Asterisk system to its dialplan and routing calls for extensions still on the old system to it.

Once all extensions are migrated to the new system the old system can be turned off and removed with no interuption to the users on the new system.

Categories
Knowledge Base

General Configuration Guide Skype for SIP and Asterisk

 

If you are new to SIP, Asterisk is a useful, open-source (GPL) platform with which to test and experiment with the Skype for SIP. This is a guide on how to install Skype for SIP on a system agnostic or “vanilla” Asterisk server.

 

To install Asterisk on your server, please see the Digium documentation here http://www.asterisk.org.

 

This configuration guide is based on Debian Linux (Lenny 64bit). With a basic installation of Debian you can install Asterisk by issuing the following APT command at the command line:-

apt-get install asterisk

 

 

Configuration Files for Vanilla Asterisk

 

In configuring Skype for SIP on a vanilla Asterisk system we are primarily concerned with two configuration files:-

 

  1. sip.conf (located in the /etc/asterisk/ directory)
    The sip.conf file holds the registration details for the Skype for SIP channel
  2. extensions.conf (located in the /etc/asterisk/ directory)The extensions.conf holds the dial plan telling Asterisk what to do with incoming and outgoing calls.-

 

Let’s do a walkthrough of the configuration steps.

 

Configuring the sip.conf File

 

Step 1

 

The sip.conf file has two sections that need to be completed. The “General” section (denoted in the file with the [general] heading) and peer section denoted in the file with the [peers] heading.

 

In the General section we need to add a “register” line. This tells Asterisk to register with Skype at the Skype local point of presence.

 

Add the following, under the “[general]” section in the file, substituting your 9905xxxx number and password with your actual credentials for the Skype for SIP profile you wish to use. Your SIP Profile details can be found in the Skype Business Control Panel (BCP):-

 

register => 99051000xxxxxx: PaSsW0rD@sip.skype.com /99051000xxxxxx

 

Step 2

To ensure that we also receive the callerID from Skype clients we also should add:-

 

trustrpid = no

sendrpid = yes

 

 

Step 3

Next, we add a section for the peer, in the “[peers]” section of the sip.conf file. Again we substitute the 9905xxxxx number and password with the SIP Profile credentials from the Skype Business Control Panel (BCP):-

 

[99051000xxxxxx]

type = peer

username = 99051000xxxxxx

fromdomain = sip.skype.com

fromuser = 99051000xxxxxx

realm = sip.skype.com

host = sip.skype.com

dtmfmode = rfc2833

secret = PaSsW0rD

nat = no ;This should be set to reflect your network NAT configuration

canreinvite = no

insecure = invite

qualify = yes

disallow = all

allow = alaw

allow = ulaw

;allow = g729 ; Uncomment this if you have G729 licences

amaflags = default

trustrpid = no

sendrpid = yes

context = skype_in

 

Please Note:

If your Asterisk PBX is behind a NAT device, you should set “nat = yes” in this section.

 

If your Asterisk PBX has a dedicated internet IP address, set this to “nat = no”.

 

Step 4

After setting these changes, reload the Asterisk’s SIP module by typing:-

 

asterisk -rx “reload chan_sip.so”

 

…….at the command line.

 

Step 5

After the SIP Module has reloaded enter asterisk -rx “sip show peers” at the command line, which should return:

 

pbx*CLI> sip show peers

Name/username Host Dyn Nat ACL Port Status

99051000xxxxxx/99051000xx 193.120.218.68 5060 OK (52 ms)

 

Then enter asterisk -rx sip show registry” which should return:

 

pbx*CLI> sip show registry

Host Username Refresh State Reg.Time

sip.skype.com:5060 99051000xxxx 105 Registered day, dd mmm yyyy hh:mm:ss

 

If you see output similar to the above, then you are registered to the Skype SIP gateway and ready to make and receive calls.

 

We now need to setup the extensions.conf so that we have a dialplan setup and Asterisk knows how to deal with incoming and outgoing calls.

 

Configuring the extensions.conf File

 

The extensions.conf file requires a “context” and an “extension” to be added for incoming Skype calls, plus an extension to be added to the context that users use for outgoing calls.

 

Incoming “context”

 

Add the following lines to the [context] section of extensions.conf, substituting 9905xxxxxxx with the 9905 number for the SIP Profile. Again you can find the details of your Skype SIP Profiles in the Skype BCP:-

 

[skype_in]

exten => 99051xxxxxxxx,Noop(${CALLERID(name)} , ${CALLERID(num)})

exten => 99051xxxxxxxx,n,Dial(SIP/100,30,t,r)

exten => 99051xxxxxxxx,n,voicemail(100|u)

 

This is a simple “vanilla” context that shows us the callerID name and number, dials extension 100 for 30 seconds and finally, if unanswered, goes to voicemail. This sequence will need to be amended to suit your requirements. If you are planning on having many SIP Profiles or Online Numbers that all need to end up at the same destination, or the destination is decided by the Skype Business Account that the online number is registered against, a more complicated Dialplan can be used. For example:-

 

[skype_in]

exten => 99051xxxxxxxx,1,Noop(${CALLERID(name)} , ${CALLERID(num)})

exten => 99051xxxxxxxx,n,Queue(sfs|r|||40)

exten => 99051xxxxxxxx,n,voicemail(100|u)

 

 

Outgoing “Context”

 

The outgoing context must be included in the context for your user’s phones. Usual security measures apply. Do not include this in a context for incoming calls.

 

[skype_out]

 

exten => _90Z.,1,Set(CALLERID(num)= 99051xxxxxxxx)

exten => _90Z.,n,Dial(SIP/0044${EXTEN:2}@99051xxxxxxxx)

 

exten => _900.,1,Set(CALLERID(num)= 99051xxxxxxxx)

exten => _900.,n,Dial(SIP/${EXTEN:1}@99051xxxxxxxx)

 

 

In the sip.conf add the following to create user 100

 

[100]

secret=secret

mailbox=100

callerid=”myskypetrunk” <100>

type=friend

host=dynamic

context=international

;nat=no

nat=yes

canreinvite=no

dtmfmode=rfc2833

pickupgroup=1

callgroup=1

subscribecontext=default

notifyringing=yes

disallow=all

;allow=alaw

allow=ulaw

allow=gsm

 

in the extensiosn.conf add the following to the default context

 

exten => _XXX,1,Dial(SIP/${EXTEN},20)

 

Also create a context called international

 

[international]

include => default

include => skype_out

 

Categories
Case Studies

Asterisk install in a campus style school

In late 2005 We we approached to replace an aging Panasonic system for a British Public School.
The driving force for moving to voip was that the site was spread over a wide area and different buildings and to provide telephones to the remote buildings would prove too expensive.
The system was replaced with a central Asterisk server with nearly 80 extensions. The core LAN was upgraded to Netgear Layer 3 switches with Powerdsine POE midspans.
The remote buildings added extra complexity as one was on the other side of a public road.

To overcome this, this building was connected to the main site via a “Point to Point” Wifi link. The other building was closer and could be connected via a Fibre Link between the it and the main building.

Campus Site

The system was configured to use account codes in public areas, These handsets can only make emergency or internal calls unless a validated account code is entered.
The handsets used were a mix of Aastra 480i and 9133i because of build quality, reliability and BLF support.

The system has now been in place for over 2 and a half years now and in that time the only faults have been either ISDN failing or cable faults. This is a great demonstration of the reliabilty of Asterisk and Aastra handsets and voip in general.

UPDATE

We have since writing this post updated the system on new hardware as part of a refresh. They are now running on a newer version of Asterisk and have more buildings connected to the network.

Categories
Products

Handsets,Gateways and Cards

We supply VoIP Hardware, Phone Systems, IP Phones & VoIP Equipment from all Major Manufacturers.

Aastra Polycom Snom
Digium Openvox Patton
Grandstream Vegastream Redfone
Citel Linksys  We also supply

YeaLink

Gigaset

Please contact us with

your requirements


Please contact us for pricing
Categories
Case Studies

Solicitors Group

We were approached to provide a Voip solution for a London Solicitors. They were moving from a Single office to two offices in different parts of the city.

At the Primary office we installed an Asterisk server that was connected to the ISDN30e link where all DDI numbers were delivered for both sites. This site also had its own VOip connection as well

At the main site the operators were based using the Asternic FlashOsPanel for displaying extension status for both sites.

A key feature of the system was to provide a flexible system for out of hours callers to contact the duty Solicitor. This was provided so that callers on calling out of hours  can leave a message for the next day or press an option to contact the Duty solicitor. The Duty solicitor can call into the system and change the contact number at will if for example they are busy with a client.

A SIP trunk connected both sites together over a 20Meg link that was used for both voice and data.

The new sites were not in the exchange area of the original phone number so this was ported to Gradwell.net so that it could be delivered via an IAX2 connection to the relevent server.

The handsets used were a mixture of Aastra 53i and 55i with an xml appliction to set DND status in the Flash ops panel and light the light on the handset.