libss7:
=======
libss7 is a userspace library that is used for providing SS7 protocol
services to applications.  It has a working MTP2, MTP3, and ISUP for
ITU and ANSI style SS7, however it was written in a manner that will easily
allow support for other various national specific variants
in the future.  For a working reference implementation, see the various
link test programs, as well as the Asterisk Open Source PBX.

License:
========
libss7 is covered under the GPL (Gnu Public License) version 2.  For more
information, see http://www.gnu.org/

A few tested switches:
======================
Siemens EWSD - (ITU style) MTP2 and MTP3 comes up, ISUP inbound and outbound calls work as well.
DTI DXC 4K - (ANSI style) 56kbps link, MTP2 and MTP3 come up, ISUP inbound and outbound calls work as well.
Huawei M800 - (ITU style) MTP2 and MTP3 comes up, ISUP National, International inbound and outbound calls work as well, CallerID presentation&screening work.

and many more...

Some carriers integrated with:
==============================
T-Systems Germany
Etel
COLT

Thanks to:
==========
Mark Spencer, for writing Asterisk and libpri and being such a great friend and boss.

Luciano Ramos, for donating a link in getting the first "real" ITU switch working.

Collin Rose and John Lodden, John for introducing me to Collin, and Collin for the first
"real" ANSI link and for holding my hand through the remaining changes that had to be 
done for ANSI switches.

Alan McMillan for numerous ANSI related updates, changes, testing, and additional parameter support.

To Use:
=======
In order to use libss7, you must get at least the following versions of DAHDI and Asterisk:
DAHDI: 2.0.x
libss7: 1.0.x or trunk
Asterisk: 1.6.x

You must then do a `make; make install` in each of the directories that you installed
in the given order (DAHDI first, libss7 second, and Asterisk last).

NOTE: In order to check out the code, you must have the subversion client installed.  This
is how to check them out from the public subversion server.

These are the commands you would type to install them:

`svn co http://svn.digium.com/svn/dahdi/linux/trunk dahdi-trunk`
`cd dahdi-trunk`
`make; make install`

`svn co http://svn.digium.com/svn/dahdi/tools/trunk dahdi-tools`
`cd dahdi-tools`
`./configure; make; make install`

`svn co http://svn.digium.com/svn/libss7/trunk libss7-trunk`
`cd libss7-trunk`
`make; make install`

`svn co http://svn.digium.com/svn/asterisk/branches/1.6.0 asterisk-1.6.0`
`cd asterisk-1.6.0`
`./configure; make; make install;`

This should build DAHDI, libss7, and Asterisk with SS7 support.

In the past, there was a special asterisk-ss7 branch to use which contained the SS7 code.
That code has been merged back into the trunk version of Asterisk, and the old asterisk-ss7
branch has been deprecated and removed.  If you are still using the asterisk-ss7 branch, it
will not work against the current version of libss7, and you should switch to asterisk-trunk
instead.

CONFIGURATION:
In /etc/dahdi/system.conf, your signalling channel(s) should be a "mtp2" (or "dchan" with a
non Digium card) and your bearers should be set as "bchan".

For example:
span=1,1,0,esf,b8zs
bchan=1-15,17-31
mtp2=16
#dchan=16 for non Digium cards

NOTE: For 56k ANSI links, you must additionally set in /etc/dahdi/system.conf "56k=[channel number]"
where 56k is like a flag for the mtp2 or dchan.

For example:
span=1,1,0,esf,b8zs
bchan=1-23
mtp2=24
56k=24

In the sample config file in Asterisk-1.6, there is a sample SS7 setup which you can
use to configured your link.

In brief, here is a simple ss7 linkset setup:

chan_dahdi.conf
===========
signalling = ss7
ss7type = itu 		; or ansi if you are using an ANSI link

linkset = 1		; Pick a number for your linkset identifier in chan_dahdi.conf

