<!--
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_serv…
```
...
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;
}
```
### 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: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
```
#### 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:conference@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 Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [X] Commit message has the format required by CONTRIBUTING guide
- [X] Commits are split per component (core, individual modules, libs, utils, ...)
- [X] Each component has a single commit (if not, squash them into one commit)
- [X] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [X] PR should be backported to stable branches
- [X] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
append after last eader occurance
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2526
-- Commit Summary --
* textops: fix append_hf function
-- File Changes --
M src/modules/textops/textops.c (18)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2526.patchhttps://github.com/kamailio/kamailio/pull/2526.diff
--
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/pull/2526
Module: kamailio
Branch: 5.4
Commit: 900a05c4ba32513ebb61428ef53a4d1705f58443
URL: https://github.com/kamailio/kamailio/commit/900a05c4ba32513ebb61428ef53a4d1…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2020-10-26T11:16:32+01:00
modules: readme files regenerated - modules ... [skip ci]
---
Modified: src/modules/textops/README
---
Diff: https://github.com/kamailio/kamailio/commit/900a05c4ba32513ebb61428ef53a4d1…
Patch: https://github.com/kamailio/kamailio/commit/900a05c4ba32513ebb61428ef53a4d1…
---
diff --git a/src/modules/textops/README b/src/modules/textops/README
index bd67b08983..74543b05d7 100644
--- a/src/modules/textops/README
+++ b/src/modules/textops/README
@@ -741,10 +741,13 @@ if (has_body("multipart/mixed")) {
4.23. append_to_reply(txt)
- Append txt as header to the reply.
+ Append txt as header to the reply that is going to be generated by
+ Kamailio (e.g., via sl_send_reply(...)).
Meaning of the parameters is as follows:
- * txt - String which may contains pseudo-variables.
+ * txt - String which may contains pseudo-variables. Note that the
+ value has to be ended with "\r\n" (end of header characters
+ sequence).
This function can be used from REQUEST_ROUTE, BRANCH_ROUTE,
FAILURE_ROUTE, ERROR_ROUTE.
@@ -757,12 +760,14 @@ append_to_reply("Foo: $rm at $Ts\r\n");
4.24. append_hf(txt[, hdr])
- Appends 'txt' as header after first header field or after last 'hdr'
- header field.
+ Appends 'txt' as header at the end of the all headers, or after last
+ header named 'hdr' if the second parameter is provided.
Meaning of the parameters is as follows:
* txt - Header field to be appended. The value can contain
- pseudo-variables which will be replaced at run time.
+ pseudo-variables which will be replaced at run time. Note that the
+ value has to be ended with "\r\n" (end of header characters
+ sequence).
* hdr - Header name after which the 'txt' is appended.
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
@@ -776,12 +781,14 @@ append_hf("From-username: $fU\r\n", "Call-ID");
4.25. insert_hf(txt[, hdr])
- Inserts 'txt' as header before the first header field or before first
- 'hdr' header field if 'hdr' is given.
+ Inserts 'txt' as header before the first header field, or before first
+ header named 'hdr'if the second parameter is provided.
Meaning of the parameters is as follows:
* txt - Header field to be inserted. The value can contain
- pseudo-variables which will be replaced at run time.
+ pseudo-variables which will be replaced at run time. Note that the
+ value has to be ended with "\r\n" (end of header characters
+ sequence).
* hdr - Header name before which the 'txt' is inserted.
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
Module: kamailio
Branch: 5.4
Commit: 7cd88cf05f25a5a5883d936285ac51f82911e9af
URL: https://github.com/kamailio/kamailio/commit/7cd88cf05f25a5a5883d936285ac51f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-10-26T11:00:46+01:00
textops: docs - some enhancements to basic header operations functions
(cherry picked from commit 374f0f05bdf27ddaf5d8652560738fbfb886c43c)
---
Modified: src/modules/textops/doc/textops_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/7cd88cf05f25a5a5883d936285ac51f…
Patch: https://github.com/kamailio/kamailio/commit/7cd88cf05f25a5a5883d936285ac51f…
---
diff --git a/src/modules/textops/doc/textops_admin.xml b/src/modules/textops/doc/textops_admin.xml
index a8685510a0..44540841d4 100644
--- a/src/modules/textops/doc/textops_admin.xml
+++ b/src/modules/textops/doc/textops_admin.xml
@@ -872,13 +872,15 @@ if (has_body("multipart/mixed")) {
<function moreinfo="none">append_to_reply(txt)</function>
</title>
<para>
- Append txt as header to the reply.
+ Append txt as header to the reply that is going to be generated by
+ &kamailio; (e.g., via sl_send_reply(...)).
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>txt</emphasis> - String which may contains
- pseudo-variables.
+ pseudo-variables. Note that the value has to be ended with "\r\n"
+ (end of header characters sequence).
</para>
</listitem>
</itemizedlist>
@@ -902,15 +904,16 @@ append_to_reply("Foo: $rm at $Ts\r\n");
<function moreinfo="none">append_hf(txt[, hdr])</function>
</title>
<para>
- Appends 'txt' as header after first header field or after
- last 'hdr' header field.
+ Appends 'txt' as header at the end of the all headers, or after
+ last header named 'hdr' if the second parameter is provided.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>txt</emphasis> - Header field to be appended. The
value can contain pseudo-variables which will be replaced at run
- time.
+ time. Note that the value has to be ended with "\r\n" (end of header
+ characters sequence).
</para>
</listitem>
<listitem>
@@ -939,15 +942,16 @@ append_hf("From-username: $fU\r\n", "Call-ID");
<function moreinfo="none">insert_hf(txt[, hdr])</function>
</title>
<para>
- Inserts 'txt' as header before the first header field or before
- first 'hdr' header field if 'hdr' is given.
+ Inserts 'txt' as header before the first header field, or before
+ first header named 'hdr'if the second parameter is provided.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para><emphasis>txt</emphasis> - Header field to be inserted. The
value can contain pseudo-variables which will be replaced at run
- time.
+ time. Note that the value has to be ended with "\r\n" (end of header
+ characters sequence).
</para>
</listitem>
<listitem>