This is useful for functions which are used both from a timer and from
other callers. These functions would reset the logging context at their
end to free the reference held by the logging context, which would
wrongly reset the logging context when the same function was called from
a different code path. Using a stack with push/pop semantics makes it
safe to use these functions from any code path.
Additionally introduce an explicit reset function that clears the entire
stack regardless of context. This reset function is called at the end of
every work iteration in every worker thread, just in case not everything
was popped from the stack.
Change-Id: I0e2c142b95806b26473c65a882737e39d161d24d
libcs are implementing changes to fix the year 2038 issue on 32 bit
platforms (see [1]). musl libc already went ahead and implemented it,
starting with musl-1.2.0 (see [2]).
This commit adds a new definition to lib/loglib.h:
TIME_T_INT_FMT
If __USE_TIME_BITS64 is defined (by a time64 libc, see [1]), it's set to
the proper conversions for type int64_t, PRId64. If __USE_TIME_BITS64 is
not defined, the status quo remains unchanged ("%ld" is used).
The new definition is used in the different parts of rtpengine, where
appropriate.
Note: Richard confirmed that the "%u" format in daemon/cdr.c is not
needed, so this gets swept under the rug.
These changes get rid of the new warnings that appeared with musl-1.2.0.
Below an example warning:
In file included from ./log.h:6,
from ../include/obj.h:94,
from ../include/media_socket.h:9,
from ../include/call.h:26,
from ../include/redis.h:15,
from redis.c:1:
redis.c: In function 'redis_check_conn':
../lib/loglib.h:56:30: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'time_t' {aka 'long long int'} [-Wformat=]
56 | __ilog(prio, "[%s] " fmt, log_level_names[system], ##__VA_ARGS__); \
| ^~~~~~~
../lib/loglib.h:64:39: note: in expansion of macro 'ilogsn'
64 | #define ilogs(system, prio, fmt, ...) ilogsn(log_level_index_ ## system, prio, fmt, ##__VA_ARGS__)
| ^~~~~~
../lib/loglib.h:63:30: note: in expansion of macro 'ilogs'
63 | #define ilog(prio, fmt, ...) ilogs(core, prio, fmt, ##__VA_ARGS__)
| ^~~~~
redis.c:887:17: note: in expansion of macro 'ilog'
887 | ilog(LOG_WARNING, "Redis server %s is disabled. Don't try RE-Establishing for %ld more seconds",
| ^~~~
[1] https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
[2] https://musl.libc.org/time64.html
Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
This makes it possible to add new streams without specifying the
direction/interface again.
Reported in #1366
Change-Id: I8f320ecbe72f123d755ba80370de9c40960eb0f0
If a keyspace notification SET is received and the call already exists
as a foreign call, the call is first destroyed before being re-restored.
The call destruction involves a DEL from Redis on the "hosted DB"
number, which points to the foreign DB. This makes it impossible to then
restore the call because it's just been deleted.
closes#1308closes#1334
Change-Id: Ie895b021441b2d299f8ebb5bde1824b01e12633c
commit d15fd4a547
Author: Damir Nedžibović <damir.nedzibovic@enreach.com>
Date: Tue Jul 6 14:07:42 2021 +0200
Also free the character data.
commit 8869187215
Author: Damir Nedžibović <damir.nedzibovic@enreach.com>
Date: Mon Jul 5 16:11:32 2021 +0200
Make documentation and parameters consistant.
commit 4b15aea2ee
Author: Damir Nedžibović <damir.nedzibovic@enreach.com>
Date: Thu Jun 10 15:34:00 2021 +0200
Update documentation.
commit 6ec1b3035d
Author: Damir Nedžibović <damir.nedzibovic@enreach.com>
Date: Thu Jun 10 15:33:12 2021 +0200
Do not use metadata for setting the recording file; use output_destination instead.
commit f65a76e8a3
Author: Damir Nedžibović <damir.nedzibovic@enreach.com>
Date: Wed Jun 9 15:56:02 2021 +0200
Only append file extension if skip_filename_extension is not set.
commit 92e9d7c679
Author: Damir Nedžibović <damir.nedzibovic@enreach.com>
Date: Wed Jun 9 14:12:48 2021 +0200
Rename the option to better match its usage.
commit 11128bff49
Author: Damir Nedžibović <damir.nedzibovic@enreach.com>
Date: Wed Jun 9 13:19:10 2021 +0200
Implement support for seting an output file and folder per recording.
Change-Id: I1579d62467eaf06a7aa1ac11e59dbb374f150deb
Complete overhaul of the codec handling code:
*) obsolete flags `asymmetric codecs`, `symmetric codecs`, `reorder
codecs`
*) support proper codec offer/answer
*) split codec manipulation (strip/offer/accept/etc) into separate
functions for clarity and better code maintenance
*) fully update codec handlers in both directions after an answer
*) explicit allocation and handling of codecs and payload types in a
codec_store object
*) improve codec matchup logic during answer
*) more explicit handling of supplemental codecs (CN/DTMF)
*) remove now obsolete hacks for handling certain use cases
Change-Id: I996705ba8fe339524c2f70e6bb0fd854f9a1f4fb
This solves problems when the same SSRC is looped through the same call
multiple times in different mono/dialogues, with different parameters.
Change-Id: I1d033cb1f012574d82b5bcbfffe11eb5f983cfd8
This makes the type in line with string(3) functions and eliminates some
compiler warnings.
Also update the related bencode data type.
Change-Id: I7ef4024f4b5a0f737b3dbe03bcd078032395bce6
Initially created branches don't have a tag associated with them, so
they don't appear in `other_tags`. We need to keep track of which
branches were created from a single from-tag through their via-branch
values so we know when all branches have been deleted.
closes#1037
Change-Id: I4c6ce602b99a9104de98098cd06ca399eb28e1b2
Commit a6d2f9296 introduced usage of libevent_global_shutdown(),
which is available in libevent-dev >=2.1.1-alpha only.
For example travis CI is running Ubuntu 16.04 / xenial and ships
libevent-dev 2.0.21-stable-2, so we can't just raise the
build-dependency of libevent-dev to >= 2.1.1+ if we still want
to support older systems.
Change-Id: I9dcf9ca0a19f59051d42f0d2383d1938b60a97df
fix cleanup being skipped on redis slaves
fixes an SDES related Redis mem leak
adds a hash for the ports free list to avoid duplicate entries
fixes#898
Change-Id: I34aad67290ff5ef8824142682aac03cb600d0ecb
stun.c: In function ‘stun_error_len’:
stun.c:388:62: warning: taking address of packed member of ‘struct header’ may result in an unaligned pointer value [-Waddress-of-packed-member]
388 | output_init(&mh, iov, &hdr, STUN_BINDING_ERROR_RESPONSE, req->transaction);
| ~~~^~~~~~~~~~~~~
stun.c: In function ‘stun_binding_success’:
stun.c:479:64: warning: taking address of packed member of ‘struct header’ may result in an unaligned pointer value [-Waddress-of-packed-member]
479 | output_init(&mh, iov, &hdr, STUN_BINDING_SUCCESS_RESPONSE, req->transaction);
| ~~~^~~~~~~~~~~~~
stun.c: In function ‘__stun_success’:
stun.c:540:42: warning: taking address of packed member of ‘struct header’ may result in an unaligned pointer value [-Waddress-of-packed-member]
540 | return ice_response(sfd, sin, attrs, req->transaction);
| ~~~^~~~~~~~~~~~~
stun.c: In function ‘__stun_error’:
stun.c:545:42: warning: taking address of packed member of ‘struct header’ may result in an unaligned pointer value [-Waddress-of-packed-member]
545 | return ice_response(sfd, sin, attrs, req->transaction);
| ~~~^~~~~~~~~~~~~
redis.c: In function ‘redis_hash_get_sdes_params.isra.0’:
redis.c:1095:39: warning: ‘_tag’ directive output may be truncated writing 4 bytes into a region of size between 1 and 32 [-Wformat-truncation=]
1095 | snprintf(tagkey, sizeof(tagkey), "%s_tag", kk);
| ^~~~
In file included from /usr/include/stdio.h:867,
from ../lib/str.h:9,
from ../lib/compat.h:16,
from ../include/redis.h:8,
from redis.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 5 and 36 bytes into a destination of size 32
67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Change-Id: I214458fd3f596e565b1bba9d88808b7c99f9c876
We need to set the redis context to NULL after freeing it, otherwise
other code will try to free it again, which will make the program
abort when exiting.
Change-Id: Id634075344351eb1c924c59739b72bbf57de3c89
We should offer all crypto suites that we support. If passing through
SDES, we should amend the list of crypto suites with all additional ones
that we support that weren't included in the received offer.
closes#577
Change-Id: I9b6c16e8eadecf01cdbc8043bd8361e0f683e456
Instead of just remembering the last seen RTP payload type, this adds a
tracker that keeps track of the last 32 seen payload types and keep the
list in order of how often each type was seen.
Change-Id: I062a43b7bfc9413b755dca548d72953ff8245477
Force re-checking of the synchronous redis context state in case of processing
a redis notification. It is possible that redis async context is up while the
blocking one is down.
The redis onekey concepts is introduced to reduce traffic to redis
and redis notification traffic.
It modifies the current structure for one call in redis, which are
multiple keys with pre- and postfixes and the callid in between to
one key with the structure "json-<callid>". The value is a json
formatted string with the previous multi-key identifiers in it.
Avoid segfault that happened when ps->component=0 (only when redis involved).
If redis involved, ps structure is initially 0'ed before restoring. Currently
the ps->component is not restored and leads to the above segfault.
- add --subscribe_keyspace list config parameter.
- don't delete foreign calls by timers
- fix synchronization of foreign calls (use a separate redis_notify database)
- fix statistics for control channel calls.
- fix deletion of foreign calls upon del notifications
- update rtpengine-ctl tool
Avoid segfault that happened when ps->component=0 (only when redis involved).
If redis involved, ps structure is initially 0'ed before restoring. Currently
the ps->component is not restored and leads to the above segfault.
The session limit is only for calls an rtpengine is responsible for.
Foreign calls (coming in via redis notification) are not counted as
long as the rtpengine is not responsible for those calls.
At least that means that the limit may exceed if the calls the rtpengine
is responsible for plus the former foreign calls are greater than the limit.
This will happen suddenly when the rtpengine becomes responsible for the
foreign calls.
Thoughts on that topic so far:
There's one thing to keep also in mind. What do we do if the call
changes (streams) and the backup node is notified ? Currently we only
know (by subscribing to the 'notifier-' prefix that in fact it has
changed, but we don't know what has changed in detail. Subscribing to
everything would lead to the problem that we have to take care about
synchronising the the new streams with the old ones. Without having a
look at the code that might be a lot of effort and ... I guess that's
why richard likes to ... have clean states of the calls. Synchronizing
is always a mess. Easier to delete and setup new.
I thought about the following solution for makes things more abstract
and easier to understand:
1. Whenever that call on a backup node (foreign call) has seen a packet
(also timers are started then), we do not process any notification by a
redis notification for this call (caus' the RTP-IP has already been
switched). More precise and abstract that means: If a node has taken
over the responsibility for that call (by having seen a packet), it
assumes that notifications from the former node to be dropped. The call
will be deleted when either the timer fires or (for other companies) the
control channel address has also been switched and via that channel the
call is deleted.
2. If a call has not seen a packet (inactive call on the backup node,
seen as not responsible for that call but could become so), we accept
all commands for that call on the backup node in the same way as on the
original node. That means also deletions in-between and so on. I mean if
the original node does it, why not accepting to do the same way on the
backup node ?
Currently, every rtpengine will subscribe to redis-keyspace notification
so it will receive a notification when an call is inserted. If the call
is not already handeled by the rtpengine, the call will be restored.
The reason for this is to have in-place redundancy. Imagine you have
multiple rtpengines running, eachone will have all calls of the others.
When one rtpengine fails somehow, infrastructure guys use BGP in order to
'move' the IP address from one rtpengine to another. Thisone can handle
the new calls instantly since they're already recovered by
redis-notification feature.
Next step is internally identify those calls in order to prevent some
timers to delete the calls where no RTP flows. Second will be
something we call 'partitioning'. It means that the subscription
to a redis notify will only be for the keyspace a dedicated rtpengine
writes to. This leads to the point that you can make redundancy groups
(partitions) of the rtpengines.
This brings master up to date with branch `rfuchs/socket-rework` at
commit `b1bcc096b7`. The branches have diverged too much for a proper
merge, so this is a manual (squashed) merge.
The old master before this merge can be found in branch
`old-master-before-socket-rework` (commit `82199216b2`).
This is a complete rewrite of all socket handling routines. The most
important functional change is that sockets aren't indiscriminately
bound to INADDR_ANY (or rather in6addr_any), but instead are always
bound to their respective local interface address and with the correct
address family.
Side effects of this are that in multi-homed environments, multiple
sockets must be opened (one per interface address and family) which must
be taken into account when considering RLIMIT_NOFILE values. As a
benefit, this change allows rtpengine to utilize the full UDP port space
per interface address, instead of just one port space per machine.
The socket abstraction also makes it possible to support RTP over TCP in
the future.
Change-Id: If6cf4f42136229490186d2d2482fb4fc140c2b53
The payload types are not saved and retrieved from redis. Used a hash to
store the payload types in the form (0, payload_value0), (1, payload_value1)
for every media.