Friday, November 19, 2010

Install ASterisk GUI

Install Asterisk-GUI

1.Download and Install subversion

http://software.opensuse.org/search?baseproject=ALL&p=1&q=subversion

Excerpt from the INSTALL documentation in downloaded subversion package

Building from a Tarball or RPM

------------------------------

Download the most recent distribution tarball from:

http://subversion.tigris.org/servlets/ProjectDocumentList

Unpack it, and use the standard GNU procedure to compile:

$ ./configure

$ make

# make install

You can also run the full test suite by running 'make check'.

[ SVN takes long time to install]

2. Download and Install Asterisk

Download asterisk from www.asterisk.org

RESOLVE THE DEPENDENCIES

STEP 1: (DAHDI dependency)

Install ncurses and ncurses-devel

(ncurses is the library providing API for the programmer to create the GUI like interface in Terminal mode)

OR

Install slang and slang-devel

(library for Display control)

STEP 2: (DAHDI dependency)

Install libnewt and newt_devel

(shared libraries for Nifty Erik's Windowing Toolkit; Newt is a toolkit that allows applications that run on the console (so called "text mode applications") to use many of the graphical interface widgets, such as radio buttons and selection boxes, that are popular in GUI environments https://launchpad.net/newt)

STEP 3: (Dependency for DUNDi)

Install open-ssl and openssl-devel

(openssl creates secure sockets and transport layer security.

STEP 4:

Install popt and popt-devel

(C library for parsing command line parameters)

INSTALL libpri (make, make install)

INSTALL dahdi (make, make install, make config)

INSTALL addons (./configure, make)

INSTALL asterisk (./configure , make, make menuselect, make install)

3. Download Asterisk-GUI

Go to /usr/src and create a directory asterisk-gui

Run the command

#svn checkout http://svn.digium.com/svn/asterisk-gui/branches/2.0

(it will download the latest Asterisk-GUI. If not, then it will provide the README file with the latest link to download the Asterisk GUI using svn checkout)

  1. Install Asterisk-GUI

[Note: you don’t need Apache server to be running]

It’s easy if you know what you are doing.

Make a backup copy of your asterisk files

#cp –r /etc/asterisk /etc/asterisk-backup


Go to /etc/asterisk and create two files http.conf and manager.conf

vi /etc/asterisk/http.conf

[general]

enabled = yes

enablestatic = yes

bindaddr = 0.0.0.0

bindport = 8088

prefix = asterisk

vi /etc/asterisk/manager.conf

[general]

enabled = yes

webenabled = yes

bindaddr = 0.0.0.0

port = 5038

[administrator]

secret = 1234abc

permit = 0.0.0.0/0.0.0.0

read = system,call,log,verbose,command,agent,user,config

write = system,call,log,verbose,command,agent,user,config,originate

Go to /usr/src/asterisk-gui [the location where you downloaded Asterisk-GUI]

./configure

make

make install

make checkconfig


Go to asterisk console and restart the asterisk

# asterisk

#asterisk –rv

CLI> core restart now

#asterisk –rv

CLI>http show status

HTTP Server Status:

Prefix: /asterisk

Server Enabled and Bound to 0.0.0.0:8088

Enabled URI's:

/asterisk/httpstatus => Asterisk HTTP General Status

/asterisk/phoneprov/... => Asterisk HTTP Phone Provisioning Tool

/asterisk/manager => HTML Manager Event Interface

/asterisk/rawman => Raw HTTP Manager Event Interface

/asterisk/static/... => Asterisk HTTP Static Delivery

/asterisk/mxml => XML Manager Event Interface

Enabled Redirects:

None.

Go to the webpage

http://ServerIPAddress:8088/asterisk/static/config/cfgbasic.html

http://ServerIPAddress:8088/asterisk/static/config/cfgadvanced.html

http://ServerIPAddress:8088/asterisk/static/config/index.html

Monday, October 11, 2010

Boring but useful theory on SIP... How SIP works?

SIP is powerful precisely because it can be used to establish any kind
of session. Voice sessions are just one example.

SIP UA : interface for the users e.g IP phones, computer applications to make call

Redirect Servers: help locate SIP UA; it simply returns the list of the possible SIP UA addresses e.g BOB@university.com BOB@company.com

Proxy Servers: reduces the overload of the information and acknowledgment (look page 104 Sip Demystified)


Registrar/SIP server: It refers to both: Redirect and Proxy Servers


Location Servers: Most registrars upload location updates to a location
server upon receipt. SIP is not used between location servers and SIP servers. It uses LDAP to communicate with SIP servers

SIP clearly distinguishes between session establishment and session description. SIP
just provides connectivity; what users do with it is outside of the scope of
SIP.

SIP does not even assume that the session it has established will take place in the
Internet. For instance, if Bob wants to invite Laura to join a conference call
that is taking place in the public-switched telephone network (PSTN), all he
has to do is use SIP to deliver the telephone number that she can dial to join
in. In this example, the session description would contain a telephone number
instead of IP addresses and UDP ports. When SIP delivers the session
description to Laura, she reacts as she does to any kind of ping with the tool
she’s been given.

SIP provides just enough information for the invitee to accept the invitation

Servers that do notneed to monitor signalling for the duration of the session can handle a larger number of sessions.


when two user agents exchange SIP messages, the User Agent (UA) sending
requests is the User Agent Client (UAC) and the UA returning responses is
the User Agent Server (UAS). A SIP request, together with the responses it
triggers, is referred to as a SIP transaction.


SIP Responses
Upon reception of a request, a server issues one or several responses.
Range Response Class
100—199 Informational - Provisional Response
200—299 Success - Final Response of INVITE
300—399 Redirection
400—499 Client error
500—599 Server error
600—699 Global failure

SIP Requests
Every SIP request contains a field, called a
method, which denotes its purpose
INVITE
ACK
OPTIONS
BYE
CANCEL
REGISTER

Both requests and responses can contain SIP bodies. The body of a message
is its payload. SIP bodies usually consist of a session description

Example:

UA Client (Bob) called UA Server (Laura)

UA Client ----- invite------> UA Server
UA Client <-----180 Ringing-- UA Server (phone ringing)
UA Client <-----200 OK ------ UA Server (Off Hook/Recieve call)
UA Client ------ACK---------> UA Server
UA Client <---CONVERSATION--> UA Server

Three way handsake: INVITE-final response-ACK

ACK : ACKs are generated as final responses to an INVITE

Sending an ACK to every destination that has responded is essential to ensuring SIP operation over unreliable protocols such as UDP.

Errorneous case (taken care by ACK):

Bob would send an INVITE to Laura and retransmit it until it received
a final response from Laura. Until this final response is received, Bob cannot
know whether Laura received the INVITE or it got lost in the network.
Bob waits for a while and because he gets no answer, he gives up and
stops retransmitting the INVITE. Bob believes that no session has been
established.
At roughly the same time, Laura accepts Bob’s call and sends back a “200
OK” response. If this response gets lost, Bob will never receive it, so, Bob
still believes that no session has been established. Because Laura observes
that Bob has stopped retransmitting the INVITE, she assumes that Bob
has received her 200 OK. Therefore, Laura thinks that the session has been
successfully established
If a three-way handshake were in place for this scenario, Laura would
not receive an ACK for her 200 OK response, given that Bob gave up some
time ago. Thus, she would (correctly) think that the session was not established.



CANCEL

Let's say BOB called LAURA and waited for few rings and hangup as LAURA is not picking up the call

BOB -----------INVITE------------> LAURA
BOB <----------180 Ringing-------- LAURA (Phone ringing)

(Bob decided to hangup as he already waited for few rings)
BOB -----------CANCEL------------> LAURA
BOB <----------200 OK------------- LAURA (Reply back for CANCEL request)

BOB <--487 Transaction Cancelled-- LAURA (Reply for INVITE request)
BOB ------------ACK--------------> LAURA

CANCEL request is very useful when forking proxies are in the path. (pg 123)
Remember that a CANCEL request does not affect a transaction once a
final response has been sent.


BYE It is used to abandon sessions.

UA Client (Bob) called UA Server (Laura) and they started conversation. Then Laura went ON HOOK (Release the call)

UA Client ----- invite------> UA Server
UA Client <-----180 Ringing-- UA Server (phone ringing)

UA Client <-----200 OK ------ UA Server (Off Hook/Recieve call)
UA Client ------ACK---------> UA Server

UA Client <---CONVERSATION--> UA Server

UA Client <----- BYE -------- UA Server (abandon call)
UA Client -------200 OK-----> UA Server



REGISTER

BOB ---------REGISTER------> REGISTRAR
BOB <-------- 200 OK-------- REGISTRAR


OPTIONS
OPTIONS requests query a server about its capabilities.
One SIP server might answer to an OPTIONS request that it
supports SDP as session description protocol and five methods: INVITE,
ACK, CANCEL, BYE, and OPTIONS. Because the server does not support
the REGISTER method, I can deduce that it is not a registrar.

BOB ---------OPTIONS------> SIP SERVER
BOB <-------- 200 OK-------- SIP SERVER


Types of Proxy Servers

1. Call Stateful
2. Stateful
3. Stateless

1. Call Stateful
Call Stateful proxies need to be informed of all the SIP transactions that occur during the session and therefore, they are always in the path taken by SIP messages travelling between end users.

2. Stateful Proxy
Also known as Transaction Stateful Proxies because the transaction is their sole concern. e.g Forking Proxies

Proxy servers can only ACK non-successful final responses, which have a status code > 299

3. Stateless Proxy
Stateless proxes don't keep any state. They receive a request, forward it to the next hop, and immediately delete all state related to that request. It determines routing based solely on the Via header.


SIP uses text encoding as opposed to binary.

SIP is an application layer protocol.
By utilizing application layer time-outs with its retransmissions, an
application layer protocol can still exploit unreliable transport mechanisms (like UDP)

Thursday, September 23, 2010

Converting WAV file to Asterisk Audio file?

You can use SOX command in linux

# man sox

# sox NONasteriskXXX.wav -c 1 -r 8000 asteriskXXX.gsm

(it resamples the non asterisk audio file in single channel audio with 8Khz sampling frequency)

If you have tons of wav file, it's waste of time to type a command for every individual wav files. So, you can do the following

Let's say you have WAV files in /tmp/recordings directory.

/tmp/recordings# for i in *
> do
> sox $i -c 1 -r 8000 `echo $i|sed "s/.wav/.gsm/"`
> done

Ooola.. it's done!!! You just converted all the files in /tmp/recordings directory from WAV to gsm.

Here, we are using for loop to go thru' each files in the /tmp/recordings directory. '$i' returns the file name. 'sed "s/.wav/.gsm/"' renames the file from .wav to .gsm

Tuesday, September 14, 2010

Purge old voicemails and renumber/rename the voicemail files

1. Write the script to renumber the voicemail files. Why to renumber? (Test yourself: go to /var/spool/asterisk/voicemail/default/{VMbox}/INBOX ; say you have msg0000.xxx and msg0001.xxx, msg0003.xxx in your INBOX. Say you deleted msg00000.xx because it's older than 10 days. Now leave the voicemail message for that VMbox, the new message will appear as msg0000.xxx while it should be appeared as msg0003.xxx (in our case) so that while retrieving the message, older message would be played before the new message. Thus we have a problem. So, what is the solution?

When you delete the old files (say older then 10 days) you need to make sure that you rename the other files accordingly. In this case, after you delete msg0000.xxx (older than 10 days) , you need to rename msg0001.xxx to msg0000.xxx so that other new messages will appear in the appropriate order.

/root# vi renumber.sh

#!/bin/bash

function padder() {

case $1 in
"new")
case ${#new} in
1) newpad=000$new;;
2) newpad=00$new;;
esac;;

"old")
case ${#old} in
1)oldpad=000$old;;
2)oldpad=00$old;;
esac;;
esac

}

