Blog

Integrating Skype Connect and Asterisk

Skype Connect is a new Skype product which allows you to connect Skype Business accounts and numbers directly to an Asterisk PBX using a SIP trunk and the Skype Manager portal. Whilst this product is not a direct replacement for traditional SIP trunking as it does not allow Emergency Dialing it can be used to allow your staff or customers to make inbound calls to your office Skype business account for free from the Skype client. This article will detail how to configure a Skype Connect SIP trunk to allow inbound and outbound dialing on a standard Asterisk installation. We will cover FreePBX configuration in a separate article. To use this service you will need a Skype account which is registered for the Skype Manager service. If you do not currently have a suitable account you can create a new profile or register your existing Skype account for free via this link.  This account will be used to administer your company account, so it is generally recommended to create a new account specifically for this purpose. You can add your own personal/business accounts as a member of the company account in the later stages. Once you are logged into the Skype Manager interface you will need to create a new SIP Profile which we will use to connect Skype Connect to the Asterisk PBX. Creating the SIP Profile

  1. Click the ‘Features‘ link in the top navigation menu,
  2. Select ‘Skype Connect‘ in the left navigation menu,
  3. Click the ‘Set up a SIP Profile‘ button,
  4. Enter a unique name for the SIP profile you are creating then click ‘Next‘ to continue. We recommend using something which allows you to easily identify the system you intend to connect this trunk to, for example the office location or Hostname. Profile Name
  5. Next we will need to setup the channel subscriptions for this profile. Each channel allows for a single concurrent inbound or outbound call so ensure you select an appropriate number of channels for your anticipated usage. You can enable upto 300 channels per SIP profile. It is possible for you to increase or decrease the channel allocations at a later date if you find you require additional channels.
  6. Click ‘Next
  7. Your SIP profile should now be active and the registration details should be visible as below: Registration Details The password will not be visible via the Skype Manager portal and is randomly generated – It is automatically emailed to the email address that is associated with the Skype Manager account. You will need to retrieve this password to continue with the registration process.

Enable inbound calls: Skype Connect with Skype Business Account To enable inbound calls over the Skype Connect profile you will need to add a Skype Business account, Skype Number (Or combination of both!) to the SIP profile. Note,  if you attach a business account to your SIP profile you will no longer be able to log into that account from the desktop Skype client. To attach a business account to your SIP profile you will need to log into the ‘Skype Manager‘ portal then follow these steps:

  1. Click ‘Features‘ and select ‘Skype Connect‘ from the left-hand navigation menu. You  will then be presented with a list of all available SIP profiles, and presented with the option to create a new profile if required,
  2. Select the SIP profile we created earlier in this article by pressing the ‘View Profile‘ button next to the profile name,
  3. In the ‘Incoming Calls‘ section press the ‘Add a number or business account‘ link,
  4. Select the ‘Add Business Account‘ tab
  5. If using an existing business account enter the account name in the first text box, then select it from the drop down box. If you require a new account press the ‘Create a new account‘ and follow the on-screen instructions.
  6. In the ‘Extension Number‘ text box we will need to enter an extension number that Asterisk can use to recognise and direct the call through the dial plan. This number is limited to 10 numerical characters.

Registering from Asterisk Using the SIP Profile credentials we generated above we will need to configure Asterisk to register with the Skype SIP servers. To do this we must take the following steps:

  1. Connect to your Asterisk server via SSH and navigate to the Asterisk root directory ‘/etc/asterisk/
  2. In your favourite text editor open your SIP configuration file (This may be ‘sip.conf‘, ‘sip_custom.conf‘, ‘sip_registrations.conf‘ or ‘sip_registrations_custom.conf‘ depending on the flavour of Asterisk you are using.)
  3. In the head of this file we will add a register string for the Skype Connect profile we have created: register => username:password@sip.skype.com:5060/username Remember to update the parts in bold to reflect your own SIP profile settings!.
  4. Reload the SIP settings on asterisk:
    user@computer:$ asterisk -rx "sip reload"
  5. Check that the registration has completed successfully by issuing the following command, you should see ‘Registered’ in the State column if we have been successful:
    user@computer:$ asterisk -rx "sip show registry"
  6. Your Skype business user should now show as permanently online and able to receive calls via the Skype client. Note, this will only work with voice calls – Video and text messaging are currently not supported via Skype Connect.

