<!--
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:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio…
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.o…
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.
-->
nat module crashes if app_lua initialize fail.
### Troubleshooting
#### Reproduction
<!--
If the issue can be reproduced, describe how it can be done.
-->
kamailio.cfg
```txt
### kamailio5.6.4
debug=2
log_stderror=no
memdbg=5
memlog=5
log_facility=LOG_LOCAL0
log_prefix="{$mt $hdr(CSeq) $ci} "
children=4
auto_aliases=no
enable_sctp=no
# listen=udp:192.168.31.63:5060
# mpath="/usr/local/lib/kamailio/modules/"
loadmodule "kex.so"
loadmodule "corex.so"
loadmodule "tm.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "xlog.so"
loadmodule "ctl.so"
loadmodule "cfg_rpc.so"
loadmodule "nats.so"
loadmodule "app_lua.so"
# modparam("ctl", "binrpc", "unix:/run/kamailio/kamailio_ctl")
modparam("nats", "nats_url", "nats://127.0.0.1:4222")
modparam("nats", "num_publish_workers", 1)
modparam("nats", "subject_queue_group", "sipserver:group")
modparam("app_lua", "load", "/etc/kamailio/kamailio.lua")
request_route {
sl_send_reply("200", "OK");
}
```
kamailio.lua
```lua
cjson = require "cjson" -- but without cjson
```
#### 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.
-->
gdb kamailio core
```txt
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `kamailio'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f6691e9c62b in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
[Current thread is 1 (Thread 0x7f6692ac9740 (LWP 82969))]
bt
#0 0x00007f6691e9c62b in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
#1 0x00007f6691ea3856 in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
#2 0x00007f6691ea398f in uv_poll_stop () from /lib/x86_64-linux-gnu/libuv.so.1
#3 0x00007f6691f48b81 in nats_destroy_workers () at nats_mod.c:601
#4 0x00007f6691f48c01 in mod_destroy () at nats_mod.c:614
#5 0x000055dad0bb4752 in destroy_modules () at core/sr_module.c:842
#6 0x000055dad0977132 in cleanup (show_status=0) at main.c:561
#7 0x000055dad0978d97 in shutdown_children (sig=15, show_status=0) at main.c:704
#8 0x000055dad0993c7b in main (argc=1, argv=0x7ffd4ca63688) at main.c:3093
bt full
#0 0x00007f6691e9c62b in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
No symbol table info available.
#1 0x00007f6691ea3856 in ?? () from /lib/x86_64-linux-gnu/libuv.so.1
No symbol table info available.
#2 0x00007f6691ea398f in uv_poll_stop () from /lib/x86_64-linux-gnu/libuv.so.1
No symbol table info available.
#3 0x00007f6691f48b81 in nats_destroy_workers () at nats_mod.c:601
i = 0
worker = 0x7f668dceee10
pub_worker = 0x7f668dceeeb0
__func__ = "nats_destroy_workers"
#4 0x00007f6691f48c01 in mod_destroy () at nats_mod.c:614
__func__ = "mod_destroy"
#5 0x000055dad0bb4752 in destroy_modules () at core/sr_module.c:842
t = 0x7f6692368870
foo = 0x7f6692366d20
__func__ = "destroy_modules"
#6 0x000055dad0977132 in cleanup (show_status=0) at main.c:561
memlog = 0
__func__ = "cleanup"
#7 0x000055dad0978d97 in shutdown_children (sig=15, show_status=0) at main.c:704
__func__ = "shutdown_children"
#8 0x000055dad0993c7b in main (argc=1, argv=0x7ffd4ca63688) at main.c:3093
cfg_stream = 0x55dad295c380
c = -1
r = 0
tmp = 0x100000000 <error: Cannot access memory at address 0x100000000>
tmp_len = 0
port = 895
proto = 0
ahost = 0x0
aport = 0
options = 0x55dad0db4278 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
ret = -1
seed = 193248401
rfd = 4
debug_save = 0
debug_flag = 0
dont_fork_cnt = 0
n_lst = 0xc000
p = 0x0
--Type <RET> for more, q to quit, c to continue without paging--
st = {st_dev = 22, st_ino = 830, st_nlink = 2, st_mode = 16832, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 60, st_blksize = 4096, st_blocks = 0,
st_atim = {tv_sec = 1679270080, tv_nsec = 182554285}, st_mtim = {tv_sec = 1679531455, tv_nsec = 805444368}, st_ctim = {tv_sec = 1679531455, tv_nsec = 805444368},
__glibc_reserved = {0, 0, 0}}
tbuf = "\000\000\000\000\000\000\000\000\377\377\377\377\000\000\000\000x\230ْf\177\000\000кܒf\177", '\000' <repeats 42 times>, "pvْf\177\000\000\r\000\000\000\000\000\000\000\230\341ɒf\177\000\000\230\066\246L\375\177\000\000H\355\350\320\332U\000\000 \260ܒf\177\000\000\256\217ڒf\177\000\000\001", '\000' <repeats 15 times>, "x\230ْf\177\000\000\300\370ڒf\177\000\000\274\032\255\222f\177\000\000\000\066\246L\375\177\000\000\001", '\000' <repeats 15 times>, "\230\066\246L\375\177\000\000ڱڒf\177\000\000\000\000\000\000\000\000\000\000"...
option_index = 0
long_options = {{name = 0x55dad0db66e6 "help", has_arg = 0, flag = 0x0, val = 104}, {name = 0x55dad0db1524 "version", has_arg = 0, flag = 0x0, val = 118}, {
name = 0x55dad0db66eb "alias", has_arg = 1, flag = 0x0, val = 1024}, {name = 0x55dad0db66f1 "subst", has_arg = 1, flag = 0x0, val = 1025}, {
name = 0x55dad0db66f7 "substdef", has_arg = 1, flag = 0x0, val = 1026}, {name = 0x55dad0db6700 "substdefs", has_arg = 1, flag = 0x0, val = 1027}, {
name = 0x55dad0db670a "server-id", has_arg = 1, flag = 0x0, val = 1028}, {name = 0x55dad0db6714 "loadmodule", has_arg = 1, flag = 0x0, val = 1029}, {
name = 0x55dad0db671f "modparam", has_arg = 1, flag = 0x0, val = 1030}, {name = 0x55dad0db6728 "log-engine", has_arg = 1, flag = 0x0, val = 1031}, {
name = 0x55dad0db6733 "debug", has_arg = 1, flag = 0x0, val = 1032}, {name = 0x55dad0db6739 "cfg-print", has_arg = 0, flag = 0x0, val = 1033}, {
name = 0x55dad0db6743 "atexit", has_arg = 1, flag = 0x0, val = 1034}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}}
__func__ = "main"
```
#### 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).
-->
```
(paste your log messages here)
```
#### 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).
-->
```
(paste your sip traffic here)
```
### 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`
```
kamailio 5.6.4 (x86_64/linux) a004cf
```
* **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 `lsb_release -a` and `uname -a`)
-->
```
Debian11
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3401
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3401(a)github.com>
<!--
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:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio…
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.o…
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
Hi Team,
I am using kamailio as load balancer in my organization and I want to manipulate the cancel request from and to headers.
But kamailio is changing the requests when it sends out and its still using the one it receives from other end.
How do I change the kamailio to change the to domain when it sends the cancel request out?
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
### Troubleshooting
Code to handle cancel
if (is_method("CANCEL")) {
if (ends_with($td, "incoming.req.com")) {
xinfo("Updating CANCEL request");
uac_replace_to("sip:<number>@manipulated.to.domain.com");
$uac_req(turi)="sip:<number>@manipulated.to.domain.com";
append_hf("To: <"sip:<number>@manipulated.to.domain.com">");
#uac_req_send();
xinfo("Updating CANCEL request TD: $td");
}
if (t_check_trans()) {
route(RELAY);
}
exit;
}
SIP message:
CANCEL sip:<number>@mycompany.net SIP/2.0
Via: SIP/2.0/UDP <IP>;branch=z9hG4bK787.76dc73a7e90664fa84d8571e1281161d.0
Max-Forwards: 69
From: <sip:<fromNumber>@incoming.req.com>;tag=QQ8NBSygKDa0c
To: <sip:<toNumber>@incoming.req.com>
Call-ID: 1cc67943-bb08-4e52-9694-cb33210e7b3b
CSeq: 65568792 CANCEL
Content-Length: 0
Reason: Q.850;cause=16;text="NORMAL_CLEARING"
#### 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.
-->
```
(paste your debugging data here)
```
#### 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).
-->
```
(paste your log messages here)
```
#### 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).
-->
```
(paste your sip traffic here)
```
### 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`
```
(paste your output here)
```
* **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 `lsb_release -a` and `uname -a`)
-->
```
(paste your output here)
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3409
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3409(a)github.com>
Module: kamailio
Branch: master
Commit: 757cb48d3606ef23192812a17a66b48c1ce2ea0f
URL: https://github.com/kamailio/kamailio/commit/757cb48d3606ef23192812a17a66b48…
Author: Wolfgang Kampichler <dev(a)kampichler.info>
Committer: Wolfgang Kampichler <dev(a)kampichler.info>
Date: 2023-04-01T11:03:03+02:00
lost: additions to <via> path element and corrected loop detection
- LosT requests that allow recursion now include a <path> element that
contains one or more <via> elements. A loop error is indicated if a
returned target is already in the server list in the <path> element.
---
Modified: src/modules/lost/functions.c
Modified: src/modules/lost/response.c
Modified: src/modules/lost/response.h
Modified: src/modules/lost/utilities.c
Modified: src/modules/lost/utilities.h
---
Diff: https://github.com/kamailio/kamailio/commit/757cb48d3606ef23192812a17a66b48…
Patch: https://github.com/kamailio/kamailio/commit/757cb48d3606ef23192812a17a66b48…
Module: kamailio
Branch: master
Commit: 8d69c0d68347198ccaea57a8ac4eeb040d19287a
URL: https://github.com/kamailio/kamailio/commit/8d69c0d68347198ccaea57a8ac4eeb0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-03-31T18:24:24+02:00
tm: rename shortcuts to from/to/callid/cseq headers
- reflect better that they are with header names
- new fields to point to callid value and cseq number to facilitate use
of them directly without new parsing or printing with header names
---
Modified: src/modules/tm/h_table.c
Modified: src/modules/tm/h_table.h
Modified: src/modules/tm/t_cancel.c
Modified: src/modules/tm/t_fwd.c
Modified: src/modules/tm/t_lookup.c
Modified: src/modules/tm/t_msgbuilder.c
Modified: src/modules/tm/t_stats.c
Modified: src/modules/tm/uac.c
---
Diff: https://github.com/kamailio/kamailio/commit/8d69c0d68347198ccaea57a8ac4eeb0…
Patch: https://github.com/kamailio/kamailio/commit/8d69c0d68347198ccaea57a8ac4eeb0…
### Environment
- **OS**: Debian 11 (64-bit)
### Description
While attempting to start kamailio thu the `kamctl start` command, I had recieved a following output in the terminal:
**Note**: I had edited the PID_FILE variable and had set the value to: /run/kamailio.pid
```
-e database engine 'SQLITE' loaded
-e Control engine 'RPCFIFO' loaded
-e \E[37;33mINFO: Starting Kamailio :
-e \E[37;31mERROR: PID file /run/kamailio.pid does not exist -- Kamailio start failed
```
In my opinion, it's strange that the server complains about missing PID file, while attempting to run it and no other Kamailio instance is running
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3410
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3410(a)github.com>
<!-- 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 -->
segfault
```
#0 0x0000ffffb9934840 in cfg_update_local (no_cbs=0) at ../../core/cfg/cfg_struct.h:366
366 cfg_child_cb = cfg_child_cb->next;
(gdb) print cfg_child_cb
$1 = (cfg_child_cb_t *) 0x0
```
example lua:
```
function ksr_route_nats()
KSR.tm.t_newtran()
local tindex = KSR.pv.gete("$T(id_index)")
local tlabel = KSR.pv.gete("$T(id_label)")
KSR.tmx.t_suspend()
local req = {
jsonrpc = "2.0", method = "route",
id = tindex .. ':' .. tlabel,
params = {
from = KSR.pv.gete("$fu"),
to = KSR.pv.gete("$tu"),
}
}
local rpc = cjson.encode(req)
KSR.info("rpc: " .. rpc .. "\n")
KSR.nats.publish("cn.xswitch.ctrl.route", rpc)
KSR.x.exit();
end
function handle_nats_response(data)
msg = cjson.decode(data)
if (not msg) or (not msg.id) then return end
KSR.info("========= msg.id: " .. msg.id .. "\n")
if not msg.result then
KSR.error("response has no result\n")
return
end
tindex, tlabel = msg.id:match("(.+):(.+)")
if tindex and tlabel then
KSR.pv.sets('$var(nats_response)', data)
KSR.tmx.t_continue(tindex, tlabel, 'ksr_nats_continue')
end
end
```
I'm not sure if it's the proper fix, but this pr fixed the seg. Thanks.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3396
-- Commit Summary --
* core: fix a seg while t_continue with nats module
-- File Changes --
M src/core/cfg/cfg_struct.h (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3396.patchhttps://github.com/kamailio/kamailio/pull/3396.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3396
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3396(a)github.com>