new=0
padder new
totalfiles=`find . -type f -name "msg.*txt"|wc -l`

for (( old=0; old<100; old+=1 )); do
padder old
if ( test -e msg$oldpad.txt); then
if ( test -e msg$newpad.txt); then
echo "file already exists";
else
for ext in txt WAV; do mv msg$oldpad.$ext msg$newpad.$ext; done
fi

let new+=1
padder new
if (( $new == $totalfiles )); then break; fi
fi

done




2. Now you have to write the script that can crawl through all of the VMbox and rename the voicemails appropriately.

/root #vi collect-and-rename.sh
#!/bin/bash

basedir=/var/spool/asterisk/voicemail/default

cd $basedir

echo $basedir

for str in `find . -type f -name "msg*.txt"`; do
maindir=`echo "$str"|awk -F/ '{print $2}'`

cd ./$maindir/INBOX
# echo `pwd`
bash /root/renumber.sh

cd $basedir

cd ./$maindir/Old
# echo `pwd`
bash /root/renumber.sh

cd $basedir
done

3. Script to delete files older than 10 days

/root # vi deleteOldVm.sh

#!/bin/bash

$dir=/var/spool/asterisk/voicemail/default
cd $dir
find . -type f -name msg????.??? -mtime +10 -exec -rm {} \;



