All pastes #40613 Raw Edit

Untitled

public text v1 · immutable
#40613 ·published 2006-02-07 22:13 UTC
rendered paste body
################################################################################
# vim:tabstop=4:shiftwidth=4:textwidth=80:backspace=2
#
# sitsotd.pl (SIP Is The Spawn Of The Devil)
#
# Roy Sigurd Karlsbakk <roy@karlsbakk.net>
#
# Copyleft 2006
#
# BRIEF DESCRIPTION
#
# SITSODT is yet another attempt to to create a good SIP gateway/proxy/something
# for doing scalable SIP solutions with asterisk or (potentially) other SIP/PSTN
# gateways. The idea is to create a SIP load balancer that interacts with the
# kernel, using kernel-space packet manipulation to forward the RTP streams,
# while keeping a counter on how many calls that are connected to each SIP/PTSN
# node, and thus eliminating NAT problems. To make this transparent to the
# SIP/PSTN gateways, they are placed behind NAT to make it all transparent and
# managable.
#
#
# METHODOLOGY
#
#  - All SIP clients see this proxy as their endpoint.
#  - All SIP REGISTER/OPTION requests are NATed and forwarded to registrars
#    (potentially the sames as the SIP/PSTN gateways) gateways in an defined by
#    the config, typically round robin (RR) or random (RA) or weighted variants
#    of these (WRR/WRA).
#  - Upon SIP INVITE, the SDP is rewritten to reflect all RTP should go through
#    this server, and the request is forwarded to a SIP/PSTN gateway in a
#    sequencial order [1]. At this point, a rule is created in the OS's packet
#    rewriting/forwarding mechanism [2].
#
#
# TO DO
#
#  - Make it work
#  - Add support for other OSes than Linux.
#  - Rewrite the iptables part to use libipt calls instead of the iptables
#    commandline tool [2].
#
#
# FOOTNOTES AND REFERENCES
#
# 1. Most telephony systems, or at least the ones I know, send calls
#    sequencially, First call on E1-1 chan 1, then E1-1c2, E1-1c3 etc until the
#    E1 is full and E1-2c1 is used. To best balance the load, the order of
#    incoming calls as programmed in the telco's switch should be opposite of
#    the order of outgoing calls.
#
# 2. At this point, we only use iptables commandline tools, which obviously only
#    works on Linux 2.4.x or higher. This should be changed to do direct API
#    calls.
#
# 3. iptel.org's SIP tutorial: http://www.iptel.org/sip/siptutorial.pdf
#
################################################################################