<p></p>

<h3>Description</h3>

<p>Testing out rtp_media_server module's <code>rms_bridge()</code> 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.</p>
<p>Config slightly modified from <a href="https://github.com/kamailio/kamailio/blob/master/src/modules/rtp_media_server/config_example/kamailio.cfg">https://github.com/kamailio/kamailio/blob/master/src/modules/rtp_media_server/config_example/kamailio.cfg</a></p>
<pre><code>...
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:conference@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;
}
</code></pre>
<h3>Troubleshooting</h3>
<p>I added <code>loadmodule "uac.so"</code>, though I'm not sure it's required.</p>
<h4>Reproduction</h4>

<h4>Debugging Data</h4>

<p>I can only do a stack trace at the moment running this test in a systemd-nspawn container</p>
<pre><code>                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)
</code></pre>
<h4>Log Messages</h4>

<pre><code>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:conference@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:conference@example.com:5080]remote_uri[<sip:conference@example.com:5080>]local_uri[<sip:888@example.com>]
kamailio[275]: 10(275) DEBUG: tm [uac.c:450]: t_uac_prepare(): next_hop=<sip:conference@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
</code></pre>
<h4>SIP Traffic</h4>

<p>There is no SIP traffic generated to <code><sip:conference@example.com:5080></code></p>
<h3>Possible Solutions</h3>

<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>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
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>

<pre><code>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
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2524">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZO6SZ3UIR67YDRECKTSL4VWHANCNFSM4S2FXEKQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZPV7XEQDV2LMRKFCNDSL4VWHA5CNFSM4S2FXEK2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4K2R3XLA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2524",
"url": "https://github.com/kamailio/kamailio/issues/2524",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>