http://www.oneharding.com/voip/asterisk_voicemail_scripts.html
http://djlab.com/2010/05/automatically-purge-old-voicemail-on-asteriskfreepbxtrixbox/
http://www.vectorsite.net/tsawk_2.html



Friday, August 27, 2010

Watchdog Script for the Linux Processes (Asterisk)

1. Create a script file. Let's say astSvcControl.sh at /root

#!/bin/bash
#script file: astSvcControl.sh

PROCESS="asterisk"

PROCCHK=$(ps aux|grep -c $PROCESS)
if [ $PROCCHK -eq 1 ]
then
/usr/sbin/asterisk
echo "Started Asterisk Service at $(date)" >> /var/log/asterisk/asterisk-check.log
else
echo "$PROCESS is running $PROCCHK processes" >> /var/log/asterisk/asterisk-check.log
fi

[Note: In SuSE linux, ps aux|grep -c < process name > returns 1 if the process is not running and returns 2 or more if the process is running
In SuSE linux, grep
< process name > also returns grep < process name > as one of the process, thus it always returns 1
But some flavors of linux, it returns 0 if the process is not running and returns 1 or more if the process is running
]
2. Make sure that script is executable

#chmod 770 astSvcControl.sh

3. Run the script periodically using cronjobs

#crontab -e
* * * * * bash /root/astSvcControl.sh

