If there are no timers then it makes no senes to process ticks in real
time. Sleep up to 0.5 seconds in that case. When timers are added we
are immediately woken up through the conditional variable. Only setting
the shutdown flag would not wake up the thread, but a sleep time of half
a second should be an acceptable delay for shutdowns.
Analogous to 695d902841
Change-Id: I37adf078825470af99e6a7755df3d8786d3eeaa6
Signal the sleeping thread through a condition variable whenever a new
event has been added to the queue. We can then process these events
immediately instead of having to wait for the timer to expire.
(The decision to use a separate private mutex and an extra bool value
for the AmCondition class of course is highly questionable, but that's
what we have in the code base for now.)
Change-Id: I78b74f1152e36aa106906e962bc133f15093ea02
Use one method for wheel turning and another separate method for events
processing. This logically separates two indepenent processes.
In the event of the actual sleep time being different from the requested
sleep time, we do the wheel turning based on the number of required
ticks, but run the events processing only once, after the wall clock has
been brought up to date.
Change-Id: Ibbc6571a5a569050647efd1ba595c1fd08918409
We may end up sleeping shorter or longer than the desired sleep time. If
we ended up sleeping shorter, don't advance a tick, and if we ended up
sleeping significantly longer (more than one tick), advance multiple
ticks.
Change-Id: I0be20104e6243c89006367430a3663cc304486b9
Go to sleep even if the sleep time is less than 2 ms. This makes the
math a lot easier and shouldn't have a noticeable impact as this is
a somewhat unnecessary attempt at optimization.
Analogous to 292eb8cf1c
Change-Id: I6d936a4450967dcd76b4647f189aa3f71e5ed7ae
By making the wall_clock private to the timer thread, we force all
externally used timers to use relative timeout values. Amend the timer
class to keep both timeout values for clarity.
The previously existing member `expires` is the absolute timeout, but is
now initially left unset (zero). Instead the given timeout value is put
into the new member `expires_rel` and the absolute timeout is calculated
only once the timer is inserted into the wheel by adding the current
wall clock.
We add an extra getter function for the current wall clock only for
debugging and logging purposes.
This also turns the two expiry timestamps kept in the timer class
protected and private, delegating maintenance to getter and setter
methods.
Change-Id: Ia6baf552a1de94ba64f314e9123df172b45eed85
Remove dependency on AmAppTimer's wall_clock ticks by switching to
direct call of gettimeofday() and converting the internally used time
units to milliseconds instead of the tick-based wall clock time.
Remove ::getLastUpdate() as it's unused.
Change-Id: Ia3a026103b594351c0a6943de67dd94883e30578
Change it into a wrapper that directly calls time() to eliminate the
need of the timer thread to continuously set unix_clock to the current
time. With vDSO the call to time() is sufficiently cheap.
Move constructor to header and remove default empty destructor.
Change-Id: Ib812a993da9340b9ded4fd97c81d762d9452c3ea
If there are no sessions then it makes no senes to process ticks in real
time. Sleep up to 0.5 seconds in that case. When sessions are added we
are immediately woken up through the conditional variable. Only setting
the shutdown flag would not wake up the thread, but a sleep time of half
a second should be an acceptable delay for shutdowns.
Change-Id: I5aa43382248754ff8dec811038998cf636579734
Calculate how many ticks have passed since we were last awake, and
advance next_tick based on the actual time, but in multiples of tick.
Change-Id: I50f9804b1002780fc55358f00ff41d3a73ab854e
Go to sleep even if the sleep time is less than 2 ms. This makes the
math a lot easier and shouldn't have a noticeable impact as this is
a somewhat unnecessary attempt at optimization.
Change-Id: Ibd97c216e529b4e0b2110f81200b649db6ff2764
Extend logging in the `AmSipSubscription::makeSubscription()`
and also refactor code for better readability.
Change-Id: Ibbeb9f8cb7b808bf24685af46ed31c00040913a0
If the leg during the `B2BEvent::B2BTerminateLeg` event
handling turns out to be in the 183/200 faked state,
then handle the leg termination with CANCEL, instead of BYE.
This is because this leg has never seen the real 200OK
response, and hence remains indeed in the early stage.
Change-Id: I4a9d4197a6ea42f1cfbbcdc5fb306c48684e64bf
When outbound PRACK is challanged, SEMS is regenerating
the PRACK to proxy duplicating the proxy socket in the
Route header, with the result of:
Route: <sip:127.0.0.1:5062;lr>,
<sip:127.0.0.1:5062;lr=on;ftag=xyz;leg_b=1;did=f85.d281>,
<sip:127.0.0.1;r2=on;lr=on;ftag=xyz;ngcplb=yes>,
<sip:192.168.178.104;r2=on;lr=on;ftag=xyz;ngcplb=yes>
the duplicate "127.0.0.1:5062" is causing routing
issue on proxy, cause loose_route() function removes
only the first element. Then proxy sends PRACK to
itself.
To avoid that, we make sure is SEMS to do not add
the 'outbound_socket' value in the Route header
if that value already exist in the first position.
Change-Id: Id310144d8e77a99111e199358462496c9dd0495c
For the PRACK transcations (e.g. PRACK/401) update the
remote tag as well as route set.
Scope: `AmSipDialog::onRxReplyStatus()`
Additionally: do not reset remote tag during the authentication
process for PRACK methods, in: `UACAuth::onSipReply()`.
Change-Id: Ibd4e4ee737287bab3883b74a32ded6a966ec62ab
During refreshing of the media for the call leg in the
`CallLeg::adjustOffer()`, when the resume is required,
but the `on_hold` wasn't set before (so is false),
then additionally check, whether the SDP body
(media sessions of `MT_AUDIO` type) has state like:
- sendonly
- recvonly
- inactive
This will properly fix the attributes (like: `a=sendonly`)
in the re-INVITE, which is supposed to resume the session.
Change-Id: I1c45b7db55d2a5174f3fd96f3fcd0201b48345f2
The hiredis library does not provide a direct way
to retrieve the allocated port number.
We hav to retrieve the socket file descriptor (redis_context->fd)
from the `redisContext` structure and using the `getsockname()`
get the local address associated with that socket.
Then the `sin_port` field of the resulting `sockaddr_in` structure
will contain the allocated ephemeral port.
By using `ntohs()`, just convert the port number from network
byte order to host byte order for printing. However make an additional
on-the-go type casting into the `unsigned int` also, to be able to print.
(unsigned int is guaranteed to be at least 16 bits,
so this is not a lossy conversion).
Change-Id: Id2a8e9ee4fad6f28db099323fb68fd2db0bfafc2
This is a partial rework of b67428d.
The patch was always saving the Allow header
from the initial INVITE and replacing the Allow
header in the 200 OK with that.
This fixed an issue with AA, where Allow
header in the 200 OK, generated by the AA, was
empty. But it causes an issue in case of normal
calls between A and B.
In general we want to keep the Allow header in
the 200 OK, if exist.
Instead, we want to add the Allow header in the 200 OK
response in case the 200 OK does not contain
the Allow header. In this case we won't set the
original Allow from the INVITE but instead we will
set a default Allow header (SIP_REPLY_DEFAULT_ALLOW)
containing all the major SIP method.
Change-Id: I6bf5a2cc7e0228f7b99d28963d16c14c463be695
Backport from the upstream to add `lock(mutex)` calls
in order to avoid crash.
Upstream commit: 0af0c924a8fc9638c5b18a4d5799a085ea8132bc
Change-Id: I022b09d2827b41f0785a9c0568c334b8a2af108f
Backport from the upstream to fix NOTIFY to URI.
Upstream commit: c2908dcb50342e3c8400695b43280181a850fc34
Change-Id: Iff9c0d82ab798f4646284de61365422e48c50a59
Backport from the upstream to fix parsing of sip uri,
when display name contains uri scheme characters:
's', 'i', 'p', and ':'
Upstream commit: fe760b5afdb455707ad2ed3ada7f7fbda6b2fd0e
Change-Id: Idf0236ae9ef2be958693d589894d52ea1ed70848
Backport from the upstream to support looking up aliased
interface names.
Upstream commit: a84509091031331159abb199e21701cb6d7e79b1
Change-Id: I557dee742351268737fe69df8991aede531bb57b
Backport from the upstream to handle responses to SIP_METH_CANCEL
in Cancelling state, preventing dialog and session leaks i.e. on timeouts.
Upstream commit: 54025209301bd111d56ffcb6540473c4f5057779
Change-Id: Iab1d5797f1f5bcd70a27c805d96dab7e67bb1749
Backport from the upstream to support libevent-dev >= 2.1.12 .
Upstream commit: b2172dd70c2fe77c46e8427be5e3d0cf222cb049
Change-Id: Iea7e76b33c945cb57b8f2e98c9130ae46665c66c
Backport from the upstream to add support for body content type
application/csta+xml in INVITE and INFO requests/responses.
Upstream commit: 6f67d15c3857c1f8ed5b33615b7f5ff0e12d3a92
Change-Id: I085eda4a10e73139bd4dce4d75def82bf6da1e8d
Backport from the upstream to fix Python versioning.
Upstream commit: e943f98a8d09a06c88eca10d93e51f7a13056e31
Change-Id: Ia7d6b49270c9f3fa3cc7cb8d921334b2afc1db9b
Fix instances of make rules not being parallel execution safe, where the
targets declare a list of dependencies which depend on the order they
have been declared to be executed serially, otherwise these can cause
race conditions.
Either move some of the dependencies down into their transitive
dependencies, or rearrange them to call $(MAKE) to force a serial
point. In other instances add missing dependencies to make sure the
objects to install have previously been built.
Change-Id: I21b499557ac5e9faa603841fa1882b58239ee650
Fix for:
fft.c: In function 'WebRtcIsac_Fftradix':
fft.c:338:22: warning: the comparison will always evaluate as 'false' for the address of 'Tmp0' will never be NULL [-Waddress]
338 | if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
| ^~
In file included from fft.h:34,
from fft.c:126:
structs.h:250:10: note: 'Tmp0' declared here
250 | double Tmp0[MAXFFTSIZE];
| ^~~~
fft.c:338:48: warning: the comparison will always evaluate as 'false' for the address of 'Tmp1' will never be NULL [-Waddress]
338 | if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
| ^~
structs.h:251:10: note: 'Tmp1' declared here
251 | double Tmp1[MAXFFTSIZE];
| ^~~~
fft.c:338:74: warning: the comparison will always evaluate as 'false' for the address of 'Tmp2' will never be NULL [-Waddress]
338 | if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
| ^~
structs.h:252:10: note: 'Tmp2' declared here
252 | double Tmp2[MAXFFTSIZE];
| ^~~~
fft.c:338:100: warning: the comparison will always evaluate as 'false' for the address of 'Tmp3' will never be NULL [-Waddress]
338 | if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
| ^~
structs.h:253:10: note: 'Tmp3' declared here
253 | double Tmp3[MAXFFTSIZE];
| ^~~~
fft.c:339:25: warning: the comparison will always evaluate as 'false' for the address of 'Perm' will never be NULL [-Waddress]
339 | || fftstate->Perm == NULL) {
| ^~
structs.h:254:7: note: 'Perm' declared here
254 | int Perm[MAXFFTSIZE];
| ^~~~
Change-Id: I7060e20d532e80f2ec78c04999676c86136ae34a
This was a workaround for Solaris specific issues in the install program
there. The problem is that this can end up generating empty files, that
will not be detected by the packaging system as it will find the file is
present on destination and thus does not need to be installed.
Change-Id: Ib6107957cbf03c4e7da6cf2998d9103224f674d3
Give an exact size of the buf to the `snprintf()` and also treat the
returned value from it to eliminate this warning:
src/XmlRpcValue.cpp: In member function 'std::string XmlRpc::XmlRpcValue::timeToXml() const':
src/XmlRpcValue.cpp:404:53: warning: '%02d' directive output may be truncated writing between 2 and 11 bytes into a region of size between 0 and 7 [-Wformat-truncation=]
404 | snprintf(buf, sizeof(buf)-1, "%04d%02d%02dT%02d:%02d:%02d",
| ^~~~
In file included from /usr/include/stdio.h:867,
from /usr/include/c++/10/cstdio:42,
from /usr/include/c++/10/ext/string_conversions.h:43,
from /usr/include/c++/10/bits/basic_string.h:6545,
from /usr/include/c++/10/string:55,
from src/XmlRpcValue.h:14,
from src/XmlRpcValue.cpp:2:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: '__builtin___snprintf_chk' output between 18 and 70 bytes into a destination of size 19
67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Change-Id: Ic545bbc942715f433610f49286ee9d0f92ee25f6
This commit takes care of the following:
SBCDSMInstance.cpp:55:18: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
55 | throw string("DSM SBC call control "DSM_SBC_CCVAR_START_DIAG" parameter not set (see call profile)'");
|
Change-Id: I9c5ddd5b438d672e29ce0028c00df177adfbfd33
We have to explicitly set the `SdpPayload.type`,
when calling the constructor of it, which only initializes the `SdpPayload.payload_type`.
Just simply set the `SdpPayload.type` to -1.
This fixes the following:
In file included from ../../core/AmRtpStream.h:32,
from ../../core/AmSession.h:31,
from ../../core/AmB2BSession.h:31,
from CallLeg.h:29,
from CallLeg.cpp:27:
../../core/AmSdp.h: In member function 'void CallLeg::acceptPendingInvite(AmSipRequest*)':
../../core/AmSdp.h:130:18: warning: '<anonymous>.SdpPayload::type' may be used uninitialized in this function [-Wmaybe-uninitialized]
130 | : type(other.type), payload_type(other.payload_type),
| ~~~~~~^~~~
Change-Id: I08a9e75396f043dc88d411b9c84296a704d67057