You should now be able to generate inbound calls to your Asterisk server directly via your Skype phone number and via the Skype client.  Note, when you receive an inbound call from a Skype user via the Skype client (rather than via your Skype number) the caller ID will show as “Anonymous” however you are able to retrieve the callers username via SIP Headers or by using the ${CALLERID(name)} variable. Enabling outbound calls Setting Asterisk up to use the Skype channel as an outbound route is relatively easy.  First we must create an entry in your SIP configuration file for the trunk to use. Open ‘sip.conf‘ in your text editor of choice then add the following entry, replacing the bold sections with the settings from your Skype business account:

[skype]
username = Your Username
fromuser= Your Username
secret = Your Password
type = friend host = sip.skype.com
fromdomain = sip.skype.com
insecure=port,invite

You will then need to create a new outbound context to handle calls via the skype trunk, for example:

[outbound-skype]
; Outbound calls consisting of an 11 digit telephone number prefixed with 7594 will be dialed via Skype Connect
exten => _7594XXXXXXXXXXX,1,Dial(SIP/skype/${EXTEN})

Notes on using Skype Connect While Skype connect can be handy for allowing free inbound calls from customers and staff who use the Skype messaging platform, it is important that we acknowledge there are a few draw backs  to the service. In our opinion it is not yet ready to act as a suitable replacement for traditional SIP trunking providers, however it can be used to provide supplemental features to an existing system. When using Skype connect please keep in mind:

  • Skype DO NOT support emergency calling via their network. You will be unable to dial the emergency services on any number via this trunk.
  • There can be a significant delay on calls that route via the Skype network, with delays of upto 30 seconds between a user initiating a call and hearing the first stages of ringing and the call actually being presented to the Asterisk server.
Posted in Asterisk | Tagged , , , , , , , , , | Leave a comment

Creating Virtual Machines with Virsh

Some of you out there will have worked with KVM/QEMU. Because of this, fewer of you might have worked with a program called Virtual Machine Manager (virt-manager) which is great for managing and creating virtual machines… locally.

Where Virtual Machine Manager falls over is quite irritating, and that’s when it comes to creating virtual machines on a remote system.

For example, we here at DMC host a lot of virtual machines at a remote location, and we need to create machines on a regular basis. This can be quite the tedious task if you’re forced to use virt-manager connecting over ssh, as it can take up to ten minutes just to move between creation screens.

There are ways around this of course, as with everything Linux, and one such way it to import a template using ‘virsh’

Virsh

Virsh, stylized “virsh” is a ‘management user interface’ for virtual machines.

You can do a lot with virsh, it’s a very useful and powerful tool for working with virtual machines on the command line, however, for today we will just be focusing on creating the virtual machines.

Creating a Config File

We are going to start with the following example XML, which is generic, but can be tweaked to your individual needs:


 

<domain type='kvm'>
  <name>test</name>
  <memory unit='MB'>512</memory>
  <currentMemory unit='MB'>512</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='cdrom'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source dev='/dev/volume-group/test-boot'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writethrough'/>
      <source dev='/dev/volume-group/test-root'/>
      <target dev='vdb' bus='virtio'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/dev/volume-group/test-swap'/>
      <target dev='vdc' bus='virtio'/>
    </disk>
    <disk type='file' device='cdrom'>
      <source file='/var/lib/libvirt/images/CentOS-6.4-x86_64-bin-DVD1.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>
    <interface type='bridge'>
      <mac address='52:54:00:88:88:88'/>
      <source bridge='br0'/>
      <model type='virtio'/>
    </interface>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' keymap='en-gb'/>
  </devices>
  <seclabel type='none'/>