(run every minute)


If you want to run the script every 5 mintutes , do this

#crontab -e
*/5 * * * * bash /root/astSvcControl.sh



More on cronjobs for Linux/Unix:
http://www.cyberciti.biz/faq/disable-the-mail-alert-by-crontab-command/
http://kevin.vanzonneveld.net/techblog/article/schedule_tasks_on_linux_using_crontab/

Wednesday, August 11, 2010

Asterisk PRI Trunk Group customization - Top-Down/Bottom-Up Hunting

A glare condition is quite often issue, if the PRIs at PBX and CO is not configured properly for outbound/inbound calls to hunt the B channels.

You might be wondering, what the hell is 'a glare condition'?

A glare condition is the situation when the when a outbound call finds a clear channel and a new inbound call arrives at the very same instant, the inbound call wins, the outbound call gets "all circuts are busy"or vice versa.

So, how to fix it?

Let's say we have 23 channel PRI with D channel - 24. Telco is sending the inbound calls to hunt from channel 1 -> 23. So, I need to set outbound calls to hunt from channel 23 -> 1 to avoid the Channel Busy before ANY possibility of call collision.

How can I do that in Asterisk?

You specify which of four methods the Zap channel module is to use to select a non-busy channel from the channel group by prefixing the group number with one of the letters g, G, r, or R:
g: select the lowest-numbered non-busy Zap channel (aka. ascending sequential hunt group).
G: select the highest-numbered non-busy Zap channel (aka. descending sequential hunt group).
r: use a round-robin search, starting at the next highest channel than last time (aka. ascending rotary hunt group).
R: use a round-robin search, starting at the next lowest channel than last time (aka. descending rotary hunt group). [/color]

