Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty to-tag in SBC on early REFER. #176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BaTnz
Copy link

@BaTnz BaTnz commented Jul 29, 2021

Update to-tag on responses 180 or over rather than 200 to fix empty to-tag on early REFER.

@juha-h
Copy link
Contributor

juha-h commented Jul 30, 2021

So you want to send REFER before the dialog has been established?

@BaTnz
Copy link
Author

BaTnz commented Aug 2, 2021

It establishes an "early dialog" per section 13.2.2.1 or RFC3261.

Was previously updated on all replies but was changed in commit 7ba4a52.

In the example flow below Bob wants to transfer Alice to Carol, once Carol responds 180 ringing Bob sends the REFER to Alice, Alice responds with 603 because the request is badly formed as it has an empty to-tag. All is fixed by having the SBC update it's tables with the to-tag in the 180 response. I believe there is nothing wrong with this call flow, the only issue is that we haven't taken note of the to-tag so can't include it.

+-------+                        +-----+                         +-----+ +-------+
| Alice |                        | SBC |                         | Bob | | Carol |
+-------+                        +-----+                         +-----+ +-------+
    |                               |                               |        |
    | INVITE Bob                    |                               |        |
    |------------------------------>|                               |        |
    |                               |                               |        |
    |                    100 Trying |                               |        |
    |<------------------------------|                               |        |
    |                               |                               |        |
    |                               | INVITE                        |        |
    |                               |------------------------------>|        |
    |                               |                               |        |
    |                               |                    100 Trying |        |
    |                               |<------------------------------|        |
    |                               |                               |        |
    |                               |                   180 Ringing |        |
    |                               |<------------------------------|        |
    |                               |                               |        |
    |                   180 Ringing |                               |        |
    |<------------------------------|                               |        |
    |                               |                               |        |
    |                               |                        200 OK |        |
    |                               |<------------------------------|        |
    |                               |                               |        |
    |                        200 OK |                               |        |
    |<------------------------------|                               |        |
    |                               |                               |        |
    | ACK                           |                               |        |
    |------------------------------>|                               |        |
    |                               |                               |        |
    |                               | ACK                           |        |
    |                               |------------------------------>|        |
    |                               |                               |        |
    |                               |       INVITE Alice, send only |        |
    |                               |<------------------------------|        |
    |                               |                               |        |
    |       INVITE Alice, send only |                               |        |
    |<------------------------------|                               |        |
    |                               |                               |        |
    | 200 OK                        |                               |        |
    |------------------------------>|                               |        |
    |                               |                               |        |
    |                               | 200 OK                        |        |
    |                               |------------------------------>|        |
    |                               |                               |        |
    |                               |                           ACK |        |
    |                               |<------------------------------|        |
    |                               |                               |        |
    |                           ACK |                               |        |
    |<------------------------------|                               |        |
    |                               |                               |        |
    |                               |                  INVITE Carol |        |
    |                               |<------------------------------|        |
    |                               |                               |        |
    |                               | 100 Trying                    |        |
    |                               |------------------------------>|        |
    |                               |                               |        |
    |                               | INVITE Carol                  |        |
    |                               |--------------------------------------->|
    |                               |                               |        |
    |                               |                             100 Trying |
    |                               |<---------------------------------------|
    |                               |                               |        |
    |                               |                            180 Ringing |
    |                               |<---------------------------------------|
    |                               |                               |        |
    |                               | 180 Ringing                   |        |
    |                               |------------------------------>|        |
    |                               |                               |        |
    |                               |          REFER Alice to Carol |        |
    |                               |<------------------------------|        |
    |                               |                               |        |
    |          REFER Alice to Carol |                               |        |
    |<------------------------------|                               |        |
    |                               |                               |        |
    | 603 Decline (badly formed)    |                               |        |
    |------------------------------>|                               |        |
    |                               |                               |        |
    |                               | 603 Decline (badly formed)    |        |
    |                               |------------------------------>|        |
    |                               |                               |        |

Example of REFER without this change...

Bob -> SBC (with to-tag)

Via: SIP/2.0/UDP 192.168.254.1:37142;branch=z9hG4bK736413830;rport
From: "Bob" <sip:[email protected]>;tag=1597134648
To: <sip:[email protected]>;tag=3515BA61-5C74B27600059AFF-1AEDC700
Call-ID: [email protected]
CSeq: 1093 REFER
Contact: <sip:[email protected]:37142>
Max-Forwards: 70
Supported: replaces, path, timer
User-Agent: SIP Phone
Refer-To: <sip:[email protected]?Replaces=1410034751-5060-148%40BJC.BGI.CEH.BAC%3Bto-tag%3D4C138EC7-5C74B285000F193E-1AEDC700%3Bfrom-tag%3D1429366398>
Referred-By: <sip:[email protected]>
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

SBC -> Alice (empty to-tag)

Via: SIP/2.0/UDP 192.168.1.1;branch=z9hG4bKsXpHwaHL;rport
From: "Bob" <sip:[email protected]>;tag=65FBE60B-5C74B27600059BDA-11ECC700
To: <sip:[email protected]>;tag=d95f9c51
CSeq: 12 REFER
Call-ID: 2CEAC963-5C74B27600059BDB-11ECC700
Max-Forwards: 70
Supported: replaces, path, timer
User-Agent: SBC
Referred-By: <sip:[email protected]>
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Refer-To: <sip:[email protected]?Replaces=72704219-5C74B285000F1A25-DB9F9700%3Bfrom-tag%3D6C8AA112-5C74B285000F1A24-DB9F9700%3Bto-tag%3D>
Contact: <sip:192.168.1.1:5060;transport=udp>
Content-Length: 0

@juha-h
Copy link
Contributor

juha-h commented Aug 2, 2021 via email

@juha-h
Copy link
Contributor

juha-h commented Aug 2, 2021

Also, Stefan must have had some good reason for commit 7ba4a52. I'm thus afraid that your PR would break some other, much more common use cases. Bob could REFER Alice to Carol without first calling Carol himself or could do the REFER after Carol has answered.

@juha-h
Copy link
Contributor

juha-h commented Apr 26, 2022

@BaTnz Could you check if this commit 6bfa7ab fixed your issue or would this PR still be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants