Categories
Knowledge Base Technical

Installing Webdav on Centos with untrusted ssl certificates

Webdav (Web-based Distributed Authoring and Versioning) is a set of methods based on the Hypertext Transfer Protocol (HTTP) that facilitates collaboration between users in editing and managing documents and files stored on World Wide Web servers.This can be useful to allow backing up of data between servers. In Linux there is a command line client called cadaver that in theory allows you to script its use.

This isnt as staight forward as it could have been and we spent half a day and a lot of Googling to get to the bottom of common problems, Such as auto loging in, Untrusted ssl certificates and scripting.

So here is a simple run down on what you have to do to script with webdav and cadaver

Install cadaver

yum install cadaver

once installed you will need to install the certificate for the untrusted ssl site

for example
wget http://website/untrusted.server.com.cer
now convert this to a .pem file
openssl x509 -inform der -in untrusted.server.com.cer -out untrusted.server.com.pem

now add this to your cert.pem file.

in centos this seems to be in the  /usr/share/ssl/ directory
cat untrusted.server.com.pem >> /usr/share/ssl/cert.pem

you now need to edit the ./netrc file with the server and logon details
vi ~/.netrc

machine untrusted.server.com
login   user
password        secret

save the file.

now when you connect you wont be promted for accepting the certificate or a username and password

cadaver -et  https://untrusted.server.com
dav:/>

Ok now we want to script the actions.
This is as simple as creating a script file.

for example

vi ~/.cadavscript
ls
pwd
quit

will give the following output

cadaver -et  https://untrusted.server.com/ < ~/.cadavscript
dav:/> Listing collection `/’: succeeded.
test.txt                              35  Aug 19 15:04
dav:/> Current collection is `https://untrusted.server.com/’.
dav:/> Connection to `untrusted.server.com’ closed.

So create a script to do what you want and your done

Categories
Knowledge Base

Asterisk Music on Hold

Music on hold is always an issue, We get asked many times “can we put such and such mp3 on as hold music” Well the answer is always the same, Yes and no.

Yes in that we can convert any mp3 to be played as MOH as long as you have the relevent PRS licence.

So the answer is then normaly No we wont do it then, Just look at the costs detailed here and you will see why.

So why are we mentioning it here.

Well Asterisk has Music files loaded for MOH and it was always assumed these were licenced correctly and required no additional licence or agreement. Well it seems that some countries are challenging this.

See the following from Digium..

Open Source Asterisk has had for quite some time the ability to play Music On Hold (MOH) to callers as an optionally configured call feature.  Of course, as soon as the code had the ability to play music, there was a general request and obvious concept that Asterisk should include a few default music-on-hold files.  At that point, several people within Digium looked around at the possible files we could use, but all of them had some type of license issues, which is understandable.  We found a company which sold rights to music, and we discussed in specific, painstaking detail what we wanted to do with the files and how they were going to be used.  They agreed that we could do what we wanted and distribute the files with Asterisk and that they were able to provide to us the appropriate license, so we paid our fee and proceeded to pick some likely music.  We then included them in Asterisk in the hopes that the community would find them useful as part of the system without having to search out selections which complied with various copyright issues.  This was a good-faith gesture on our part, and we had a quite reasonable expectation that the vendor from whom we purchased the license was authorized to provide to us a global right-to-use and redistribution capability to the Asterisk community for these sound files.

Apparently, that assumption is now being questioned.  In some nations (Australia and France, to pick two that have been brought to our attention) there are some who are claiming that we do not have the rights outlined above, and that our users therefore are in a similar situation where they may be in violation of license terms.

In the interests of space here I will not outline the exact organizations, laws, and claims in question.  Suffice it to say they are complex and unclear with a broad range of possible interpretations. Currently, at least two organizations disagree that we are complying with a set of license terms.  This is very far outside of Digium’s ability or interest to manage, nor do we wish to become involved in the protracted series of legal proceedings required to sort out this licensing issue.  So we have chosen another path that is more clear to us: we will eliminate the files of questionable license from Asterisk, and replace them with music that has  clearly defined and more acceptable licensing terms which are compatible with both the Asterisk license, and with any reasonable redistribution methods that might be used by others who re-package Asterisk.

So how can we be assured this won’t happen again?  The new music we’ve included is under the Creative Commons 2.5 license – which quite frankly didn’t have much of a following for media back when we first were looking for a set of MOH files.  Certainly, the selection of good-quality music files that would suffice did not exist in an easy-to-obtain fashion, or we would have gone this route in the first place.  Hopefully you’ll like the new music on hold, and will be customers of the artists who have so graciously given their work out under such a reasonable license.   We found the new music on Opsound for those of you who are looking for an even wider selection of freely available music.

We apologize for putting people through this aggravation – we sincerely wish that the recording industry would standardize license terms and avoid treating customers like enemies.  Perhaps there is a silver lining here –  this may be a good opportunity for you to freshen up your hold music – maybe “Calm River” was getting under people’s skin after the thousandth time you put them on hold.

The Gory Tech Details:

The new files can be found here: http://downloads.asterisk.org/pub/telephony/sounds/

The new files have names that contain “opsound” replacing the term “freeplay” in the file names.  It’s really that simple.  We’ve removed the old “freeplay” files and symlinked the old names to the new “opsound” versions, just in case.  The contents of the .tar archives are different, but Asterisk should “just work” when the file contents are put in place unless you’ve extensively modified your music on hold configurations.

If you have an existing Asterisk system it is our suggestion that you delete any and all copies of the existing “freeplay” music on hold set on your system(s) and replace them with the new “opsound” module sets.  The good news is that this is very simple – very little configuration is required on your system – just a simple file copy and then restart Asterisk to see the new files.

What happens if you don’t update your music on hold?  The state of the FreePlay license currently is in question, and even if it is determined that the Freeplay files were not provided under the necessary license terms,  it’s unlikely that enforcement actions will be brought against end-users for using unlicensed hold music.  However, we would encourage all administrators to update their instances of Asterisk to the new sound files.  This is really a distasteful process for all of us, and in order to protect ourselves from any future liability we’re going to suggest that everyone remove the older files entirely.

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