Create a new ZAP trunk and specify G0 as the trunk ID, go to your outbound routes. replace any routes calling for the trunk g0 and replace with new trunk G0. Go back and delete the g0 trunk so it will not be accidently selected as it is going to be the first trunk in the pull down list.

Wednesday, May 26, 2010

PRI/T1 having issues.... follow some of the checkpoints

[I am assuming that you know how to play with Asterisk]

A. Phyical Connection Issues

1. cabling

2. smart jack : It is the jack that can be used by Telco provider to do the loopback test remotely. With that said, it is not the mandatory device to put in the customer side, but Telco installs it on customer side so that they can do loopback test from their end remotely.

3. demarc : Telco line terminates to demarc of the customer primises.

Make a loop back plug. Simply take RJ-45 plug, loop a wire from pin1 to pin4 and another from pin2 to pin 5 and crip down the RJ-45.

If the circuit or the PRI/T1 card showing RED alarm, plug the loopback plug, if the circuit goes green then it says that hardware is good and configuration might also be good. But not 100% sure.
Plug the loopback plug on the smart jack to see if the Telco is having the issue. If the circuit goes green on the smart jack too, then jump to step B.

B. Protocol/signalling/configuration issues

1. Check if you are in sync on the physical layer - one of your T1 endpoints should provide clocking and another end should take clocking from the line

#/etc/zaptel.conf or /etc/dahdi/system.conf

span=<span num>,<clocking>,<LBO>,<framing>,<encoding>
e.g span=1,0,0,esf,b8zs

Here, clocking is set to 0 so it is using internal clock for clocking. So, it's configured like master clock source. The other end should be configured as slave for clocking ( i.e set second parameter to 1). If you are using T1 line from Telco provider, make sure that you set clocking to '0' as Telco is always configured as master for clocking.

esf,b8zs is widely accepted framing and encoding in North America.

2. Then, check if you have the same protocol running by both parties on the D-channel

#/etc/asterisk/zapata.conf or /etc/asterisk/chan_dahdi.conf

switchtype=<specify switchtype>
e.g switchtype=national

3. Finally, check if you have the right master/slave relationship on ISDN level. One side of the link should be set as network while another end should be set as user/slave.

#/etc/asterisk/zapata.conf or /etc/asterisk/chan_dahdi.conf

signalling=<specify signalling>


e.g signalling=pri_cpe #user-side configuration (Slave/User)
e.g signalling=pri_net #network-side configuration (Master)

If you are unsure how the other side is configured just try to set pri_net on Asterisk side. If it works with Telco provider, make sure that you contact them and tell them to change their configuration to NETWORK so that you can change your Asterisk as USER (pri_cpe).



Some bonus information:

Framing:
ESF
D4
CAS
CCS

Encoding:
B8ZS
AMI
HDB3
NCRC2

Signalling:
pri_cpe
pri_net
fxs_ks
fxs_ls
fxs_gs
fxo_ks
fxo_ls
fxo_gs
em (E&M)
em_w (E&M Wink)
em_e1

Switchtype:

