<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature 
requests. Please use this template only for bug reports.

If you have questions about using Kamailio or related to its configuration 
file, ask on sr-users mailing list:

  * http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

If you have questions about developing extensions to Kamailio or its existing C 
code, ask on sr-dev mailing list:

  * http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Please try to fill this template as much as possible for any issue. It helps 
the developers to troubleshoot the issue.

If there is no content to be filled in a section, the entire section can be 
removed.

You can delete the comments from the template sections when filling.

You can delete next line and everything above before submitting (it is a 
comment).
-->

### Description

<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
Testing out rtp_media_server module's `rms_bridge()` function with the 
intention of bridging A-leg to B-leg (an Asterisk conference server).  The 
B-leg never gets sent out and after the call times out, this testing instance 
crashes.

Config slightly modified from 
https://github.com/kamailio/kamailio/blob/master/src/modules/rtp_media_server/config_example/kamailio.cfg
```
...
loadmodule "uac.so"

event_route[rms:bridged] {
        xnotice("[rms:bridged] ...\n");
}

route {
        if (t_precheck_trans()) {
                t_check_trans();
                exit;
        }
        t_check_trans();

        if (is_method("REGISTER")) {
                save("location");
                exit;
        }

        xnotice("[$rm][$ci]\n");
        if (is_method("INVITE") && !has_totag()) {
                fix_nated_contact();

                if ($rU == "888") {
                        $var(target) = "sip:confere...@example.com:5080;";
                        if (!rms_bridge("$var(target)", "rms:bridged")) {
                                send_reply("503", "server error");
                                xerr("rtp_media_server bridge error!\n");
                        }
                        exit;
                }
                if (!rms_answer("rms:answered")) {
                        t_reply("503", "server error");
                        xerr("rtp_media_server error!\n");
                        exit;
                }
        }
        if(rms_dialog_check())
                rms_sip_request();
        exit;
}
```
### Troubleshooting
 I added `loadmodule "uac.so"`, though I'm not sure it's required.

#### Reproduction

<!--
If the issue can be reproduced, describe how it can be done.
-->

#### Debugging Data

<!--
If you got a core dump, use gdb to extract troubleshooting data - full 
backtrace,
local variables and the list of the code at the issue location.

  gdb /path/to/kamailio /path/to/corefile
  bt full
  info locals
  list

If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->
I can only do a stack trace at the moment running this test in a systemd-nspawn 
container
```
                Stack trace of thread 589:
                #0  0x00007fb449848518 n/a 
(/usr/lib64/kamailio/modules/rtp_media_server.so + 0x2f518)
                #1  0x00007fb44982682b n/a 
(/usr/lib64/kamailio/modules/rtp_media_server.so + 0xd82b)
                #2  0x00000000005cca6b n/a (/usr/sbin/kamailio + 0x1cca6b)
                #3  0x000000000041cf90 n/a (/usr/sbin/kamailio + 0x1cf90)
                #4  0x000000000041e9ea n/a (/usr/sbin/kamailio + 0x1e9ea)
                #5  0x0000000000421c65 n/a (/usr/sbin/kamailio + 0x21c65)
                #6  0x000000000042c61c n/a (/usr/sbin/kamailio + 0x2c61c)
                #7  0x0000000000434cbd n/a (/usr/sbin/kamailio + 0x34cbd)
                #8  0x00007fb44a8b0042 __libc_start_main (libc.so.6 + 0x27042)
                #9  0x000000000041bbde n/a (/usr/sbin/kamailio + 0x1bbde)
```

#### Log Messages

<!--
Check the syslog file and if there are relevant log messages printed by 
Kamailio, add them next, or attach to issue, or provide a link to download them 
(e.g., to a pastebin site).
-->

```
kamailio[275]: 10(275) INFO: rtp_media_server [rtp_media_server.c:254]: 
rms_dialog_action_check(): dialog action RMS_BRIDGING 
[0_3746724993@2001:db8::99]
kamailio[275]: 10(275) INFO: rtp_media_server [rtp_media_server.c:583]: 
rms_bridging_call(): parsed[sip:confere...@example.com:5080][0]
kamailio[275]: 10(275) INFO: rtp_media_server [rtp_media_server.c:599]: 
rms_bridging_call(): 
si[0x7f83fddb78e0]call-id[0_3746724993@2001:db8::99]cseq[0]ruri[32|sip:confere...@example.com:5080]remote_uri[<sip:confere...@example.com:5080>]local_uri[<sip:8...@example.com>]
kamailio[275]: 10(275) DEBUG: tm [uac.c:450]: t_uac_prepare(): 
next_hop=<sip:confere...@example.com:508>
kamailio[275]: 10(275) DEBUG: <core> [core/dns_cache.c:527]: _dns_hash_find(): 
(example.com(12), 1), h=205
kamailio[275]: 10(275) DEBUG: <core> [core/resolve.c:985]: get_record(): 
skipping 2 NS (p=0x9a0e6e, end=0x9a0ef2)
kamailio[275]: 10(275) DEBUG: <core> [core/resolve.c:998]: get_record(): 
parsing 4 ARs (p=0x9a0e9a, end=0x9a0ef2)
kamailio[275]: 10(275) DEBUG: <core> [core/dns_cache.c:1633]: 
dns_get_related(): (0x7f83fddbb878 (example.com, 1), 1, *0x7f8406d319f0) (0)
kamailio[275]: 10(275) DEBUG: <core> [core/dns_cache.c:739]: 
dns_cache_add_unsafe(): adding example.com(12) 1 (flags=0) at 205
kamailio[275]: 10(275) DEBUG: tm [uac.c:158]: dlg2hash(): hashid 35754
kamailio[275]: 10(275) DEBUG: tm [uac.c:678]: send_prepared_request_impl(): 
uac: 0x7f83fddb9a10  branch: 0  to 10.77.79.3:508
kamailio[275]: 10(275) DEBUG: <core> [core/onsend.c:50]: run_onsend(): required 
parameters are not available - ignoring
kamailio[275]: 10(275) ERROR: rtp_media_server [rtp_media_server.c:622]: 
rms_bridging_call(): tmb.t_request_within ok
```

#### SIP Traffic

<!--
If the issue is exposed by processing specific SIP messages, grab them with 
ngrep or save in a pcap file, then add them next, or attach to issue, or 
provide a link to download them (e.g., to a pastebin site).
-->

There is no SIP traffic generated to `<sip:confere...@example.com:5080>`

### Possible Solutions

<!--
If you found a solution or workaround for the issue, describe it. Ideally, 
provide a pull request with a fix.
-->

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
version: kamailio 5.4.1-8.gitd43872c11e.fc32.1 (x86_64/linux) 09fd6a
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, 
USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, 
DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, 
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, 
TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, 
BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 09fd6a 
compiled on 00:00:00 Oct 21 2020 with gcc 10.2.1
```

* **Operating System**:

<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 
16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `uname -a`)
-->

```
Linux kamtest 5.8.16-200.fc32.x86_64 #1 SMP Mon Oct 19 14:17:16 UTC 2020 x86_64 
x86_64 x86_64 GNU/Linux
```


-- 
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/2524
_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to