</domain>


 

There are some important additions that need to be made to the above example to make it work for you.

Everything in bold may be different, for example, we are using LVM for our disks, and we also have three of them, splitting up root / swap / boot in to three disks. We also use different caching for each.

The name of the VM may be different, the MAC address, the source of the installation medium, etc. All of the options you should need will be on the man page of virsh.

We need to create this entry somewhere on your server, open your favourite editor and copy it in. Save it as ‘vm-config’ or similar.

Creating the Disks

Because we use LVM for our disks, I have to create them first, this is easily done though:

# lvcreate -L 256M -n test-boot volume-group

# lvcreate -L 20G -n test-root volume-group

# lvcreate -L 1G -n test-swap volume-group

Importing the Config

Now that everything is in place, we can import the configuration:

# virsh define vm-config

If we now run:

# virsh list --all

You will see your VM, but it won’t be started.

# virsh start test

That’s it, your VM will start up and should try the installation medium specified first. If you have automated this process with a script then the installation should start straight away.

Connecting to the VM

There are a couple of ways to connect to the VM and check it through the installation, but the easiest is to use virt-manager.

Load up your virt-manager installation, and your VM should now be in the list of the hypervisor you are connected to.

From here you can guide it through the installation manually if required.

You can also connect to the VM from the command line of the hypervisor using virsh, but that’s a complete blog post in itself.

Checking Post Install

Once you have run through the install, and come to the end, you might want to look at what has changed in your config file.

You can dump the file with the following command:

# virsh dump test > vm-config-new

Opening ‘vm-config-new’ will show you your previously written config, but new parts will have been added, such as ‘uuid’ and ‘video’ among others.

Posted in Linux, Virtualization | Tagged , , , , , , , | Leave a comment

An Introduction to systemd

 What is systemd?

Systemd (Stylized ‘systemd’) is process one on Linux distributions that have selected it as their default init system. It is designed specifically with the Linux kernel API in mind.

Being a replacement for SysVinit (the previous init system inherited from UNIX System V and BSD,) and the first process executed in user space, systemd is extremely important.

Currently systemd is not the default in many systems, but the number of adopters is growing, and soon server OSs such as Debian and RHEL will be using it. At present you would find systemd in default installs of the below, to name a few:

  • Fedora
  • Arch
  • CoreOS

Using systemd

systemd is vastly different in terms of the commands that you might use on a day to day basis. As a result of this I am going to list some common changes below.

All of this testing was performed on an Arch system, so your mileage may vary.

Services

On older systems, you might use commands similar to the following when working with services:

# /etc/init.d/ntpd start
# service ntpd start
# chkconfig ntpd on

 

On systemd systems, your commands will be slightly different.

Starting and Stopping

To start a service, you would use the following:

# systemctl start ntpd

 

To stop a service, the opposite:

# systemctl stop ntpd

 

Enabling and Disabling

Obviously starting and stopping services is good, but what if we want to start them at boot?

# systemctl enable ntpd

 

This command actually runs the following:

# ln -s '/usr/lib/systemd/system/ntpd.service' '/etc/systemd/system/multi-user.target.wants/ntpd.service'

 

To disable you would use:

# systemctl disable ntpd

 

Again, this is a link to:

# rm '/etc/systemd/system/multi-user.target.wants/ntpd.service'

 

Working with Logging

While you can, and a lot of people do, simply install syslog to most systemd systems it is recommended that you learn to use the tool ‘journalctl’ to manage and view logs.

Viewing Logs

If you want to view all of your logs, then the following command will work, but might be verbose:

# journatlctl

 

If you wanted to view from only a specific date, you could use:

# journalctl --since="2014-05-07"

 

Specifically kernel logs? That’s easy too:

# journalctl -k

 

Or maybe you want to follow the log, as it logs!