Only used for PRI
national --> National ISDN 2 (default)
dms100 --> Nortel DMS100
4ess --> AT&T 4ESS
5ess --> Lucent 5ESS
euroisdn --> EuroISDN (common in Europe)
ni1 --> Old National ISDN 1
qsig --> Q.SIG




FAQs:


Why do we need encoding for T1 circuit? Why B8ZS?

Ans: B8ZS (Bipolar/Binary Eight Zero Substitution), also known as "Clear Channel" or "clear 64" is used with ESF framing in T1 Carrier systems. It uses Out-of-band signalling frees up all 8 bits of each byte to carry data, allowing each channel 64kpbs.

Consecutive eight zero bits is encoded as 000+-0-+0


B8ZS satisfies T1 Carrier regenerator ones density requirement that fifteen consecutive zeros cannot be send and that an average of at least one out of eigth bits contains a one. With that said, sending and receiving end both should be using B8ZS.


Why do we require framing for T1 circuit? Why ESF?
Ans: Since T1 circuit used TDM (Time Division Multiplexing). Acceptable audio bandwith is 4 KHz, so as per Nyquist Criteria sampling frequency should be 2x4KHz i.e 8 KHz. 8KHz can also be considerd as 8000 frames /second. Each channel is framed at 8KHz, so each channel has occupies bandwith of 8 bytes/frame x 8000 frames /second = 64 kpbs.

Frame synchronization is necessary to identify the timeslots wthin each 24 channel frame in T1 circuit. Synchronization takes place by allocating a framing or 193rd bit.
(8 bits data/channel x 24 channels/frame + 1 framing bit/frame)=193
i.e 193rd bit is the framing bit

For T1 line (also known as DS1)
(8 bits data/channel x 24 channels/frame + 1 framing bit/frame) x 8000 frames/second=1.544kbps

Looking at the above expression, we can say that we have
framing data= (1 framing bit/frame x 8000 frames/second) = 8 kbps
Because this 8 kbps channel is used for framing, only 1.536 kpbs (i.e 1.544kpbs - 8 kbps) is actually passed on to the user.

ESF (Extended Super Frame) consists of twenty-four consecutive 193rd bit frames.


Tuesday, May 4, 2010

I have multiple T1 cards on the Asterisk Server. How do I know which T1 card will load first?

Ans: This is very important question as SPANs for Tie Trunks relates with the order in which T1 card loads. For example,
Card 0 has Span1-4 as it is loaded first
Card 1 has Span5-8 as it is loaded second

However, what will happen if Card1 loads first. You are in trouble as Card1 will host Span1-4, not the Card0.

To prevent this disaster to happen, Digium has Ident Dial that makes the driver load on the card in specific order. Ident Dial has range from '0-9' 'A-F'.

Now, I would do this

Card0 with Ident set to 0
Card1 with Ident set to 1

This will ensure that Card0 will have Span1-4
and Card1 will have Span5-8

Setting all cards to zero should cause the driver to automatically number the cards. The dial should only be used if a specific order is needed.

http://kb.digium.com/entry/106/

Wednesday, April 28, 2010

Benefits of using trunk group instead of multiple T1/E1 trunks

(Explaination is based on benefits of creating trunkgroup of two T1 lines)

  • Less programming of trunk groups in the CO to manipulate overflow whether it be in or out. That is, if 1 trk group is busy there will be no need for overflow to the other trunk group. If it is one trunk group all the channels will hunt to next channel if they are in use whether it is inbound or outbound. Traditionally, incoming starts from trk member 1, outbound starts from trk member 46.

  • You will also get a backup d-channel that wil be available if the primary has a problem. If for some reason another span is needed, depending if the Asterisk is capable of doing this, it can be set-up as a full T1 rather than a PRI. This will get you an additional b-channel for voice and the full T1 can be a rider AND use the the d-channel signaling form the other spans.

Q: How can we achieve that in asterisk?

