OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.25k stars 573 forks source link

[BUG]rtp_relay on re-INVITE doesn't update SDP #3234

Open devoxy1 opened 10 months ago

devoxy1 commented 10 months ago

Hello!

I'm testing scenario with b2b and REFER on opensips+rtpengine and notice an issue with incorrect SDP on re-invites. The scenario is A -INVITE--> Opensips -INVITE--> B A <-200OK-- Opensips <-200OK-- B ------ Opensips <-REFER-- B ------ Opensips --INVITE-> C ------ Opensips <-200OK-- C ------ Opensips --BYE-> B A <-re-INVITE-- Opensips --re-INVITE-> B

I engage rtp_relay module on b2b_init to use rtpengine. On initial INVITE everything works fine and SDP IP for media is changed to rtpengine on both INVITE and 200OK. However once REFER is complete opensips sends re-invite to A and C and in new INVITE incorrect IP is passed (of A and C respectively).

Piece of my code:

...
if (!has_totag()) {
        b2b_server_new("caller",,$avp(extra_hdrs),$avp(extra_hdr_bodies));
        b2b_client_new("callee", "$ru",,,,$avp(b2b_hdrs),$avp(b2b_hdr_bodies));

        xlog("L_INFO","[$ci] [$rm] [ROUTE] RTP Relay Engage");
        rtp_relay_engage("rtpengine",0);
        # initialize B2B session
        xlog("L_INFO","[$ci] [$rm] [ROUTE] B2B logic key: $b2b_logic.key");
        b2b_init_request("refer");

        exit;
    }
...

route[b2b_logic_request] {

    xlog("L_INFO", "[$ci] [$rm] [B2B_LOGIC_REQUEST] Incoming B2B request from $fu, entity: $b2b_logic.entity(id). Logic key: $b2b_logic.key\n");    

    if ($rm != "REFER") {
    # for requests other than REFER, no special actions needs to be done,
    # just pass the request to the peer
        xlog("L_INFO", "[$ci] [$rm] [B2B_LOGIC_REQUEST] Passing request - From-tag: $ft, To-tag: $tt");
            b2b_pass_request();
            exit;
    }

    xlog("L_INFO", "[$ci] [$rm] [B2B_LOGIC_REQUEST] Accepting REFER from $fu, entity: $b2b_logic.entity(id)\n");
    b2b_send_reply(202, "Accepted");

        xlog("L_INFO", "[$ci] [$rm] [B2B_LOGIC_REQUEST] BLIND TRANSFER - Refer-To: $hdr(Refer-To)");
        xlog("L_INFO", "[$ci] [$rm] [B2B_LOGIC_REQUEST] Refer-To: $hdr(Refer-To)");
        $var(uri_transform)=$(hdr(Refer-To){nameaddr.uri});
        $var(refer-to)=$(var(uri_transform){s.select,0,?});

        xlog("L_INFO", "[$ci] [$rm] [B2B_LOGIC_REQUEST] Incoming socket: $socket_in");
        $socket_out="PRIVATE";
        force_send_socket("$socket_out");

        b2b_client_new("referee", $var(refer-to),,,, $avp(b2b_hdrs), $avp(b2b_hdr_bodies));

        # bridge the referrer's peer with the referee
        b2b_bridge("peer", "referee",,"rollback-failed,notify,no-late-sdp");
}

OpenSIPS version you are running

version: opensips 3.4.2 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: 6cfb172f0
main.c compiled on 14:32:15 Oct 24 2023 with gcc 9

Describe the bug

To Reproduce Steps to reproduce the behavior: Example:

  1. Call from A to B via opensips
  2. B sends REFER to transfer the call to C
  3. Opensips accepts REFER and send INVITE to C
  4. C accepts the call
  5. Call with B is hung up
  6. Opensips send re-INVITE to both A and C with incorrect SDP

Expected behavior re-INVITE sends rtpengine IP in SDP

Relevant System Logs

OS/environment information

Additional context

devoxy1 commented 10 months ago

This issue might be related to this one 3116, may be the same issue on both

github-actions[bot] commented 9 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 9 months ago

Up

github-actions[bot] commented 9 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 9 months ago

up

github-actions[bot] commented 8 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 8 months ago

Up

devoxy1 commented 8 months ago

This is still actual. Without no-late-sdp flag and even without re-invite SDP still not updated on final ACK of referred call. A -INVITE--> Opensips -INVITE--> B (both legs SDP is updated correctly with rtpengine IP) REFER to C A -INVITE--> Opensips -INVITE--> C (First INVITE no SDP, ACK - SDP is not updated)

github-actions[bot] commented 7 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 7 months ago

up

github-actions[bot] commented 6 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 6 months ago

up

razvancrainea commented 6 months ago

@devoxy1 can you please check the latest sources, which should include the fix in 1339b7acb4537b4b916d4f804cc4c1c55a61c24d and let us know if this still happens?

devoxy1 commented 6 months ago

Hello @razvancrainea! I recompiled opensips with latest master branch but when i do my scenario with REFER i get segfault everytime on the moment new leg is created

Here is dump that is generated

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/opensips...
[New LWP 1394028]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/usr/sbin/opensips -P /var/run/opensips/opensips.pid -f /etc/opensips/opensips.'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xffffff28958948ff in ?? ()

and logfile: https://file.io/yNj28F97lAib

razvancrainea commented 6 months ago

@devoxy1 it looks like the core dump is not correct, as it does not contain any information. Can you please make sure you get a clean core dump, so we can investigate this crash?

Best regards, Răzvan

devoxy1 commented 6 months ago

Hello @razvancrainea, It seems i'm unable to get correct core file, i did all by instruction: disable apport, indicate folder with -w, rename core pattern, but i still get the same core files of size 268M with the similar content. I did core dumps before they usually came out fine with lots of info but this one i cannot seem to get correct. Is there anything else i can try?

github-actions[bot] commented 6 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 6 months ago

Up

github-actions[bot] commented 5 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 5 months ago

Up

github-actions[bot] commented 4 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 4 months ago

UP

github-actions[bot] commented 3 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 3 months ago

UP

github-actions[bot] commented 2 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 2 months ago

UP

github-actions[bot] commented 2 months ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 2 months ago

up

github-actions[bot] commented 1 month ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 1 month ago

Up

github-actions[bot] commented 1 week ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

devoxy1 commented 6 days ago

up