[asterisk-ss7] adding routing to libss7

Horacio J. Peña horape at compendium.com.ar
Wed Nov 24 22:04:55 CST 2010


I'm now working on adding MTP3 routing capabilities (I mean routing decisions,
where to send each message, not forwarding/STP, but then forwarding is probably
very easy to do once routing is done) to libss7.

Currently, libss7 does some very funny things when it has more than a linkset
connected (for example, if your links are 2000:0, 3000:1, 2000:2, messages to
DPC 2000 with SLS 1 will be routed by 3000 instead of by some of the links to

Here are some notes on how I plan to add the routing capabilities. They are some
sort of brain dump, very rough, but if you want to take a look and warn/suggest
me something, go for it.


Notes on routing

These notes are writen for myself, to help me while developing. If somebody else tries to make sense from this, good luck!

Also, this is some sort of design done before coding, probably while coding some parts of the design will change, and I made no guarantees about keeping this updated. If the code and these notes differ distrust both.

1. Routing tables:

ss7->routing_table is the static routing table, it has:


Something like L1-L2,L3,L4-L5 would be represented by:

DPC, 1, [L1, L2]
DPC, 2, [L3]
DPC, 3, [L4, L5]

(Linksets are represented by struct adjacent_sp, there is no concept of linkset on libss7. NOTE: this makes us unable to use more than one link set in parallel between two signalling points; Q.700 2.2.2 says that should be possible)

ss7->routes is the dynamic routing table, it has the subset of ss7->routing_table that is active, it has:

DPC, State, LINKSETS (and several "internal" extras)

there is only one dynamic route per DPC. LINKSETS is a subset of some LINKSETS of the static table. All routes start on unreachable state.

2. How to route a packet.

Having a message for (DPC, SLS) the method to select the link to send it by is:

Look DPC on dynamic route table, get LINKSETS. Get all the links from those linksets. Use link[SLS % nlinks]. If that link is changed over to other link, follow the chain of changeovers

4. When a linkset fails, look for each dynamic route that uses it, and do a controlled reroute.

5. When a link fails:

- if it was the last active link on the linkset, do 4. first.
- change over to some other link on the same linkset or to some link on the new route to the adj PC chosen by 4. The changeover must be done faster than the controlled reroute.

6. When a linkset gets up, look up for routes on the static table that uses it and are better than the actual route. Do controlled reroutes.

7. When a link gets up:

- if it is the first link on the linkset, do 6 (no changeback is needed, as there won't be any route active thru that linkset)
- else do a changeback (follow the chain of changeovers and send the CDB there)

How does changeover work?
(my interpretation of Q.704, may be wrong)

COO SLC means "I'm unable to use SLC to reach you, so I'll use some other path to send the traffic I was sending thru SLC, please let me know how far have your received so I can reroute without losing packets", there should be no need to send the COO by the link we intend to move the traffic to. We could even move the traffic to several different links but still will send just one COO. What we're after is "what packets went fine by the link without us getting the ACK" so we can avoid duplication and losses.

CBD is "I intend to redirect some traffic from this path to somewhere else, please let me know when you get this so I know you received all the previous messages and can reroute without getting the packets out-of-order. There should be no need to indicate the SLC we are changing back to. Really, there is not even the need to send the CBD, we could use time controlled diversion everytime. After all, CBD is a way to do it faster but with more risk of out-of-order problems. Q.704 6.2 says:

NOTE – The sequence control procedure can only guarantee correct sequencing of MSUs in all cases if the
alternative link terminates in the same signalling point (i.e. the destination of the changeback declaration) as
the newly available one.

Maybe CBD should be done only when getting back from some other link on the same linkset, and do only time controlled diversion when crossing linksets boundaries (wow! this is coherent with 7. before...)

NOTE: I'm doing DPC-only routing, but the correct way to do it should be route based on DPC+SLS. Example:

|                     A                      |
  |              |             |   |
  | L1           | L2     L3-1 |   | L3-2
  |              |             |   |
+---+     L4   +---+          +-----+
| B |----------| C |          | D   |
+---+          +---+          +-----+
  |                             |
  | L5                          | L6
  |                             |
+---+                           |
| E |---------------------------+

Route from A->E: L1-L3; L2

SLS 0, 3, 6, ... go by L1
SLS 1, 4, 7, ... go by L3-1
SLS 2, 5, 8, ... go by L3-2

L1 fails. Reroute to L3.

SLS 0, 2, 4, ... go by L3-1
SLS 1, 3, 5, ... go by L3-2

SLS 1 has been rerouted without need.

Horacio J. Peña
horape at compendium.com.ar
horape at uninet.edu

More information about the asterisk-ss7 mailing list