Ans: NFAS (Non-Facilities Associated Signaling) is an ISDN feature for sharing one ISDN D channel accross multiple ISDN PRI lines.

http://www.voip-info.org/wiki/view/NFAS

http://www.asterisk.org/doxygen/asterisk1.2/Config_zap.html

Thursday, April 15, 2010

SIP trunk between two Asterisk Servers

Let say I have two asterisk servers R01 and S01

; ****************
; *** SIP.CONF ***
; ****************
;
; Summary:
; - Configuration for SIP protocol
; - All phone registration information resides here
;
; Server: R01
; File location: /etc/asterisk/sip.conf
; *****************
;

[general]
disallow=all
allow=ulaw
canreinvite=no

register => trunk-S01-R01:welcome@[IP-add-of-S01]/trunk-S01-R01

[trunk-R01-S01]
type=friend
secret=welcome
host=dynamic
context=from-S01
;username=trunk-S01-R01

[1000]
type=friend
context=phones
host=dynamic
username=1000
secret=abc123



; ****************
; *** SIP.CONF ***
; ****************
;
; Summary:
; - Configuration for SIP protocol
; - All phone registration information resides here
;
; Server: S01
; File location: /etc/asterisk/sip.conf
; ***************
;

[general]
disallow=all
allow=ulaw
canreinvite=no

register => trunk-R01-S01:welcome@[IP-add-of-R01]/trunk-S01-R01

[trunk-S01-R01]
type=friend
secret=welcome
host=dynamic
context=from-R01
;username=trunk-R01-S01

[2000]
type=friend
context=phones
host=dynamic
username=2000
secret=abc123



DIALPLAN

;******************
;extensions.conf
;
;Server: R01
;******************

[globals]

[general]
autofallthrough=yes

[Internal]
exten => _1XXX,1,NoOp()
exten => _1XXX,n,Dial(SIP/${EXTEN},30);
exten => _1XXX,n,Playback(the-party-you-are-calling)
exten => _1XXX,n,Hangup()

[External]
exten => _2XXX,1,NoOp()
exten => _2XXX,n,Dial(SIP/trunk-R01-S01/${EXTEN},30)
exten => _2XXX,n,Hangup()

[phones]
include => Internal
include => External

[from-S01]
include => Internal


;******************
;extensions.conf
;
;Server: S01
;******************
[globals]

[general]
autofallthrough=yes

[Internal]
exten => _2XXX,1,NoOp()
exten => _2XXX,n,Verbose(1,I am in Internal)
exten => _2XXX,n,Dial(SIP/${EXTEN},30)
exten => _2XXX,n,Hangup()

[External]
exten => _1XXX,1,NoOp()
exten => _1XXX,n,Verbose(1,I am in External)
exten => _1XXX,n,Dial(SIP/trunk-S01-R01/${EXTEN},30);
exten => _1XXX,n,Playback(the-party-you-are-calling)
exten => _1XXX,n,Hangup()

[phones]
include => Internal
include => External

[from-R01]
include => Internal


>Start Asterisk #asterisk
>Go to Asterisk Console #asterisk -rv
CLI> sip show peers
CLI> sip show registry

Friday, April 9, 2010

SPAN in details (for Asterisk)

SPAN is the trunk parameter defined in /etc/dahdi/system.conf [ traditionally /etc/zaptel.conf ] for the PRI interface.

Trunk can be T1/E1.

span = [span num], [timing], [line build out], [framing], [coding]

e.g span = 1,0,0,esf,b8zs

This means, the specified trunk is mapped to SPAN 1 of the T1 card. It uses internal clock of card as time source as second parameter is 0. LBO is 0 and it doesn't require to be changed most of the time as cable is not going to be more than 133ft from smart jack. Framing is esf. Coding is b8zs.
[ Also remember, each PRI card should have their own independent clock source ]
In brief, you can say, this particular trunk is esf,b8zs with internal clock as time source.


