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

Adding CSeq seq number to transaction id #161

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

Conversation

MayamaTakeshi
Copy link
Contributor

Hi,
I got into a situation where I have to deal with a SIP UAC that doesn't add a branch parameter to the Via header (very, very old hardware):

INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.33.33
To: 7123412341234<sip:[email protected]:5060>
From: 1122334455<sip:[email protected]:5060>;tag=203836303869c
Call-ID: [email protected]
Contact: 05068601704<sip:[email protected]:5060>
User-Agent: Excel_CSP/83.11.52
Supported: timer
Session-Expires: 120
Min-SE: 119
CSeq: 1 INVITE
Content-Type: application/sdp
Content-Length: 141

v=0
o=sip 0 0 IN IP4 192.168.33.33
s=SIP_Call
c=IN IP4 192.168.89.2
t=0 0
m=audio 16152 RTP/AVP 0 96
a=rtpmap:96 telephone-event/8000

I need to interconnect this with a UAS that doesn't like this and keeps resending non-2XX replies because the ACK for the reply doesn't match a transaction:

                   UAC                           UAS
          ──────────┬─────────          ──────────┬─────────
  15:01:53.560232   │        INVITE (SDP)         │
        +0.001028   │ ──────────────────────────> │
  15:01:53.561260   │  422 Session Timer Too Smal │
        +0.001593   │ <────────────────────────── │
  15:01:53.562853   │             ACK             │
        +0.001135   │ ──────────────────────────> │
  15:01:53.563988   │        INVITE (SDP)         │
        +0.001188   │ ──────────────────────────> │
  15:01:53.565176   │         100 Trying          │
        +0.420852   │ <────────────────────────── │
  15:01:53.986028   │  422 Session Timer Too Smal │          
        +1.005857   │ <────────────────────────── │
  15:01:54.991885   │  422 Session Timer Too Smal │
        +0.867627   │ <<<──────────────────────── │
  15:01:55.859512   │  183 Session Progress (SDP) │
        +0.255927   │ <────────────────────────── │
  15:01:56.115439   │  183 Session Progress (SDP) │
        +0.870192   │ <<<──────────────────────── │
  15:01:56.985631   │  422 Session Timer Too Smal │          
        +4.011941   │ <────────────────────────── │          
  15:02:00.997572   │  422 Session Timer Too Smal │          
        +3.776420   │ <<<──────────────────────── │          
  15:02:04.773992   │        200 OK (SDP)         │          
        +0.016057   │ <────────────────────────── │          
  15:02:04.790049   │             ACK             │          
        +0.199699   │ ──────────────────────────> │          
  15:02:04.989748   │  422 Session Timer Too Smal │          
        +4.006390   │ <────────────────────────── │          
  15:02:08.996138   │  422 Session Timer Too Smal │          
        +3.998245   │ <<<──────────────────────── │          
  15:02:12.994383   │  422 Session Timer Too Smal │          
        +3.991549   │ <<<──────────────────────── │          
  15:02:16.985932   │  422 Session Timer Too Smal │          
        +4.003844   │ <<<──────────────────────── │          
  15:02:20.989776   │  422 Session Timer Too Smal │          
        +0.759984   │ <<<──────────────────────── │          
  15:02:21.749760   │             BYE             │          
        +0.021047   │ ──────────────────────────> │          
  15:02:21.770807   │           200 OK            │          
        +3.232966   │ <────────────────────────── │          
  15:02:25.003773   │  422 Session Timer Too Smal │      

Obs: also, the UAC sends the ACK only once.