# journalctl -f

 

But hang on a moment, you know the exact PID that you want to look at, how brilliant are you?! (The PID selected here is systemd.)

# journalctl _PID=1

 

What’s that? You don’t know the PID? But you know the unit name? No problem!

# journatlctl -u sshd

 

Still not enough information? Get more verbosity!

# journalctl -x

 

Working with Networking

Let’s say you need to add an IP to a host, because it’s brand new and doesn’t have anything yet. Thankfully, you’re stood in front of it at a prompt

What do you do?

Adding a Static IP Addresses

For this we’re going to use a file, as it’s fairly easy.

# cd /etc/netctl
# touch eth0

 

Once we’ve created the file, we will add the following using our favourite editor (vim,) to configure an IPv4 address:

Description='Our primary connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('192.168.6.10/24')
Gateway='192.168.6.1'
DNS=('8.8.8.8')

 

We can start this interface with the ‘netctl’ command:

# netctl start eth0

 

And again, enable it in a similar way:

# netctl enable eth0

 

Adding a Dynamic IP Address

Maybe you’re at home, and your systemd box is something like XBMC? Maybe you don’t need a static address, and dynamic is fine. Well there’s good news, you would populate your ‘eth0′ file with something like this:

Description='Our DHCP Interface'
Interface=eth0
Connection=ethernet
IP=dhcp

 

That’s much shorter, and it uses the same ‘netctl’ commands to start and enable!

Using New Tools

Managing your Hostname

This sort of management is done by the command ‘hostnamectl’ such as:

# hostnamectl status

 

If you wanted to set your hostname, it couldn’t be simpler:

# hostnamectl set-hostname pi.dmcip.com

 

This will also persist across reboots!

Managing Time

Something we’d all like to be able to do…

# timedatectl status

 

This will give you a slew of facts, similar to the below:

      Local time: Wed 2014-05-07 06:49:36 MDT
  Universal time: Wed 2014-05-07 12:49:36 UTC
        RTC time: n/a
       Time zone: America/Denver (MDT, -0600)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2014-03-09 01:59:59 MST
                  Sun 2014-03-09 03:00:00 MDT
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2014-11-02 01:59:59 MDT
                  Sun 2014-11-02 01:00:00 MST

 

Obviously this happens to be completely wrong, so let’s fix it!

We first need to find out the timezones available to us:

# timedatectl list-timezones

 

When we have the one we know is right, we use the following:

# timedatectl set-timezone Europe/London

 

Run date again, or timedatectl status, and you will see your changes!

Posted in Linux | Tagged , , , , , , , , , , , | Leave a comment

Custom ring tones on the GXP 1450 / 2100

GXP 1450

Previous models of Grandstream IP phones (namely GXP 1200 / 2000 / 2010 & 2020) allowed Asterisk to select which ring tone to use by sending the Alert-Info SIP Header. This was done from the Asterisk dialplan using the SIPAddHeader application;

exten => s,n,Set(ALERT_INFO=Alert-Info:\;info=r2)
exten => s,n,SIPAddHeader(${ALERT_INFO})

… where r2 is the value of the ‘Distinctive Ring Tone; Custom ring tone 2, used if incoming caller ID is’ setting in the Advanced Settings page of the Web GUI.

However, the new range of GXP phones (i.e. 1450 / 2100) do not ring if the Alert-Info SIP Header is sent as above. We assume that this is a bug or intolerance in the SIP stack on the phone as the SIP INVITE from Asterisk to the phone that contains the custom header is never acknowledged. The solution is to format the Alert-Info header as follows;

Alert-Info: \;info=r2

For example;

