Module: kamailio
Branch: master
Commit: f3454dd9f2d065e7757e9d9680b815481d08269c
URL: https://github.com/kamailio/kamailio/commit/f3454dd9f2d065e7757e9d9680b8154…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-01-10T18:37:59+01:00
core: renamed global is_main to _ksr_is_main
- safer to avoid conflicts with other libs
---
Modified: src/core/globals.h
Modified: src/core/pt.c
Modified: src/main.c
---
Diff: https://github.com/kamailio/kamailio/commit/f3454dd9f2d065e7757e9d9680b8154…
Patch: https://github.com/kamailio/kamailio/commit/f3454dd9f2d065e7757e9d9680b8154…
---
diff --git a/src/core/globals.h b/src/core/globals.h
index f3777d37a8..3a10439142 100644
--- a/src/core/globals.h
+++ b/src/core/globals.h
@@ -159,7 +159,7 @@ extern char *avp_db_url; /* db url used by user preferences (AVPs) */
extern int reply_to_via;
-extern int is_main;
+extern int _ksr_is_main;
extern int fixup_complete;
/* debugging level for dumping memory status */
diff --git a/src/core/pt.c b/src/core/pt.c
index a3094a29fb..e3dc94d5a3 100644
--- a/src/core/pt.c
+++ b/src/core/pt.c
@@ -262,7 +262,7 @@ int fork_process(int child_id, char *desc, int make_sock)
#ifdef USE_TCP
sockfd[0]=sockfd[1]=-1;
if(make_sock && !tcp_disable){
- if (!is_main){
+ if (!_ksr_is_main){
LM_CRIT("called from a non "
"\"main\" process! If forking from a module's "
"child_init() fork only if rank==PROC_MAIN or"
@@ -297,7 +297,7 @@ int fork_process(int child_id, char *desc, int make_sock)
goto error;
}else if (pid==0){
/* child */
- is_main=0; /* a forked process cannot be the "main" one */
+ _ksr_is_main=0; /* a forked process cannot be the "main" one */
process_no=child_process_no;
daemon_status_on_fork_cleanup();
/* close tcp unix sockets if this is not tcp main */
@@ -401,8 +401,8 @@ int fork_tcp_process(int child_id, char *desc, int r, int *reader_fd_1)
reader_fd[0]=reader_fd[1]=-1;
ret=-1;
- if (!is_main){
- LM_CRIT("called from a non \"main\" process\n");
+ if (!_ksr_is_main){
+ LM_CRIT("called from a non \"main\" process (%d)\n", _ksr_is_main);
goto error;
}
if (tcp_main_pid){
@@ -441,7 +441,7 @@ int fork_tcp_process(int child_id, char *desc, int r, int *reader_fd_1)
goto end;
}
if (pid==0){
- is_main=0; /* a forked process cannot be the "main" one */
+ _ksr_is_main=0; /* a forked process cannot be the "main" one */
process_no=child_process_no;
/* close unneeded unix sockets */
close_extra_socks(child_id, process_no);
diff --git a/src/main.c b/src/main.c
index 60435e865e..016a90cabe 100644
--- a/src/main.c
+++ b/src/main.c
@@ -508,7 +508,7 @@ extern FILE* yyin;
extern int yyparse(void);
-int is_main=1; /* flag = is this the "main" process? */
+int _ksr_is_main=1; /* flag = is this the "main" process? */
int fixup_complete=0; /* flag = is the fixup complete ? */
char* pid_file = 0; /* filename as asked by use */
@@ -649,7 +649,7 @@ static void kill_all_children(int signum)
* (only main can add processes, so from main is safe not to lock
* and moreover it avoids the lock-holding suicidal children problem)
*/
- if (!is_main) lock_get(process_lock);
+ if (!_ksr_is_main) lock_get(process_lock);
for (r=1; r<*process_count; r++){
if (r==process_no) continue; /* try not to be suicidal */
if (pt[r].pid) {
@@ -658,7 +658,7 @@ static void kill_all_children(int signum)
else LM_CRIT("killing: %s > %d no pid!!!\n",
pt[r].desc, pt[r].pid);
}
- if (!is_main) lock_release(process_lock);
+ if (!_ksr_is_main) lock_release(process_lock);
}
}
@@ -832,7 +832,7 @@ void sig_usr(int signo)
#endif
#endif
- if (is_main){
+ if (_ksr_is_main){
if (sig_flag==0) sig_flag=signo;
else /* previous sig. not processed yet, ignoring? */
return; ;
@@ -3070,7 +3070,7 @@ int main(int argc, char** argv)
if (ret < 0)
goto error;
/*kill everything*/
- if (is_main) shutdown_children(SIGTERM, 0);
+ if (_ksr_is_main) shutdown_children(SIGTERM, 0);
if (!dont_daemonize) {
if (daemon_status_send(0) < 0)
fprintf(stderr, "error sending exit status: %s [%d]\n",
@@ -3081,7 +3081,7 @@ int main(int argc, char** argv)
error:
/*kill everything*/
- if (is_main) shutdown_children(SIGTERM, 0);
+ if (_ksr_is_main) shutdown_children(SIGTERM, 0);
if (!dont_daemonize) {
if (daemon_status_send((char)-1) < 0)
fprintf(stderr, "error sending exit status: %s [%d]\n",
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] 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 -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
Adds Publish function to NATS module.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2978
-- Commit Summary --
* NATS: add new function `nats_publish()`
-- File Changes --
M src/modules/nats/Makefile (2)
A src/modules/nats/defs.h (40)
M src/modules/nats/doc/nats_admin.xml (23)
M src/modules/nats/nats_mod.c (44)
M src/modules/nats/nats_mod.h (17)
A src/modules/nats/nats_pub.c (157)
A src/modules/nats/nats_pub.h (46)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2978.patchhttps://github.com/kamailio/kamailio/pull/2978.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2978
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/2978(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
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [X] 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 -->
- [ ] PR should be backported to stable branches
- [X] Tested changes locally
- [X] Related to issue #2984
#### Description
A new option to "listen" has been added called "virtual". This sets a flag on the listening socket to modify the behaviour of grep_sock_info. When this flag is set, grep_sock_info will only consider the listening IP a match if the IP is found in the system's current list of local IP addresses. If the IP is not currently local, then the matching IP is ignored.
If the virtual flag is not set on the socket then existing behaviour used instead.
This feature is intended for scenarios where you have two Kamailio nodes in active/active setup, with virtual IPs, where you need to be able to listen on a virtual IP but it may not always be active locally. With this flag applied to a `listen=` socket, Kamailio will only consider traffic destined to this IP local, when the IP is actually active on the system, and other times the match is ignored.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2985
-- Commit Summary --
* core: listen can now have a "virtual" flag to check for nonlocal floating IPs.
* etc: kamailio.cfg - added example use of listen's new virtual flag.
* core: Added virtual flag to output of core.sockets_list
* corex: Added virtual flag to output of "corex.list_sockets"
* ims_ipsec_pcscf: Added virtual flag to output of sockets list.
-- File Changes --
M etc/kamailio.cfg (2)
M src/core/cfg.lex (2)
M src/core/cfg.y (83)
M src/core/core_cmd.c (10)
M src/core/ip_addr.h (1)
M src/core/socket_info.c (85)
M src/modules/corex/corex_rpc.c (5)
M src/modules/ims_ipsec_pcscf/ims_ipsec_pcscf_mod.c (8)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2985.patchhttps://github.com/kamailio/kamailio/pull/2985.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2985
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/2985(a)github.com>
Module: kamailio
Branch: master
Commit: 3e7d5ed34033067377ed9034e4ec49be444ca6fe
URL: https://github.com/kamailio/kamailio/commit/3e7d5ed34033067377ed9034e4ec49b…
Author: Rhys Hanrahan <rhys(a)nexusone.com.au>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-01-07T12:27:25+01:00
core: Updated check_local_addresses to use getifaddrs
Changed virtual socket code to use getifaddrs instead of gethostbyname as this avoids lookups against the hosts file, which causes incorrect results.
---
Modified: src/core/socket_info.c
---
Diff: https://github.com/kamailio/kamailio/commit/3e7d5ed34033067377ed9034e4ec49b…
Patch: https://github.com/kamailio/kamailio/commit/3e7d5ed34033067377ed9034e4ec49b…
---
diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 8ee6cd0b32..afb1dd5603 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -575,8 +575,8 @@ struct socket_info** get_sock_info_list(unsigned short proto)
*/
static int check_local_addresses(struct socket_info* si)
{
- struct hostent* he;
- struct utsname myname;
+ int match = 0;
+ struct ifaddrs *ifap, *ifa;
if (si == NULL) {
LM_ERR("Socket info is NULL. Returning no match.\n");
@@ -589,40 +589,41 @@ static int check_local_addresses(struct socket_info* si)
return 1;
}
- if (uname(&myname) <0){
- LM_ERR("Cannot determine hostname. Guessing a not local virtual IP.\n");
+ if (getifaddrs(&ifap) != 0) {
+ LM_ERR("getifaddrs failed. Assuming no match.\n");
return 0;
}
-
- //Should return a list of local IPs
- he = _resolvehost(myname.nodename);
- if (he == NULL) {
- LM_ERR("Cannot get list of local IPs. Guessing not a local virtual IP.\n");
- return 0;
- }
- char** paddrlist = he->h_addr_list;
- int i = 0;
- while (*paddrlist != NULL)
+
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next)
{
+ /* skip if no IP addr associated with the interface */
+ if (ifa->ifa_addr==0)
+ continue;
+#ifdef AF_PACKET
+ /* skip AF_PACKET addr family since it is of no use later on */
+ if (ifa->ifa_addr->sa_family == AF_PACKET)
+ continue;
+#endif
struct ip_addr local_addr;
- hostent2ip_addr(&local_addr, he, i);
+ sockaddr2ip_addr(&local_addr, (struct sockaddr*)ifa->ifa_addr);
LM_DBG("Checking local address: %s\n", ip_addr2a(&local_addr));
if (ip_addr_cmp(&si->address, &local_addr)) {
- LM_DBG("Found matching local IP for virtual socket: %s\n", ip_addr2a(&local_addr));
- return 1;
+ match = 1;
+ LM_DBG("Found matching local IP %s for virtual socket %s\n", ip_addr2a(&local_addr), si->name.s);
+ break;
}
-
- i++;
- paddrlist++;
}
-
+ freeifaddrs(ifap);
//Default to not local if no match is found
- LM_DBG("No matching local IP found.\n");
- return 0;
+ if (!match) {
+ LM_DBG("No matching local IP found for socket %s.\n", si->name.s);
+ return 0;
+ } else {
+ return 1;
+ }
}
-
/* helper function for grep_sock_info
* params:
* host - hostname to compare with
Module: kamailio
Branch: master
Commit: e93640e6119e61a24d8c1f6d36b60c83b3573f90
URL: https://github.com/kamailio/kamailio/commit/e93640e6119e61a24d8c1f6d36b60c8…
Author: Rhys Hanrahan <rhys(a)nexusone.com.au>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-01-07T12:27:25+01:00
core: listen can now have a "virtual" flag to check for nonlocal floating IPs.
A new option to "listen" has been added called "virtual". This sets a flag on the listening socket to modify the behaviour of grep_sock_info.
When this flag is set, grep_sock_info will only consider the listening IP a match if the IP is found in the system's current list of
local IP addresses. If the IP is not currently local, then the matching IP is ignored.
If the virtual flag is not set on the socket then existing behaviour used instead.
This is useful in scenarios with an active/active cluster where Kamailio must know if a floating IP is currently local or not.
---
Modified: src/core/cfg.lex
Modified: src/core/cfg.y
Modified: src/core/ip_addr.h
Modified: src/core/socket_info.c
---
Diff: https://github.com/kamailio/kamailio/commit/e93640e6119e61a24d8c1f6d36b60c8…
Patch: https://github.com/kamailio/kamailio/commit/e93640e6119e61a24d8c1f6d36b60c8…
<!-- 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 -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] 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
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [x] 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 -->
- [ ] 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 -->
We faced an issue that tcp:close (timeout and reset) event routes don't execute in rare cases. Debugging and testing show that in the case when a connection is marked as BAD or write timeout etc our event routes don't execute.
I found that executing event routes is in the read function only. So in case when a connection is destroyed triggered by other reasons we don't have a notification about this.
I propose to do this in main file every time when we destroy connections. But in this case, we don't have I reason to destroy (timeout reset or EOF).
In our lab with these changes issue is gone. But sure this is just a concept.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2980
-- Commit Summary --
* tcpclose event_routes issue
-- File Changes --
M src/core/tcp_main.c (26)
M src/core/tcp_read.c (26)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2980.patchhttps://github.com/kamailio/kamailio/pull/2980.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2980
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/2980(a)github.com>
### Description
pua : default_expires parameter is not functionally used in code
It is not used neither in pua module, nor in others pua_* modules.
### Troubleshooting
Its presence is confusing if it does nothing, but it is described in documentation.
### Possible Solutions
Can it be used as default expires for subscriptions related to pua events ? Otherwise it should be removed.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2994
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/2994(a)github.com>
Fixed in cf1907cac4c21fe12a27057cc3eeb2dd98e65635
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/commit/559b52b194f813c0c8584b3becbac9b…
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/commit/559b52b194f813c0c8584b3becbac9b2ab8e0343/62881526(a)github.com>
OK, I did not see the point of them, but you made it understandable :-) Thanks. Will fix.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/commit/559b52b194f813c0c8584b3becbac9b…
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/commit/559b52b194f813c0c8584b3becbac9b2ab8e0343/62841767(a)github.com>
The commit seems to remove the existing error log messages and they are useful with the systems that monitor syslog and trigger alerts. While the commit adds text to rpc response, that is visible on client app and it might not be easily caught by server devops team. The error logs should be reintroduced.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/commit/559b52b194f813c0c8584b3becbac9b…
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/commit/559b52b194f813c0c8584b3becbac9b2ab8e0343/62841330(a)github.com>
Module: kamailio
Branch: master
Commit: b108bd6aaa7f25f91bd058c92103e9f0910bba0e
URL: https://github.com/kamailio/kamailio/commit/b108bd6aaa7f25f91bd058c92103e9f…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2022-01-03T16:31:27+01:00
modules: readme files regenerated - rtp_media_server ... [skip ci]
---
Modified: src/modules/rtp_media_server/README
---
Diff: https://github.com/kamailio/kamailio/commit/b108bd6aaa7f25f91bd058c92103e9f…
Patch: https://github.com/kamailio/kamailio/commit/b108bd6aaa7f25f91bd058c92103e9f…
---
diff --git a/src/modules/rtp_media_server/README b/src/modules/rtp_media_server/README
index 511263f880..769af84350 100644
--- a/src/modules/rtp_media_server/README
+++ b/src/modules/rtp_media_server/README
@@ -85,11 +85,9 @@ Chapter 1. Admin Guide
1. Overview
- rtp_media_server module is adding RTP and media processing
- functionalities to Kamailio
-
- Kamailio is providing SIP signaling including and enpoint with Dialog
- state, SDP parsing and scripting language
+ rtp_media_server module adds RTP and media processing functionalities
+ to Kamailio. Kamailio is providing SIP signaling including an endpoint
+ with Dialog state, SDP parsing and scripting language.
oRTP: is providing Real-time Transport Protocol (RFC 3550)
@@ -106,10 +104,11 @@ Chapter 1. Admin Guide
2.1. Building on Debian, Dockerfile and docker image
- The module includes Dockerfile that can also be use as a reference on
- how to build everything from source on Debian, the of libmediastreamer
- on Linux is usually outdated. A docker image is also available from
- dockerhub https://hub.docker.com/r/jchavanton/rtp_media_server
+ The module includes Dockerfile that can also be used as a reference on
+ how to build everything from source on Debian, the package of
+ libmediastreamer on Linux is usually outdated. A Docker image is also
+ available from dockerhub
+ https://hub.docker.com/r/jchavanton/rtp_media_server
3. Dependencies
@@ -118,9 +117,9 @@ Chapter 1. Admin Guide
3.1. Kamailio Modules
- The module depends on the following modules (in the other words the
- listed modules must be loaded before this module):
- * tm - accounting module
+ The module depends on the following modules (in other words the listed
+ modules must be loaded before this module):
+ * tm - transaction module
3.2. External Libraries or Applications
@@ -129,7 +128,7 @@ Chapter 1. Admin Guide
If you want to build oRTP and mediastreamer from source, you can use
the provided script for Debian "install_bc.sh".
- * oRTP git://git.linphone.org/ortp.git
+ * oRTP git clone git://git.linphone.org/ortp.git
oRTP is a library implemeting Real-time Transport Protocol (RFC
3550), distributed under GNU GPLv2 or proprietary license.
* mediastreamer2 git clone git://git.linphone.org/mediastreamer2.git
@@ -167,7 +166,7 @@ modparam("rtp_media_server", "log_file_name", "/var/log/rms/rms_ortp.log")
5.1. rms_answer (event_route)
- Create a call leg : with a SIP dialog and an RTP session call the
+ Create a call leg with a SIP dialog and an RTP session call the
event_route
This function can be used from REQUEST_ROUTE, REPLY_ROUTE and
@@ -201,7 +200,7 @@ route {
5.2. rms_hangup ()
- Send a BYE, delete the RTP session and the media ressources.
+ Send a BYE, delete the RTP session and the media resources.
This function can be used from EVENT_ROUTE.
@@ -245,7 +244,7 @@ e in-dialog request needs to be handled by it.
5.4. rms_dialog_check ()
Returns true if the current SIP message it handled/known by the RMS
- module, else it may be handle in any other way by Kamailio.
+ module, else it may be handled in any other way by Kamailio.
This function can be used from REQUEST_ROUTE, REPLY_ROUTE and
FAILURE_ROUTE.