At first i tried to put opensips between UAC and UAS but it turned out it doesn't like the Via without the branch parameter either and also keeps resending the non-2XX replies.
So I decided to use the proxy module for this and it almost worked:

                   UAC                       proxy_iface1                  proxy_iface2                      UAS
          ----------+---------          ----------+---------          ----------+---------          ----------+---------
                    |        INVITE (SDP)         |                             |                             |         
  13:57:20.084245   | --------------------------> |                             |                             |         
        +0.028985   |                             |                             |        INVITE (SDP)         |         
  13:57:20.113230   |                             |                             | --------------------------> |         
        +0.001111   |                             |                             |  422 Session Timer Too Smal |         
  13:57:20.114341   |                             |                             | <-------------------------- |         
        +0.003503   |  422 Session Timer Too Smal |                             |                             |         
  13:57:20.117844   | <-------------------------- |                             |                             |         
        +0.000139   |                             |                             |             ACK             |         
  13:57:20.117983   |                             |                             | --------------------------> |         
        +0.001657   |             ACK             |                             |                             |         
  13:57:20.119640   | --------------------------> |                             |                             |         
        +0.001140   |        INVITE (SDP)         |                             |                             |         
  13:57:20.120780   | --------------------------> |                             |                             |         
        +0.595133   |        INVITE (SDP)         |                             |                             |         
  13:57:20.715913   | ------------------------>>> |                             |                             |         
        +0.999977   |        INVITE (SDP)         |                             |                             |         
  13:57:21.715890   | ------------------------>>> |                             |                             |         
        +2.000052   |        INVITE (SDP)         |                             |                             |         
  13:57:23.715942   | ------------------------>>> |                             |                             |         
        +3.999959   |        INVITE (SDP)         |                             |                             |         
  13:57:27.715901   | ------------------------>>> |                             |                             |         
        +0.003354   |                             |                             |        INVITE (SDP)         |         
  13:57:27.719255   |                             |                             | --------------------------> |         
        +0.001035   |                             |                             |         100 Trying          |         
  13:57:27.720290   |                             |                             | <-------------------------- |         
        +0.004277   |         100 Trying          |                             |                             |         
  13:57:27.724567   | <-------------------------- |                             |                             |         
        +1.050465   |                             |                             |  183 Session Progress (SDP) |         
  13:57:28.775032   |                             |                             | <-------------------------- |         
        +0.002335   |  183 Session Progress (SDP) |                             |                             |         
  13:57:28.777367   | <-------------------------- |                             |                             |         
       +21.509662   |                             |                             |     408 Request Timeout     |         
  13:57:50.287029   |                             |                             | <-------------------------- |         
        +0.001527   |     408 Request Timeout     |                             |                             |         
  13:57:50.288556   | <-------------------------- |                             |                             |         
        +0.000184   |                             |                             |             ACK             |         
  13:57:50.288740   |                             |                             | --------------------------> |         
        +0.001586   |             ACK             |                             |                             |         
  13:57:50.290326   | --------------------------> |                             |                             |         
                    |                             |                             |                             |         
                    |                             |                             |                             

The problem is that the second INVITE from the UAC cannot be distinguished from the first INVITE because there is no branch in the Via header. So the second INVITE is only relayed when the INVITE transaction expires.
So i changed function makeTransactionId() to use the CSeq seq num and now things are OK:

                   UAC                       proxy_iface1                  proxy_iface2                      UAS
          ----------+---------          ----------+---------          ----------+---------          ----------+---------
                    |        INVITE (SDP)         |                             |                             |
  15:38:43.352988   | --------------------------> |                             |                             |
        +0.029891   |                             |                             |        INVITE (SDP)         |
  15:38:43.382879   |                             |                             | --------------------------> |
        +0.001147   |                             |                             |  422 Session Timer Too Smal |
  15:38:43.384026   |                             |                             | <-------------------------- |
        +0.003368   |  422 Session Timer Too Smal |                             |                             |
  15:38:43.387394   | <-------------------------- |                             |                             |
        +0.000177   |                             |                             |             ACK             |
  15:38:43.387571   |                             |                             | --------------------------> |
        +0.001562   |             ACK             |                             |                             |
  15:38:43.389133   | --------------------------> |                             |                             |
        +0.001205   |        INVITE (SDP)         |                             |                             |
  15:38:43.390338   | --------------------------> |                             |                             |
        +0.002409   |                             |                             |        INVITE (SDP)         |
  15:38:43.392747   |                             |                             | --------------------------> |
        +0.000942   |                             |                             |         100 Trying          |
  15:38:43.393689   |                             |                             | <-------------------------- |
        +0.001001   |         100 Trying          |                             |                             |
  15:38:43.394690   | <-------------------------- |                             |                             |
        +0.874079   |                             |                             |  183 Session Progress (SDP) |
  15:38:44.268769   |                             |                             | <-------------------------- |
        +0.002480   |  183 Session Progress (SDP) |                             |                             |
  15:38:44.271249   | <-------------------------- |                             |                             |
       +21.496784   |                             |                             |     408 Request Timeout     |
  15:39:05.768033   |                             |                             | <-------------------------- |
        +0.005000   |     408 Request Timeout     |                             |                             |
  15:39:05.773033   | <-------------------------- |                             |                             |
        +0.000273   |                             |                             |             ACK             |
  15:39:05.773306   |                             |                             | --------------------------> |
        +0.001742   |             ACK             |                             |                             |
  15:39:05.775048   | --------------------------> |                             |                             |                      

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