exten => s,n,Set(ALERT_INFO=Alert-Info: <sip://127.0.0.1>\;info=r2)
exten => s,n,SIPAddHeader(${ALERT_INFO})

The good news is that the new format appears to work on the old models although you may need to upgrade the firmware on the new model range to version 1.0.1.66.

Posted in Asterisk, Grandstream | Leave a comment

HOWTO compile and install DAHDI 2.3 with OSLEC enabled

One common issue that persists through all telecoms related business is echo.

In the early days of the telephone, telecoms companies spent a lot of money going to great lengths trying to find a solution to the problem which occurred frequently when the traditional telephone network was first deployed.

We have to deal with this issue fairly frequently during consultancy on customer sites with their Asterisk PBX’s.

The issue almost always occurs with calls over PSTN/ISDN hardware and rarely appears to affect VoIP (probably due to upstream trunking providers use of echo cancellation software).

There are several approaches we can take:

  • We can enable DAHDI’s echo cancellation (“mg2″) and tweak various settings to try and make it work.
  • We can pay serious money to Digium et al. for a hardware module that will cancel the echo on the card itself.
  • We can compile DAHDI with OSLEC.

OSLECOpen Source Line Echo Canceller – is pretty much what it says on the tin. It’s an echo canceller, written by the legendary David Rowe which is far superior to other open source line echo cancellors. Unfortunately, as one of Digium’s revenue streams is the sale of hardware echo cancellation modules, getting it working feels like a bit of a hack and isn’t fantastically documented.

I thought we’d share how we did it…

Firstly, the guys at BSM Development deserve a pat on the back – their article on OSLEC is what got us going and really helped us get it up and working.

First we switch to our source directory:
dmc-pbx:~# cd /usr/src/
Let’s now download BSM Development’s lovely dahdi-oslec tar.gz with the modification you need to make to the plain DADHI source:

dmc-pbx:/usr/src# wget -c http://www.bsmdev.com/Downloads/dahdi-linux-oslec-2.3.0.1+2.3.0.tar.gz

Let’s now download the complete dahdi-linux tar.gz from Digium
dmc-pbx:/usr/src# wget -c http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.3.0.1+2.3.0.tar.gz
Untar everything:
dmc-pbx:/usr/src# tar xvf dahdi-linux-complete-2.3.0.1+2.3.0.tar.gz
dmc-pbx:/usr/src# tar xvf dahdi-linux-oslec-2.3.0.1+2.3.0.tar.gz

Now lets just copy the OSLEC source into the correct part of the DAHDI source
dmc-pbx:/usr/src# cp dahdi-linux-oslec-2.3.0.1+2.3.0/* dahdi-linux-complete-2.3.0.1+2.3.0/linux/drivers/dahdi

From here you need to edit one line in this file:
dmc-pbx:/usr/src# sensible-editor /usr/src/dahdi-linux-complete-2.3.0.1+2.3.0/linux/drivers/dahdi/Kbuild

Search for OSLEC. Uncomment, the first line that mentions it, save and exit.

Now just change the root of the source package…
dmc-pbx:/usr/src# cd dahdi-linux-complete-2.3.0.1+2.3.0
…and compile, install and install startup scripts:
dmc-pbx:/usr/src/dahdi-linux-complete-2.3.0.1+2.3.0# make all;make
install;make config

then reboot
dmc-pbx:~# reboot

When it’s back up, run
dmc-pbx:~# dahdi_cfg -v
to configure the dahdi interface

and then
dmc-pbx:~# sensible-editor /etc/dahdi/system.conf
and replace any mentions of “mg2″ with “oslec”.

After that you just need to restart dahdi
dmc-pbx:~# /etc/init.d/dahdi restart
and there you have it; a working OSLEC installation!

Fire up Asterisk and you are away and can start enjoying great quality echo cancellation without expensive hardware!

Do feel free to let us know how you get on in the comments! :)

Posted in Asterisk, Open Source | Tagged , , , , | 1 Comment

*CS: An Asterisk Call Server for business

Since 2006, DMC have been providing Asterisk based telephone systems to businesses of all shapes and sizes across the United Kingdom and European Union.

Over the last 2 years, we have developed *CS, a complete business telephone system that comprises an optimised Web GUI (Graphical User Interface) and dialplan.

