Story about three asterisk boxes, SIP, reinvites and trashed SIP handshakes
===========================================================================

This is happening with Asterisk SVN-branch-1.4-r79553.

I have three asterisk boxes, all with the same configuration. For
this excercise, I made three identical VMware instances so that it
wasn't the OS, or the network, or an Asterisk version inconsitency.

The first Asterisk instance has IP address 10.252.15.24.
The second Asterisk instance has IP address 10.252.15.25.
The third Asterisk instance has IP address 10.252.15.26.

The final leg of the call is the delivery on a Cisco Call Manager.
The SIP handler is "ccm-publisher.barnet.com.au", the end of the
RTP stream is "202.83.178.13", a Cisco 2821 media gateway.

The IP Address of the CCM is 10.252.11.130

This is the sip.conf of the first Asterisk instance:

    [general]
    context=default
    allowoverlap=no
    bindport=5060
    bindaddr=0.0.0.0
    srvlookup=yes
    context=from-sip
    canreinvite=yes

    [edwin]
    type=friend
    host=dynamic
    username=edwin
    secret=edwin
    context=from-sip
    canreinvite=no 

    [asterisk1]
    type=friend
    host=asterisk1.int.barnet.com.au
    context=from-sip
    canreinvite=yes

    [asterisk2]
    type=friend
    host=asterisk2.int.barnet.com.au
    context=from-sip
    canreinvite=yes

    [asterisk3]
    type=friend
    host=asterisk3.int.barnet.com.au
    context=from-sip
    canreinvite=yes

    [ccm-publisher]
    type=friend
    host=ccm-publisher.barnet.com.au
    context=from-sip
    canreinvite=yes

This is the sip.conf of the second and third Asterisk instances.

    [general]
    context=default
    allowoverlap=no
    bindport=5060
    bindaddr=0.0.0.0
    srvlookup=yes
    context=from-sip
    canreinvite=yes

    [asterisk1]
    type=friend
    host=asterisk1.int.barnet.com.au
    context=from-sip
    canreinvite=yes

    [asterisk2]
    type=friend
    host=asterisk2.int.barnet.com.au
    context=from-sip
    canreinvite=yes

    [asterisk3]
    type=friend
    host=asterisk3.int.barnet.com.au
    context=from-sip
    canreinvite=yes

    [ccm-publisher]
    type=friend
    host=ccm-publisher.barnet.com.au
    context=from-sip
    canreinvite=yes

This are the extensions.conf of the three Asterisk instances:

Number one:
    [from-sip]
    exten => 71,1,Dial(SIP/9096@ccm-publisher.barnet.com.au)
    exten => 81,1,Dial(SIP/81@asterisk2.int.barnet.com.au)
    exten => 91,1,Dial(SIP/91@asterisk2.int.barnet.com.au)

Number two:
    [from-sip]
    exten => 81,1,Dial(SIP/9096@ccm-publisher.barnet.com.au)
    exten => 91,1,Dial(SIP/91@asterisk3.int.barnet.com.au)

Number three:
    [from-sip]
    exten => 91,1,Dial(SIP/9096@ccm-publisher.barnet.com.au)

And I have one SIP phone (Polycom SoundPoint IP650), which drops
the call at the first Asterisk instance. The name is "edwin".

The IP address of the SIP phone is 10.251.1.21.


Scenario A: "canreinvite=no"
----------------------------
In this main-scenario we have set "canreinvite" in the sip.conf for
all entries set to "no".

Scenera A-1: Call 71
--------------------
The SIP handshake goes from the Polycom to the first Asterisk
instance to the CCM.

The RTP session ("debug rtp") goes from the phone via the
first Asterisk instance to the C2821.

[ SIP Flow | SIP packets ]

Scenera A-2: Call 81
--------------------
The SIP handshake goes from the Polycom to the first Asterisk
instance to the second Asterisk instance to the CCM.

The RTP session goes from the phone via the first Asterisk instance
to the second Asterisk instance to the C2821.

[ SIP Flow | SIP packets ]

Scenera A-3: Call 91
--------------------
The SIP handshake goes from the Polycom to the first Asterisk
instance to the second Asterisk instance to the third Asterisk
instance to the CCM.

The RTP session goes from the phone via the first Asterisk instance
to the second Asterisk instance to the C2821.

[ SIP Flow | SIP packets ]

Scernario B: "canreinvite=yes/no"
------------------------------
In the main scenario we have set the Asterisk instances and the
ccm-publisher in the sip.conf to "yes". The value in the polycom
phone section is still no.

Scenera B-1: Call 71
--------------------
The SIP handshake goes from the Polycom to the first Asterisk
instance to the CCM.

The RTP session ("debug rtp") goes from the phone via the
first Asterisk instance to the C2821.

[ SIP Flow | SIP packets ]

Scenera B-2: Call 81
--------------------
The SIP handshake goes from the Polycom to the first Asterisk
instance to the second Asterisk instance to the CCM.

The RTP session goes from the phone via the first Asterisk instance
to the C2821.

[ SIP Flow | SIP packets ]

Scenera B-3: Call 91
--------------------
The SIP handshake goes from the Polycom to the first Asterisk
instance to the second Asterisk instance to the third Asterisk
instance to the CCM.

There is no RTP stream setup.

[ SIP Flow | SIP packets ]

Scernario C: "canreinvite=yes"
------------------------------
In the main scenario we have set the value of "canreinvite" for
everything to "yes".

Scenera C-1: Call 71
--------------------
The SIP handshake goes from the Polycom to the first Asterisk
instance to the CCM.

The RTP session ("debug rtp") goes from the phone via the
first Asterisk instance to the C2821.

[ SIP Flow | SIP packets ]

Scenera C-2: Call 81
--------------------
The SIP handshake goes from the Polycom to the first Asterisk
instance to the second Asterisk instance to the CCM.

There is no RTP stream setup.

[ SIP Flow | SIP packets ]

Scenera C-3: Call 91
--------------------
The SIP handshake goes from the Polycom to the first Asterisk
instance to the second Asterisk instance to the third Asterisk
instance to the CCM.

There is no RTP stream setup.

[ SIP Flow | SIP packets ]