Problems with Asterisk and 302 support

Hi,

I’m not a heavy Asterisk user but run a softswitch where several of my customers use Asterisk based systems for various applications.

The switch architecture on my end is such, that customers communicate with a load balancing node which performs authentication then redirects them to a signalling endpoint inside our network for call termination.

I’ve noticed two… bugs(?) so far in how Asterisk seems to be handling the Moved Temporarily messages.

The initial call INVITE/SDP looks great. RPID is present and the codecs list is what I want it to be.

    INVITE sip:61414XXXXXX@203.XX.XX.XX SIP/2.0
    Via: SIP/2.0/UDP 59.XXX.XXX.XXX:5070;branch=z9hG4bK38ac50b7;rport
    From: "XXXXXX XXXXXX" <sip:612XXXXXXXX@XXXXXXX.net.au>;tag=as2b0aaa43
    To: <sip:61414XXXXXX@203.XX.XX.XX>
    Contact: <sip:612XXXXXXXX@59.XXX.XXX.XXX:5070>
    Call-ID: [158444ef031a3ce13f71ec8478861394@XXXXXXXX.net.au](mailto:158444ef031a3ce13f71ec8478861394@XXXXXXXX.net.au)
    CSeq: 102 INVITE
    User-Agent: Asterisk PBX
    Max-Forwards: 70
    Remote-Party-ID: "XXXXXX XXXXXX" <sip:61XXXXXXXX@XXXXXX.net.au>;privacy=off;screen=no
    Date: Sat, 10 May 2008 05:40:02 GMT
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
    Supported: replaces
    Content-Type: application/sdp
    Content-Length: 267

    v=0
    o=root 13233 13233 IN IP4 59.XXX.XXX.XXX
    s=session
    c=IN IP4 59.XXX.XXX.XXX
    t=0 0
    m=audio 18574 RTP/AVP 18 101
    a=rtpmap:18 G729/8000
    a=fmtp:18 annexb=no
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=silenceSupp:off - - - -
    a=ptime:20
    a=sendrecv

The softswitch sends back a 100 Trying while it does some internal lookups.

    SIP/2.0 100 Trying
    Via: SIP/2.0/UDP 59.XXX.XXX.XXX:5070;branch=z9hG4bK38ac50b7;rport=5070;received=59.167.245.236
    From: "XXXXXX XXXXXX" <sip:612XXXXXXXX@XXXXXX.net.au>;tag=as2b0aaa43
    To: <sip:61414XXXXXX@203.XX.XX.XX>
    Call-ID: [158444ef031a3ce13f71ec8478861394@XXXXXX.net.au](mailto:158444ef031a3ce13f71ec8478861394@XXXXXX.net.au)
    CSeq: 102 INVITE
    Server: MERA MSIP v.3.0
    Content-Length: 0

The softswitch responds with a 302 after it has performed authentication internally (based on source IP and number called in this case) and redirects the call to a signalling endpoint which will be able to complete the termination:

   SIP/2.0 302 Moved Temporarily
    Via: SIP/2.0/UDP 59.XXX.XXX.XXX:5070;branch=z9hG4bK38ac50b7;rport=5070;received=59.167.245.236
    From: "XXXXXX XXXXXX" <sip:612XXXXXXXX@XXXXXX.net.au>;tag=as2b0aaa43
    To: <sip:61414XXXXXX@203.XX.XX.XX>;tag=1786530-270873906-385876096-3131510948
    Call-ID: [158444ef031a3ce13f71ec8478861394@XXXXXX.net.au](mailto:158444ef031a3ce13f71ec8478861394@XXXXXX.net.au)
    CSeq: 102 INVITE
    Contact: <sip:61414XXXXXX@203.XX.XX.XX:5061>
    Server: MERA MSIP v.3.0
    Content-Length: 0

Asterisk responds to the load balancer/auth node with an ACK:

    ACK sip:61414XXXXXX@203.XX.XX.XX SIP/2.0
    Via: SIP/2.0/UDP 59.XXX.XXX.XXX:5070;branch=z9hG4bK38ac50b7;rport
    From: "XXXXXX XXXXXX" <sip:612XXXXXXXX@XXXXXX.net.au>;tag=as2b0aaa43
    To: <sip:61414XXXXXX@203.XX.XX.XX>;tag=1786530-270873906-385876096-3131510948
    Contact: <sip:612XXXXXXXX@59.XXX.XXX.XXX:5070>
    Call-ID: [158444ef031a3ce13f71ec8478861394@XXXXXXX.net.au](mailto:158444ef031a3ce13f71ec8478861394@XXXXXXX.net.au)
    CSeq: 102 ACK
    User-Agent: Asterisk PBX
    Max-Forwards: 70
    Remote-Party-ID: "XXXXXX XXXXXX" <sip:612XXXXXXXX@XXXXXX.net.au>;privacy=off;screen=no
    Content-Length: 0

Asterisk then issues a new INVITE message out to the signalling temination point. In this second invite it has added all the default codec capabilities and the RPID header has been removed.

INVITE sip:61414XXXXXX@203.XX.XX.XX:5061 SIP/2.0
Via: SIP/2.0/UDP 59.XXX.XXX.XXX:5070;branch=z9hG4bK0c0fddfe;rport
From: “XXXXXX XXXXXX” sip:612XXXXXXXX@XXXXXX.net.au;tag=as38ebf621
To: sip:61414XXXXXX@203.XX.XX.XX:5061
Contact: sip:612XXXXXXXX@59.XXX.XXX.XXX:5070
Call-ID: 716fb84439999fa55b79b543774e35ee@XXXXXX.net.au
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 70
Date: Sat, 10 May 2008 05:40:02 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: 315

v=0
o=root 13233 13233 IN IP4 59.XXX.XXX.XXX
s=session
c=IN IP4 59.XXX.XXX.XXX
t=0 0
m=audio 14940 RTP/AVP 18 8 0 101
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

End result of the call is that since the initiading UAC (an IP Phone in this case) only supports G729, if PCMA/PCMU are negotiated, no audio is present on the call. The calling party number is also presented to the far end in the cases where restriction has been requested due to lack of the RPID in the second INVITE message.

Is this an oversight in the Asterisk code to do with handling of 302s or a configuration error on my part?

Should Asterisk be defaulting to the globals in sip.conf rather than using the settings already configured on the trunk selected?

Any help is appreciated. I’m trying to put together some details configuration guides for the users who are using Asterisk to switch calls into our network.

The above example is from a 1.4.18 install but this is also confirmed on a 1.2 version as well.

Thanks

I know this is a hard one - but… any takers?