The *CS dialplan embraces the best features of the Asterisk open source PBX and other complementary tools and technologies. The simplified multi-role GUI allows system administrators, supervisors and end-users to easily configure and manage the system and access call details and recordings.

A suite of CTI (Computer Telephony Integration) software tools enhance the solution further making *CS a complete telephone system for the SoHo, SME and Enterprise market.

Fully featured PBX

*CS is a fully featured PBX system that is not limited by user or line licences. The following features are available as standard;

  • ACD (Automatic Call Distribution)
  • Call Queues and Ring Groups
  • Caller Display / Alpha tagging
  • Music or Information-on-hold
  • Call Recording
  • Live call monitoring or snooping
  • Voice Mail
  • IVR (Interactive Voice Responders)
  • Conference Bridging

Lines and Numbers

* CS can connect to any type of Trunk Line whether it’s POTS, ISDN, VoIP, GSM or even Skype. Least Cost Routing ensures that outbound calls are routed over the lowest cost trunk line (e.g. international calls over VoIP, mobile calls over GSM).

We can provide Telephone Numbers for any geographic area code and non-georaphic and toll-free numbers. Numbers may be Ported from BT or Virgin Media to a VoIP service provider if your business moves away for the local exchange or simply wants to benefit from lower cost line rentals.

DDI numbers may be configured to route calls directly to Agent’s desk phones or to different Ring Groups and Queues.

Hot desking

Users may log in to any telephone handset or softphone with their unique extension number and secret PIN. Their incoming direct calls, voicemail and calls to queues or ring groups that they are a member of, will follow them wherever they are.

Call detail records (CDR’s) for calls they make or receive are attributed to their user account regardless of the telephone handset they are logged into.

Daily stats report

A comprehensive daily report of Key Performance Indicators (KPI) and usage statistics may be e-mailed to an administrator or manager.

Call recording and playback

All calls or calls from selected agents may be recorded on the server. An intuitive click-to-listen feature allows users to find personal call recordings through their web browser and play them back on their telephone handset.

Supervisors may be given extended access to this feature so they are able to review call recordings from a group of users.

Users and Supervisors may add notes and tags to call recordings so they may be easily retrieved at a later date.

Supervisor module

Supervisors may listen in, undetected, to live telephone calls from the GUI. A Whisper mode allows supervisors to whisper instructions or hints to an Agent as they handle a call. This feature is ideal for training new telephone operators.

Advanced management

*CS includes an optimised GUI for User, endpoint and queue management including the following features;

  • Bulk update of users, queues, incoming numbers and SIP accounts.
  • Check Queue / Ring group membership from the User profile page and dynamically add users to queues.
  • Endpoint Manager with customisable templates.

Contacts database

*CS can automatically log every number that called or was called to a central contacts database. The numbers may then be associated with a contact name, company name or third party data source so next time they call relevant information about the caller may be displayed on the telephone screen.

From the contacts database, numbers may be blacklisted or given higher or lower priority in the call queues.

The contacts database may also be used for click2dial.

Scalability and High Availability

*CS is available as an onsite PBX system or as a hosted service. The entire solution is scalable and will grow or shrink as your business changes.

Resillience and Redundancy may be built into the system to ensure a High Availablility service.

Further Information

For further information about *CS, please call 0161 850 4001 or e-mail sales at dmcip.com.

Posted in *CS, Asterisk | 1 Comment

DMC enters the Blogosphere

Re-entry

Since 2006, DMC have been providing open source communications solutions
to businesses across the UK and Europe and pioneering VoIP telephony so
we have always been at the leading edge of technology.

One thing that we didn’t get round to, at least until now, is blogging
about our endeavours in the Digital World.

So, here goes.

This blog will contain posts about our company – DMC, Asterisk, VoIP,
Open Source and other related topics. If you would like to receive
updates to the blog, then please follow our twitter account @dmcip.

Posted in About | Leave a comment