I would like to write about some other parameters defined in /etc/dahdi/system.conf

span = 1,0,0,esf,b8zs
bchan=1-23 #B-Channel defination
dchan=24 #D-Channel defination

Since bchan+dchan=24, it is T1 trunk configuration.
For E1 trunk, bchan+dchan=31

Also note that FRAMING and CODING is main factor that can distinguish between T1 and E1 trunk.
--------------T1----------------------E1
Framing -- esf / d4------------ ccs / cas
Coding ---- b8zs / ami -------- hdb3 / ami
-----------------------------------------


When you talk about Trunk, you also need to specify the switch type. Switchtype parameter is defined in /etc/asterisk/chan_dahdi.conf . It can be National or dms100 or 5ess

Default Switch: National
Nortel Switch : dms100 [ but it's weird that in my case, i had to use 5ess switchtype to interface my Asterisk Server with Nortel Switch]
Dialogic Fax Server Switch : dms100

So, PRI with following configuration can be said as T1 trunk with esf,b8zs signalling and National switchtype.

#/etc/dahdi/system.conf
span = 1,0,0,esf,b8zs

#/etc/asterisk/dahdi.conf
switchtype = National



Wonderful explaination at :

http://www.asteriskguru.com/tutorials/pri_zaptel.html
http://www.asteriskguru.com/tutorials/pri.html


Telcom Terminologies

ISDN : Integrated Service Digital Network
=> 1.544Mbps line
=> Based on T1/E1
=> Carry DSO signal

BRI : Basic Rate Interface for SOHO
2B + 1D

PRI : Primary Rate Interface for large enterprise
T1: 23B + 1D
E1: 30B + 1D

PRI channels are typically used by medium to large enterprises with digital PBXs to provide them digital access to PSTN.

PRI is service and T1 is the hardware used for delivery. For eg. TE420 is one of the T1 hardware for PRI.

B - Channel : B stands for Bearer; It's an ISDN channel that carries data
D - Channel: D stands for Delta; It's an ISDN channel that carries control and signaling information


CSU/DSU : Channel Service Unit/Data Service Unit
=> It is a digital interface to connect DTE device, like router, to a digital circuit (eg. T1/E1 line)
=> It operates at physical layer of OSI model.

Friday, March 5, 2010

Provisioning Polycom IP Phones


There are the few steps to be followed for Polycom IP Phone provisioning.


Download the latest SIP firmware of the Polycom IP Phone

http://www.polycom.com/support/voice/soundpoint_ip/soundpoint_ip330_320.html

Unzip in the downloaded file (say: C:/SIP3.2.2)
Make essential changes in the config files sip.cf, phone1.cfg, 00000000.cfg, phone-[mac-address].cfg

Note: Config files are parsed in following order
1. 00000000000000.cfg
2. sip.cfg
3. phone1.cfg
4. [PHONE_MODEL].cfg
5. phone-[PHONE_MAC_ADDRESS].cfg


Setup TFTP Server

Download TFTP Server:
You can google "solarwind tftp server download"
Download TFTP Server

Configure the TFTP Server to point to the Location of the SIP firmware ( in our case: C:/SIP3.2.2)
Start the TFTP Server (say IP Address is 192.168.1.10)


Do following Configuration on Polycom IP Phones

1. Specify the IP Address (Make sure that it's in same subnet as of the TFTP server)

e.g 192.168.1.25

2. Specify the Subnet Mask

e.g 255.255.255.0

3. Specity the Gateway

e.g 192.168.1.1

4. In Server Menu, Select TFTP ( in our case IPAdd: 192.168.1.10) , Username: Blank, Password: Blank

5. CDP: Disabled

6. VLAN ID: Blank

7. Reboot the Phone

You can see in the console of the TFTP server that Polycom IP Phone is downloading the firmware. Once it downloads the firmware and config files from the TFTP server, it's done. :)