University Peering Program

Connect your University to the SIPphone network

Hardware for your Asterisk server

Hardware Used Vendor Source Cost
Linux PC or Server Any sub300.com $300 - $1000
T1 PCI Card Digium (or equivalent) digium.com $500
RedHat OS 9.0 RedHat redhat.com $0
PRI Cable (straight) Any Internal $0
  $800 - $1500

Configuring Asterisk

Following is a "walk-thru" of the steps we took to complete the installation. One should be able to replicate our installation by following these steps.

  1. Download the Asterisk source code from asterisk.org. Installation instructions are also available at asterisk.org, although installation is typically as simple as:

    shell > cd zaptel
    shell > make clean; make install
    shell > cd ../libpri
    shell > make clean; make install
    shell > cd ../asterisk
    shell > make clean; make install
    shell > make samples

  2. Edit the file /etc/zaptel.conf and replace it's contents with the following:

    span=1,1,0,esf,b8zs
    bchan=1-23
    dchan=24
    loadzone=us
    defaultzone=us

    Of the five comma-separated span parameters, any of the last four may need to be changed, depending on the settings of the PBX to which the T1 card is connected:

    Note: The first span parameter indicates that this definition is for our first (and only in this case) T1 card. If we had Additional cards we would have a separate line entry in the config file for each. For example, a second E1 PCI card entry would look something like this:

    span=2,1,0,esf,b8zs
    bchan=1-31
    dchan=32
    loadzone=us
    defaultzone=us

    The second span setting indicates a timing value of 1 specifies that this card should be considered a primary sync source.

    The third span setting indicates the line build-out value of 0 represents the physical length of the cable connecting the T1 card to the PBX. See /etc/zaptel.conf.default for options.

    The fourth span setting indicates the framing parameter must be set to either "d4" or "esf".

    The last span setting indicates the coding parameter must be set to either "ami" or "b8zs".

  3. Edit the file /etc/asterisk/zapata.conf and replace it's contents with the following:

    [channels]

    ; ---- caller ID options ---
    usecallerid=yes
    hidecallerid=no
    callwaitingcallerid=yes

    ; --- audio quality tuning options ---
    echocancel=yes
    echocancelwhenbridged=yes
    rxgain=0.0
    txgain=0.0

    ; --- PRI interface options ---
    switchtype=national
    context=md110-to-sipphone
    signalling=pri_cpe
    group=2
    channel => 1-23

    The switchtype and signalling parameters may need to be modified, depending on the settings of the PBX to which the T1 card is connected. Options are documented in /etc/asterisk/zapata.conf.default.

    The context parameter is an arbitrary string that may be changed, but it's value must havematch the a corresponding entry in /etc/asterisk/extensions.conf.

    The group parameter is an arbitrary integer that may be changed, but it's value must correspond match with the device name (e.g. "Zap/g2") in /etc/asterisk/extensions.conf.

  4. Edit the file /etc/asterisk/sip.conf and replace it's contents with the following:

    [general]
    port=5060
    bindaddr=0.0.0.0
    disallow=all
    allow=ulaw
    allow=alaw
    allow=gsm

    [sipphone]
    type=peer
    host=proxy01.sipphone.com
    context=sipphone-to-md110

    The general section defines how asterisk will accept SIP traffic: bind to any available NIC, listen on port 5060, and allow only certain voice codecs.

    The sipphone section defines a peer from which asterisk will accept SIP INVITES and, by means of the context, what to do with calls that arrive from that peer. The context is in arbitrary string that must correlate with a section of the same name in /etc/asterisk/extensions.conf. Change the host name as necessary to reflect the name of the peer's SIP router.

  5. Edit the file /etc/asterisk/extensions.conf and replace it's contents with the following:

    [general]
    static=yes
    writeprotect=yes

    [globals]
    MD110=Zap/g2

    [sipphone-to-md110]
    exten => _1858.,1,Dial(${MD110}/${EXTEN:6})
    exten => _1858.,2,Playback(notavail)
    exten => _1858.,3,Busy

    [md110-to-sipphone]
    exten => _1747.,1,Dial(SIP/${EXTEN}@sipphone)
    exten => _1747.,2,Playback(notavail)
    exten => _1747.,3,Busy
    exten => _1222.,1,Dial(SIP/${EXTEN}@sipphone)
    exten => _1222.,2,Playback(notavail)
    exten => _1222.,3,Busy

    In this file we have two contexts, sipphone-to-md110 and md110-to-sipphone. These names correspond with values in sip.conf and zapata.conf, respectively. The purpose of these contexts, and thus this file, is to define what asterisk should do (i.e. where to route) incoming and outgoing calls.

    The logic here is: when a SIP call arrives (within the parameters defined in sip.conf), if the dialed number matches "1858", send the last six five digits of that number (${EXTEN:6}) to the Zap/g2 device. The group number ("g2") in the device name is the "glue" that connects this context with the interface definition in zapata.conf ("group=2").

    Similarly, when a call arrives from the T1 interface, if the dialed number matches "1747", use the SIP protocol to send the call to the sipphone peer (as defined in sip.conf). "1222" refers to SIPphone's 1-222-XXX-XXXX free dynamic conference server.

    Change the extension matching in each context to match your environment.

  6. Edit the file /etc/asterisk/rtp.conf and replace it's contents with the following:

    [general]
    rtpstart=10000
    rtpend=10100

    This file simply defines the ports for asterisk to use for RTP traffic. Be sure that your local network accepts UDP traffic on this port range. It is necessary to make available at least two ports per channel (a T1 has 23 channels).

  7. Add a routing rule to your peer's SIP router that will forward appropriate traffic to the asterisk server. We use iptel.org's SER, so we added these lines to our ser.cfg (actual IP address replaced with x.x.x.x):

    if (uri=~"^sip:1858534.*") {
    rewritehostport("x.x.x.x:5060");
    append_hf("P-hint: UCSD Routing\r\n");
    route(1);
    break;
    };

→ Proceed to Starting Asterisk

VM Rover Voicemail Client Mvox Virtual Numbers