Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

miércoles, 8 de junio de 2016

Setting up the CISCO 7940 with SIP/Asterisk

Introduction

This is another guide that was born out of extreem frustration. After spending weeks trying to get my CISCO 7940g to work with Asterisk, I decided to document the event for future generations.

The phones can be picked up cheap on eBay and also work nicely with Asterisk after some fiddling. However, there are a few points to bear in mind:

  • The phones are designed for enterprise VoIP deployments. If you buy one they are unlikely to come with a power supply as they expect to be deploying into a PoE environment. You can either buy a 48V PSU for the phone although it's probably cheaper to get a standard PoE injector. Also the phones rely upon infrastructure. To get the phones working it needs to get files from a TFTP server. You also need a web server to serve things like custom logos and a phone directory if you want to use those features.
  • The phones are designed to work with CISCO Call Manager and use the SCCP protocol rather than SIP. Asterisk has support for SCCP though it's said that you are better off using SIP. CISCO do a SIP firmware for the 7940g. This requires you to upgrade to a new firmware.

  • Rebooting the phone

    The first thing you probably want to know is how to reboot the phone. Hold down "*", "6" and "settings". The settings button is the bottom right of the group of four buttons around a circular, green question mark button. It has a box with a tick in it on the button.

    Upgrading to SIP firmware

    I don't want to cover this in too much detail as it's repeatadly documented all over the Internet. There are a few points to bear in mind:

  • The firmware is upgraded using config files and firmware images on the TFTP server. This process and the files used changes from version to version. Also you cannot directly upgrade from old firmware to the latest firmware. Version 6.3 is a significan release and I think you need to go to one of the 7 releases before you can upgrade to version 8.
  • Also please be aware that you have to download the firmware files from CISCO and for this you require a CISCO login. You can get this by putting the phone on CISCO support for about $40 a year.
  • Beat in mind that you need to downloadn the SIP firmware not the SCCP firmwar!
  • There have been many reports of not being able to get 8.10 to boot. I certinaly can't and decided to use 8.9 instead

  • Configuring the phone to connect to Asterisk or another SIP provider

    Let's start by assuming that you have managed to get a firmware upgrade to the lastest version of the SIP firmware. Now you need to configure the phone. When the phone boots, it downloads the firmware from the TFTP server and also pulls down some config files. You need the following files on the TFTP server (assuming you are using 8.9):
  • P0S3-08-9-00.loads
  • P0S3-08-9-00.sb2
  • P003-08-9-00.bin
  • P003-08-9-00.sbn
  • SIPDefault.cnf
  • SIP<mac>.cnf
  • There are two configuration files to use. SIPDefault contains settings that apply to all phones. SIP<mac>.cnf contains settings that apply to a single phone, indentified by MAC address. The following is an example of the minimal configuration needed to get the phone to register to either Asterisk or another SIP provider:

    SIPDefault.cnf

    #image_version shows the firmware image to get from the TFTP server. Note this shouls start P0S and not P00.
    image_version: P0S3-08-9-00

    #Proxy server address should probably be more accuratly be called the SIP server
    proxy1_address: x.x.x.x
    #proxy_register tell it to connect to the SIP server (why would you want to set this to 0?!
    proxy_register: 1

    SIP<MAC>.cnf

    #The following lines contain the authenication details
    line1_name: line1
    line1_authname: "line1"
    line1_displayname: "line1"
    line1_password: "supersecret"

    So now you should be able to boot your phone and make and receive calls. Good for you!

    Setting the time

    This is a bit of a mission. You set the NTP server and timezone but also have to set the details of when Daylight Saving Time starts and finishes. Fortunatly the rules are available here and it seems that DST is stardardised across the EU. The following example goes in SIPDefault.cnf and should get you going for the UK. Change the time zone for Europe. Change something else for the rest of the world
    sntp_server: "pool.ntp.orgt"
    sntp_mode: unicast
    time_zone: GMT
    dst_offset: 1
    dst_start_month: March
    dst_start_day_of_week: Sun
    dst_start_week_of_month: 8
    dst_start_time: 01
    dst_stop_month: Oct
    dst_stop_day_of_week: Sun
    dst_stop_week_of_month: 8
    dst_stop_time: 02
    dst_auto_adjust: 1
    time_format_24hr: 1
    date_format : D/M/Y

    Phone directory

    The CISCO phone directory is stored in an XML file that can hold 32 numbers. You can either get the phone directory XML file directly or use a form to send a search criteria to a script that returns matching results. Firstly you have to assign a button to the phone directory. There are various programmable buttons on the phone that you could use but since one is marked "directory" it makes sense to use that. First you add an entry to the SIPDefault.cnf, telling it what to do when the directory button is pressed. In the example below, pressing the button will GET directory.xml via HTTP:

    SIPDefault.cnf

    #The directory_url contains a URL to the directory XML file
    directory_url: "http://www.example.com/directory.xml"

    directory.xml could just contain a phonebook in XML, like the example directory file below. This is fine if you don't want to search and don't have more than 32 entries. If you do, you have to do things a little differently. You can add the following to directory.xml:
    <CiscoIPPhoneInput>
        <Title>Phone book</Title>
        <Prompt>Prompt text.</Prompt>
        <URL>http://www.example.com/phonebook.pl</URL>
        <InputItem>
                <DisplayName>search</DisplayName>
                <QueryStringParam>search</QueryStringParam>
                <InputFlags></InputFlags>
                <DefaultValue></DefaultValue>
        </InputItem>
    </CiscoIPPhoneInput>
        
    Now, when you press the directory button, you will be presented with a search screen. You can enter a name and press search. It will then try to GET /phonebook.pl?search=name from the HTTP server. Thus you will have to write a script that searches for the string in your phone directory and returns the results using the CISCO XML format below. This is obviously a lot more work but hey, these are enterprise phones!

    Example directory file

    <CiscoIPPhoneDirectory>
    <Title>Directory</Title>
    <Prompt>Who you gonna call?</Prompt>
    <DirectoryEntry>
         <Name>Tom</Name>
         <Telephone>6905</Telephone>
    </DirectoryEntry>
    <DirectoryEntry>
         <Name>Dick</Name>
         <Telephone>6906</Telephone>
    </DirectoryEntry>
    </CiscoIPPhoneDirectory>
        

    Voicemail number

    The 7940 has a voicemail button that dials your viocemail. Sound clever? It's just a config directive that tells it which number to dial when thebutton is pressed. Add the following to your SIPDefault.cnf:messages_uri: "8500"
    So, when you hit the message button it dials 8500, which, as we all know is the default main voicemail number for Asterisk. We can also go a step further and create a number that dials the voice mail. Change the number in the mesasges_uri to 8501 and create the following extention in extentionss.conf:
    exten => 8501,1,VoicemailMain(${CALLERID(number)})
    exten => 8501,n,Hangup

    This means that when you press the message button it will dial 8501 which Asterisk will call voicemail and pass the number of your phone to the Voicemail. This will go stagiht to that mailbox number without having to enter it. If the voicemail box for that phone does not match the phone's callerID num, you could pass it statically, of course.

    Message Waiting Indicator

    Asterisk can turn on and off the Message Waiting Indicator on phones. This is simply a case of adding "mailbox " to the phone definition in the sip.conf file. Then, when there is a new message in that mailbox, it will turn on the MWI on the phone. When there is no voicemail it will be turned off.

    No hay comentarios:

    Publicar un comentario