[sr-dev] [kamailio/kamailio] CSeq issues with CANCEL after INVITE (#918)

greggcz notifications at github.com
Sat Jan 7 14:21:09 CET 2017


Hi,

I have a provider that requires proxy auth for all outgoing calls so I create the following config:

```
loadmodule "uac.so"
loadmodule "dialog.so"
modparam("dialog", "dlg_flag", 4)
modparam("dialog", "track_cseq_updates", 1)
modparam("dialog", "send_bye", 1)
modparam("dialog", "timeout_noreset", 1)
modparam("uac","auth_realm_avp","$avp(s:auth_realm_avp)")
modparam("uac","auth_username_avp","$avp(s:auth_username_avp)")
modparam("uac","auth_password_avp","$avp(s:auth_password_avp)")

route {
        ......
        dlg_manage();

        # dispatch destinations to PSTN
        route(PSTN);

        ......
}

failure_route[MANAGE_FAILURE] {
        route(NATMANAGE);

        if (t_is_canceled()) {
                exit;
        }
        if (t_check_status("401|407"))
        {
                $avp(s:auth_realm_avp) = "realm";
                $avp(s:auth_username_avp) = "user";
                $avp(s:auth_password_avp) = "pass";
                if (uac_auth()) {
                        xlog("L_INFO", "[MANAGE_FAILURE] did auth. Relaying to new destination. from=$fu, callee-selected-by=$ou, uri=$ru");
                        t_relay();
                        exit;
                } else {
                        xlog("L_INFO", "[MANAGE_FAILURE] no matching realm found. realm=$ar");
                }
        }
}
```


Based on this authentication happens correctly however when canceling the call from the caller side, incorrect CSeq value is sent to the PSTN trunk:

INVITE sip:48221028000 at __provider__:6050 SIP/2.0
Record-Route: <sip:x.x.216.50;lr=on;ftag=327099285;did=14e.8df>
Max-Forwards: 19
Via: SIP/2.0/UDP x.x.216.50;branch=z9hG4bKa108.115652a5d470ecc5427124e7926af3b2.0
Via: SIP/2.0/UDP x.x.219.61:1049;received=x.x.219.61;rport=1049;branch=z9hG4bK1237457362
From: <sip:48221028008 at x.x.216.50>;tag=327099285
To: <sip:48221028000 at x.x.216.50>
Call-ID: 1015351791 at x.x.216.50
Allow: ACK, INVITE, BYE, CANCEL, OPTIONS, INFO
CSeq: 74 INVITE
Content-Type: application/sdp
Content-Length: 481

v=0
o=yate 1483794545 1483794545 IN IP4 x.x.219.61
s=SIP Call
c=IN IP4 x.x.219.61
t=0 0
m=audio 21596 RTP/AVP 0 8 11 98 97 102 103 104 105 106 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:11 L16/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=20
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:102 SPEEX/8000
a=rtpmap:103 SPEEX/16000
a=rtpmap:104 SPEEX/32000
a=rtpmap:105 iSAC/16000
a=rtpmap:106 iSAC/32000
a=rtpmap:101 telephone-event/8000
a=ptime:30

SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP x.x.216.50;branch=z9hG4bKa108.115652a5d470ecc5427124e7926af3b2.0;received=x.x.216.50
Via: SIP/2.0/UDP x.x.219.61:1049;received=x.x.219.61;rport=1049;branch=z9hG4bK1237457362
From: <sip:48221028008 at x.x.216.50>;tag=327099285
To: <sip:48221028000 at x.x.216.50>;tag=as386df8c6
Call-ID: 1015351791 at x.x.216.50
CSeq: 74 INVITE
User-Agent: Adescom CTM5000
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Max-Forwards: 70
Proxy-Authenticate: Digest realm="adescom", nonce="080cd7c6"
Content-Length: 0


ACK sip:48221028000 at __provider__:6050 SIP/2.0
Max-Forwards: 19
Via: SIP/2.0/UDP x.x.216.50;branch=z9hG4bKa108.115652a5d470ecc5427124e7926af3b2.0
From: <sip:48221028008 at x.x.216.50>;tag=327099285
To: <sip:48221028000 at x.x.216.50>;tag=as386df8c6
Call-ID: 1015351791 at x.x.216.50
CSeq: 74 ACK
Content-Length: 0

INVITE sip:48221028000 at __provider__:6050 SIP/2.0
Record-Route: <sip:x.x.216.50;lr=on;ftag=327099285;did=14e.8df>
Max-Forwards: 19
Via: SIP/2.0/UDP x.x.216.50;branch=z9hG4bKa108.115652a5d470ecc5427124e7926af3b2.1.cs74
Via: SIP/2.0/UDP x.x.219.61:1049;received=x.x.219.61;rport=1049;branch=z9hG4bK1237457362
From: <sip:48221028008 at x.x.216.50>;tag=327099285
To: <sip:48221028000 at x.x.216.50>
Call-ID: 1015351791 at x.x.216.50
Allow: ACK, INVITE, BYE, CANCEL, OPTIONS, INFO
CSeq: 75 INVITE
Content-Type: application/sdp
Content-Length: 481
Proxy-Authorization: Digest username="___USER___", realm="adescom", nonce="080cd7c6", uri="sip:48221028000 at __provider__:6050", response="521afedacdfa7033339e4956580bb0ec", algorithm=MD5

v=0
o=yate 1483794545 1483794545 IN IP4 x.x.219.61
s=SIP Call
c=IN IP4 x.x.219.61
t=0 0
m=audio 21596 RTP/AVP 0 8 11 98 97 102 103 104 105 106 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:11 L16/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=20
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:102 SPEEX/8000
a=rtpmap:103 SPEEX/16000
a=rtpmap:104 SPEEX/32000
a=rtpmap:105 iSAC/16000
a=rtpmap:106 iSAC/32000
a=rtpmap:101 telephone-event/8000
a=ptime:30

SIP/2.0 100 Trying
Via: SIP/2.0/UDP x.x.216.50;branch=z9hG4bKa108.115652a5d470ecc5427124e7926af3b2.1.cs74;received=x.x.216.50
Via: SIP/2.0/UDP x.x.219.61:1049;received=x.x.219.61;rport=1049;branch=z9hG4bK1237457362
From: <sip:48221028008 at x.x.216.50>;tag=327099285
To: <sip:48221028000 at x.x.216.50>
Call-ID: 1015351791 at x.x.216.50
CSeq: 75 INVITE
User-Agent: Adescom CTM5000
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Max-Forwards: 70
Contact: <sip:48221028000 at 85.14.79.130:6050>
Content-Length: 0
X-CTMG-HangupCause: Normal Clearing


SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP x.x.216.50;branch=z9hG4bKa108.115652a5d470ecc5427124e7926af3b2.1.cs74;received=x.x.216.50
Via: SIP/2.0/UDP x.x.219.61:1049;received=x.x.219.61;rport=1049;branch=z9hG4bK1237457362
From: <sip:48221028008 at x.x.216.50>;tag=327099285
To: <sip:48221028000 at x.x.216.50>;tag=as1fa0d5d0
Call-ID: 1015351791 at x.x.216.50
CSeq: 75 INVITE
User-Agent: Adescom CTM5000
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Max-Forwards: 70
Contact: <sip:48221028000 at 85.14.79.130:6050>
Content-Type: application/sdp
Content-Length: 226

v=0
o=root 7839 7839 IN IP4 85.14.79.130
s=session
c=IN IP4 85.14.79.130
t=0 0
m=audio 30688 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=ptime:20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -


CANCEL sip:48221028000 at __provider__:6050 SIP/2.0
Max-Forwards: 19
Via: SIP/2.0/UDP x.x.216.50;branch=z9hG4bKa108.115652a5d470ecc5427124e7926af3b2.1
From: <sip:48221028008 at x.x.216.50>;tag=327099285
To: <sip:48221028000 at x.x.216.50>
Call-ID: 1015351791 at x.x.216.50
CSeq: 74 CANCEL
Content-Length: 0

SIP/2.0 500 Server error
Via: SIP/2.0/UDP x.x.216.50;branch=z9hG4bKa108.115652a5d470ecc5427124e7926af3b2.1;received=x.x.216.50
From: <sip:48221028008 at x.x.216.50>;tag=327099285
To: <sip:48221028000 at x.x.216.50>;tag=as1fa0d5d0
Call-ID: 1015351791 at x.x.216.50
CSeq: 74 CANCEL
User-Agent: Adescom CTM5000
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Max-Forwards: 70
Content-Length: 0
X-CTMG-HangupCause: Normal Clearing


Since I'm new to Kamailio, I figured I must be doing something wrong but don't seem to find any working example anywhere....


-G

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/918
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20170107/311a9e19/attachment.html>


More information about the sr-dev mailing list