Cancel request and PJSIP_AUTH_AUTO_SEND_NEXT

PF
Paul Fortescue
Wed, Dec 11, 2019 12:12 PM

This is driving me mad.

I have set PJSIP_AUTH_AUTO_SEND_NEXT to 1, and also
PJSIP_AUTH_HEADER_CACHING to 1.

If I have two IP softphones (using PJSIP and based on MicroSIP code)
called A and B:

o Call B from A
o B is now ringing
o Cancel the call from A
o B carries on ringing, forever

The reason for this is that the CANCEL request is not sent as authorised
in the first case, and then when it receives the 401, it is resent but
the branch has changed.

Log for INVITE:

Via: SIP/2.0/UDP
192.168.33.75:54634;rport;branch=z9hG4bKPj141461eacc864328bbc40f15922bb310\r\n
From: "Bridge"
sip:1234@192.168.33.69;tag=14101b7a833d4c67bb3877e34ad0c0ce\r\n
            RESPONSE 401
Via: SIP/2.0/TCP
192.168.33.75:57799;rport;branch=z9hG4bKPj6cc2c6d205134dafbd1305f9dbab93d7;alias\r\n
From: "Bridge"
sip:1234@192.168.33.69;tag=14101b7a833d4c67bb3877e34ad0c0ce\r\n
            RESPONSE OK

Log for CANCEL:

Via: SIP/2.0/TCP
192.168.33.75:54634;rport;branch=z9hG4bKPj6cc2c6d205134dafbd1305f9dbab93d7;alias\r\n
From: "Bridge"
sip:1234@192.168.33.69;tag=14101b7a833d4c67bb3877e34ad0c0ce\r\n
            RESPONSE 401
Via: SIP/2.0/TCP
192.168.33.75:54634;rport;branch=z9hG4bKPj1a2e1dfc45ab40e7a3a2a87a2c3fdcf8;alias\r\n
From: "Bridge"
sip:1234@192.168.33.69;tag=14101b7a833d4c67bb3877e34ad0c0ce\r\n
            RESPONSE 481 Transaction leg does not exist

If PJSIP sent the first cancel request with authorisation, as it should,
then the branch would match with the last INVITE (branch ending with
93d7) but it changes it between the first CANCEL (401) and the next (481).

It only happens if the phone B is still ringing. Once the call has
answered everythng works fine.

Can anyone tell me if this is a bug or am I doing something wrong?

Thanks - Paul

This is driving me mad. I have set PJSIP_AUTH_AUTO_SEND_NEXT to 1, and also PJSIP_AUTH_HEADER_CACHING to 1. If I have two IP softphones (using PJSIP and based on MicroSIP code) called A and B: o Call B from A o B is now ringing o Cancel the call from A o B carries on ringing, forever The reason for this is that the CANCEL request is not sent as authorised in the first case, and then when it receives the 401, it is resent but the branch has changed. Log for INVITE: Via: SIP/2.0/UDP 192.168.33.75:54634;rport;branch=z9hG4bKPj141461eacc864328bbc40f15922bb310\r\n From: "Bridge" <sip:1234@192.168.33.69>;tag=14101b7a833d4c67bb3877e34ad0c0ce\r\n             RESPONSE 401 Via: SIP/2.0/TCP 192.168.33.75:57799;rport;branch=z9hG4bKPj6cc2c6d205134dafbd1305f9dbab93d7;alias\r\n From: "Bridge" <sip:1234@192.168.33.69>;tag=14101b7a833d4c67bb3877e34ad0c0ce\r\n             RESPONSE OK Log for CANCEL: Via: SIP/2.0/TCP 192.168.33.75:54634;rport;branch=z9hG4bKPj6cc2c6d205134dafbd1305f9dbab93d7;alias\r\n From: "Bridge" <sip:1234@192.168.33.69>;tag=14101b7a833d4c67bb3877e34ad0c0ce\r\n             RESPONSE 401 Via: SIP/2.0/TCP 192.168.33.75:54634;rport;branch=z9hG4bKPj1a2e1dfc45ab40e7a3a2a87a2c3fdcf8;alias\r\n From: "Bridge" <sip:1234@192.168.33.69>;tag=14101b7a833d4c67bb3877e34ad0c0ce\r\n             RESPONSE 481 Transaction leg does not exist If PJSIP sent the first cancel request with authorisation, as it should, then the branch would match with the last INVITE (branch ending with 93d7) but it changes it between the first CANCEL (401) and the next (481). It only happens if the phone B is still ringing. Once the call has answered everythng works fine. Can anyone tell me if this is a bug or am I doing something wrong? Thanks - Paul