
                _                          _ _               _
            ___(_)_ __        _ __ ___  __| (_)_ __ ___  ___| |_
           / __| | '_ \ _____| '__/ _ \/ _` | | '__/ _ \/ __| __|
           \__ \ | |_) |_____| | |  __/ (_| | | | |  __/ (__| |_
           |___/_| .__/      |_|  \___|\__,_|_|_|  \___|\___|\__|
                 |_|





Content
-------

1.0 What is sip-redirect?
2.0 Requirements
3.0 Installation and configuration
4.0 License and copyright
5.0 Some SIP information
6.0 Limitations and known problems
7.0 Bugs and reporting
8.0 Contact


1.0 What is sip-redirect?
-------------------------

sip-redirect is a tiny SIP redirect server written in Perl. It is IPv4 and IPv6
capable, but the IPv6 support is optional. The RFC 3261 was the base for this
simple and very configurable implementation. There is neither TCP nor multicast
support programmed in.


2.0 Requirements
----------------

- perl >= 5.005
  - perl >= 5.8.0 is recommented to avoid possible problems
  - perl modules Fcntl, IO::Select, POSIX and Socket
  - perl Socket >= 1.95 is required for IPv6 support
  - perl Socket6 is required for IPv6 support (with perl Socket < 1.95)
  - perl Socket6 >= 0.20 is required for IPv6 support with perl >= 5.10.0 but
    with perl Socket < 1.95
- systemd >= 1 (optional, if systemd support is wished)
  - systemd >= 217 (current latest stable release) is recommented
- chkconfig >= 1.3 (optional, if classic initscript is wished)
  - chkconfig >= 1.3.63 (current latest stable release) is recommented


3.0 Installation and configuration
----------------------------------

Extract the sip-redirect-X.Y.Z.tar.gz using "tar xvfz <file>" or "gzip -d
<file> && tar xvf <file>" for example. "X.Y.Z" simply stands for the current
version number of sip-redirect.

After that, change into the directory and type "make install" for installing.


4.0 License and copyright
-------------------------

sip-redirect is licensed under GNU General Public License, the complete license
you can get at: http://www.gnu.org/copyleft/gpl.html


5.0 Some SIP information
------------------------

In some architectures it may be desirable to reduce the processing load on
proxy servers that are responsible for routing requests, and improve signaling
path robustness, by relying on redirection.

Redirection allows servers to push routing information for a request back in a
response to the client, thereby taking themselves out of the loop of further
messaging for this transaction while still aiding in locating the target of the
request. When the originator of the request receives the redirection, it will
send a new request based on the URI(s) it has received. By propagating URIs
from the core of the network to its edges, redirection allows for considerable
network scalability:

                                   Redirect
                 .  .  .  .  .  .   Server  .  .  .  .  .  .
               .                                             .
     Penguin's . . . . . . . . . . . . . . . . . . . . . . . . Beastie's
     SIP Phone                                                 SIP Phone
         |                            |                            |
         |         INVITE (1)         |                            |
         |--------------------------->|                            |
         |  302 Moved Temporarily (2) |                            |
         |<---------------------------|                            |
         |           ACK (3)          |                            |
         |--------------------------->|                            |
         |                         INVITE (4)                      |
         |-------------------------------------------------------->|
         |                         200 OK (5)                      |
         |<--------------------------------------------------------|
         |                     Media Session (6)                   |
         |<=======================================================>|
         |                          BYE (7)                        |
         |-------------------------------------------------------->|
         |                         200 OK (8)                      |
         |<--------------------------------------------------------|
         |                                                         |

Penguin <sip:penguin@another-network.local> (<sip:penguin@192.168.0.29:5060>)
is calling Beastie <sip:penguin@another-network.local> which has the real SIP
address <sip:beastie-customer@dialup-provider.local>, but Penguin doesn't know
this. So the following invite (1) is initiated to another-network.local:

  INVITE sip:beastie@some-network.local SIP/2.0
  Via: SIP/2.0/UDP 192.168.0.29:5060
  Content-Length: 337
  Contact: <sip:penguin@192.168.0.29:5060>
  Call-ID: 4290836@192.168.0.29
  Content-Type: application/sdp
  CSeq: 1 INVITE
  From: <sip:penguin@another-network.local>;tag=35611606220099
  Max-Forwards: 70
  To: <sip:beastie@some-network.local>
  User-Agent: SJphone/1.60.289a (SJ Labs)

  v=0
  o=- 3360766404 3360766404 IN IP4 192.168.0.29
  s=SJphone
  c=IN IP4 192.168.0.29
  t=0 0
  a=direction:active
  m=audio 49192 RTP/AVP 3 97 98 8 0 101
  a=rtpmap:3 GSM/8000
  a=rtpmap:97 iLBC/8000
  a=rtpmap:98 iLBC/8000
  a=fmtp:98 mode=20
  a=rtpmap:8 PCMA/8000
  a=rtpmap:0 PCMU/8000
  a=rtpmap:101 telephone-event/8000
  a=fmtp:101 0-11,16

The SIP Redirect server running at another-network.local knows, that Beastie is
only available at <sip:beastie-customer@dialup-provider.local> and replies with
302 Moved Temporarily (2) to Penguin. When the user at another-network.local is
not available (means not existing), there will be a 404 Not Found response:

  SIP/2.0 302 Moved Temporarily
  Via: SIP/2.0/UDP 192.168.0.29:5060
  From: <sip:penguin@another-network.local>;tag=35611606220099
  To: <sip:beastie@some-network.local>
  Call-ID: 4290836@192.168.0.29
  CSeq: 1 INVITE
  Contact: <sip:beastie-customer@dialup-provider.local>
  Server: sip-redirect/0.1.1
  Content-Length: 0

After telling Penguin the real SIP address of Beastie, Penguin is sending some
confirmation (3):

  ACK sip:beastie@some-network.local SIP/2.0
  Via: SIP/2.0/UDP 192.168.0.29:5060
  Content-Length: 0
  Call-ID: 4290836@192.168.0.29
  CSeq: 1 ACK
  From: <sip:penguin@another-network.local>;tag=35611606220099
  Max-Forwards: 70
  To: <sip:beastie@some-network.local>
  User-Agent: SJphone/1.60.289a (SJ Labs)

Penguin is calling Beastie using <sip:beastie-customer@dialup-provider.local>
now (4) and the call will go it's normal way (5-8).


6.0 Limitations and known problems
----------------------------------

Normally, a SIP Redirect Server should provide multicast support and it should
allow to invite groups, too. As I currently don't need these features, I did
not implement them. Same applies to encoded messages (SIP header and body) and
to the use of TCP as transport protocol instead of the common used UDP.

Multiple contact tags or line foldings within the SIP header maybe will cause
problems but shouldn't break down the daemon. I guess, replying to the sending
host instead of talking with the newest host from the via tag isn't absolutely
perfect, too.

You can use Perl's regular expression syntax in /etc/sip-redirect.conf to have
a wider match of forwarded SIP addresses. But this will maybe slow down and it
wasn't written to redirect e.g. (.*)@onehost to $1@anotherhost.


7.0 Bugs and reporting
----------------------

Please report bugs and problems - written in German or English language - to
me at: sip-redirect@robert-scheck.de


8.0 Contact
-----------

Name     : Robert Scheck
E-Mail   : sip-redirect@robert-scheck.de
GnuPG-Key: http://www.robert-scheck.de/kontakt/gpg/rsc.gpg
IRC chat : irc.linuxnetz.de, #robert-scheck