pointcode = 28		; The decimal form of your point code.  If you are using an
			; ANSI linkset, you can use the xxx-xxx-xxx notation for
			; specifying your linkset pointcode.
adjpointcode = 2	; The point code of the switch adjacent to your linkset

defaultdpc = 3		; The point code of the switch you want to send your ISUP
			; traffic to.  A lot of the time, this is the same as your
			; adjpointcode.

; Now we configure our Bearer channels (CICs)

cicbeginswith = 1	; Number to start counting the CICs from.  So if DAHDI/1 to
			; DAHDI/15 are CICs 1-15, you would set this to 1 before you
			; declare channel=1-15

channel=1-15		; Use DAHDI/1-15 and assign them to CICs 1-15

cicbeginswith = 17	; Now for DAHDI/17 to DAHDI/31, they are CICs 17-31 so we initialize
			; cicbeginswith to 17 before we declare those channels

channel = 17-31		; This assigns CICs 17-31 to channels 17-31

sigchan = 16		; This is where you declare which DAHDI channel is your signalling
			; channel.  In our case it is DAHDI/16.  You can add redundant
			; signalling channels by adding additional sigchan= lines.
			
; If we want an alternate redundant signalling channel add this

sigchan = 48		; This would put two signalling channels in our linkset, one at
			; DAHDI/16 and one at DAHDI/48 which both would be used to send/receive
			; ISUP traffic.

; End of chan_dahdi.conf

This is how a basic linkset is setup.  For more detailed chan_dahdi.conf SS7 config information
as well as other options available for that file, see the default chan_dahdi.conf that comes
with the samples in asterisk.  If you would like, you can do a `make samples` in your
asterisk directory and it will install a sample chan_dahdi.conf for you that contains
more information about SS7 setup.

Asterisk channel variables which map to SS7 parameters:
=======================================================
SS7_CHARGE_NUMBER
SS7_GENERIC_ADDRESS
SS7_JIP
SS7_GENERIC_DIGITS
SS7_GENERIC_DIGTYPE  (type of generic digits)
SS7_GENERIC_DIGSCHEME
SS7_ORIG_CALLED_NUM

SS7_LSPI_IDENT (these three are used for RLT support on DMS switches)
SS7_CALLREF_IDENT
SS7_CALLREF_PC

SS7_CALLING_PARTY_CATEGORY
SS7_REDIRECTING_NUMBER
SS7_GENERIC_NAME

Most are fairly self explanatory as far as what they contain.  It is also possible to set 
many of these parameters on outbound calls as well by prefixing the variable with an '_' 
when you set it.


Completed:
==========
MTP2 - Retransmissions are done correctly now from both sides.
Basic MTP3
Basic call messages (IAM, ACM, ANM, REL, RLC)
CIC Reset (GRS, GRA, RSC)
Connect message (CON)
CIC Blocking/Unblocking (CGB, CGBA, CGU, CGUA, BLO, BLA)
Continuity Check (COT, CCR)
Call Progress message (CPG)
ANSI MTP2, MTP3, and ISUP, inbound and outbound calling works now.
ITU style SS7 support
ANSI-style signalling support
Called and Calling Nature of Address Indicator
CallerID presentation&screening
UCIC and LPA messages
ANI2 - Originating line interface parameter (ANSI)
Charge number parameter (ANSI)
Hop counter parameter
Carrier identification parameter - (very simple, not configurable)
SS7 debug looks *MUCH* nicer
Kernel level MTP2 support (woohoo!) - See NEWS-05-30-2008 for more info
* Many more messages are supported than are listed.  isup.c is the best place to look.


TODO:
=====
short term:
SUS/RES
RDNIS
Timer for last SU received so we know if layer2 goes out under us

long term:
SCTP support (seems more people are interested in that than SCCP)

For more information, please use the Asterisk-ss7 or Asterisk-dev mailing
lists (I monitor them regularly) or email me directly.

Matthew Fredrickson
creslin@digium.com

