... instead of manually maintaining a linked list.
Store an iterator in the timer object so that it can be directly removed
if needed.
Change-Id: I38f1fbcdc6fe1b36a8adef6a95f36f8902a4f729
Move the timer resolution from a global define to an instance variable.
Use a default of the previous value. Switch all expiry values from
resolution-based to microseconds, and use 64-bit ints for all values.
Changes
timer::arm_absolute(u_int32_t wall_clock)
to
timer::arm()
Change-Id: I431220f378b4a9d2bd0f047d091ee5c8b3b72bfc
This makes it possible to retain the previously set absolute expiry
time. Update trans_timer to use this (the only relevant place).
Change-Id: I9765fbeddd2807406d2603b3c7fd9e8c9c09db68
Introduce `ILOG_DLG()` call-id logging based on `dlg`.
This commit only introduces a usage of it for
CallLeg and SBCCallLeg classes.
Later commits will spread this usage over all
AmB2BSession based classes.
Change-Id: I18ad8ba5129cb8912f401bb089ad82dbf9909a18
For the `AmThreadLocalStorage` its static `t` member
must be explicitely initialized outside of the template class.
Because it is a template class, it will only be instantiated
when used (when the data type is known), if no initialization
of the static member provided, then linker will fail to link
it (for other users like `RedisCheckpointWriter` which instantiates
`AmThreadLocalStorage` with `RedisConnection`).
Fixes:
ERROR: opening plugin '/usr/lib/sems-pbx/plug-in//redis_store.so':
/usr/lib/sems-pbx/plug-in//redis_store.so: undefined symbol: _ZN20AmThreadLocalStorageI15RedisConnectionE1tE
ERROR: while loading plug-in '/usr/lib/sems-pbx/plug-in//redis_store.so'
Change-Id: Iad3072c07fd04c5341838bb2a2c08858ca94b03a
Ignore SDP repeated in 183 and 200OK messages
in the late offer/answer, but only for the
`OA_OfferSent` OA state.
Change-Id: I136ad02182685d0158e2c7c4eee53833cd8e00f4
When OA generates own SDP body (e.g. case with
accepted invite in DSP), save it as established_body
for this leg, in order to be able to re-invite
this leg later.
It can happen there is still no SDP seen from the
callee side (other side), and in case we want to
send established re-invite towards this leg,
this will fail, since no SDP body seen yet.
Change-Id: Ifd9f0fb70d27deac871de4eed1648f7c152813f3
Move it to the dlg level, because of complex visibility.
In other words, when working on the dialog level and e.g.
generating new SDP body using `dlg.oa`, there is no way
to save it.
Moving it to the dlg level, gives a control over it on
the whole amount of inheritance levels plus dlg.
Change-Id: Iebb13e3e58f2558dc060e23270d99d690fa54572
Use std::condition_variable and std::mutex to implement AmCondition.
Only bools are used for conditions in the code, so make it not a
template.
Change-Id: I57d67492e29c220a5ce941ef67d142b34dcebbff
Re-implement AmMutex as a subclass of std::mutex. Provide copy and
assignment constructors so that it can be used as a member of another
class without preventing it from being copy/assignment constructed.
Change-Id: Id300a6501105a7871396c2be9380d6e0eae02cc7
C++20 deprecates implicit conversion of enumerations
during math operations like division.
Instead deprecate enum CPS_SAMPLERATE which is used
in a role of pre-proc definition and add a `const float`
value of which is defined by the constructor and is
unchangable.
Also don't use straight-forward (old style) cast with `(<type>)`
but use C++ designed type casts like a static cast, for the
rest of operands in the formula.
Change-Id: Idbfff86f4ec805f3f6db144f3aa041f8fe2c017a
Volatile increments/decrements are deprecated by C++20,
use a full operation instead.
Fixes:
18: 57:47 AmSession.cpp: In static member function 'static void AmSession::session_started()':
18: 57:47 AmSession.cpp:607:3: warning: '++' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
18: 57:47 607 | session_num++;
18: 57:47 | ^~~~~~~~~~~
18: 57:47 AmSession.cpp: In static member function 'static void AmSession::session_stopped()':
18: 57:47 AmSession.cpp:624:3: warning: '--' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
18: 57:47 624 | session_num--;
18: 57:47 | ^~~~~~~~~~~
Change-Id: I68ad2cee9396765b0df1ba5b583435c326154dde
If requested by `b2b_build_pai_from_hdr` DSM parameter,
then get the value of PAI using this parameter and pass
it further for `B2BSipReplyEvent` processing.
Use event params to pass the value.
`b2b_build_pai_from_hdr` keeps the name of header
coming in the latest reply, from which the PAI's value
is to be built.
Update the `reinviteCaller()` function's signature,
to pass headers towards `dlg->sendRequest()`.
Change-Id: Ic6e66e326f26a830c3ed06c19a6ab7be4ebe0135
When replying with 200OK generated by SEMS to INVITE requests,
which have no SDP body included, just answer with empty 200OK.
This sets the `OAState` of the call leg to `OA_None`.
Change-Id: Ic28e80d670ba4ce98be6abac9d17689688f99f71
Re-use previously offered SDP body, when processing
a call session with an involvement of DSM, and getting
newer SIP invite having no SDP offer.
This affects applications using the B2B `connectCollee()`
functionality and doesn't actually touch the B2B core itself.
(Which would be wrong if changed in a usual core SDP
processing, whereas original request can be empty and
an offer/answer is postponed to 200OK/ACK exchange)
(Re)invites towards DSM applications technically must
not be empty, because DSMs don't support late offering.
In order to overcome that just pretend that empty
re-INVITEs are using previous body version.
Change-Id: I252eb9f32e7dc073454a2258b176f77bf15d35c9
Introduce getters for headers in requests
and replies:
- `B2B.getHeaderRequest()`
- `B2B.getHeaderReply()`
Change-Id: I1dfc24658a9e044407f95de9507032f1b041b451
Don't store the `st` variable in a processor register
but store as usually in memory.
Resolves:
AmUriParser.cpp:97:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
97 | register int st = ST1;
|
Change-Id: Ia38feab1e58aeab20e2f7319bee268feca919a82
Don't store variables in a processor register
but store as usually in memory.
Resolves:
10: 32:12 AmSdp.cpp: In function 'bool parse_sdp_line_ex(AmSdp*, char*&)':
10: 32:12 AmSdp.cpp:571:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 571 | register parse_st state;
10: 32:12 | ^~~~~
10: 32:12 AmSdp.cpp: In function 'char* parse_sdp_connection(AmSdp*, char*, char)':
10: 32:12 AmSdp.cpp:757:30: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 757 | register sdp_connection_st state;
10: 32:12 | ^~~~~
10: 32:12 AmSdp.cpp: In function 'void parse_sdp_media(AmSdp*, char*)':
10: 32:12 AmSdp.cpp:838:25: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 838 | register sdp_media_st state;
10: 32:12 | ^~~~~
10: 32:12 AmSdp.cpp: In function 'char* parse_sdp_attr(AmSdp*, char*)':
10: 32:12 AmSdp.cpp:1038:31: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 1038 | register sdp_attr_rtpmap_st rtpmap_st;
10: 32:12 | ^~~~~~~~~
10: 32:12 AmSdp.cpp:1039:29: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 1039 | register sdp_attr_fmtp_st fmtp_st;
10: 32:12 | ^~~~~~~
10: 32:12 AmSdp.cpp: In function 'void parse_sdp_origin(AmSdp*, char*)':
10: 32:12 AmSdp.cpp:1253:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10: 32:12 1253 | register sdp_origin_st origin_st;
10: 32:12 |
Change-Id: Ice87c3659816003c94359f891a490db0910ff74a
Explicitly set port and nports to 0 when initializing
a brand new instance of SdpMedia.
This resolves warnings:
../../core/AmSdp.h:168:8: warning: '*(__vector(2) unsigned int*)((char*)&<unnamed> + offsetof(SdpMedia, SdpMedia::port))' may be used uninitialized [-Wmaybe-uninitialized]
168 | struct SdpMedia
| ^~~~~~~~
../../core/AmSdp.h:168:8: warning: '<unnamed>.SdpMedia::nports' may be used uninitialized [-Wmaybe-uninitialized]
168 | struct SdpMedia
Change-Id: Ifa2838ba0ef2f1a48b4fdc07b7bfaf8c5aefcfaa
Don't store `fin` variable in a processor register
but store as usually in memory.
Resolves:
parse_100rel.cpp: In function 'bool parse_rseq(unsigned int*, const char*, int)':
parse_100rel.cpp:19:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
19 | register bool fin; \
| ^~~
parse_100rel.cpp:55:3: note: in expansion of macro 'READ_NUMBER'
55 | READ_NUMBER(rseq, pos, end);
| ^~~~~~~~~~~
parse_100rel.cpp: In function 'bool parse_rack(sip_rack*, const char*, int)':
parse_100rel.cpp:19:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
19 | register bool fin; \
| ^~~
parse_100rel.cpp:84:3: note: in expansion of macro 'READ_NUMBER'
84 | READ_NUMBER(rseq, pos, end);
| ^~~~~~~~~~~
parse_100rel.cpp:19:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
19 | register bool fin; \
| ^~~
parse_100rel.cpp:91:3: note: in expansion of macro 'READ_NUMBER'
91 | READ_NUMBER(cseq, pos, end);
| ^~~~~~~~~~~
Change-Id: I9030a5ac8b7ebb0dd1b932296f73a7987639fc26
SDP session origin id and version are limited by it's size
to 64 bits (8 bytes), that is because we are using `unsigned long long`
type for both id and version. Hence the maximum value it can hold
is two sixty-forth power, so equals: 18,446,744,073,709,551,615
In case one intentionally sets it to something like:
"o=- 18446744073709551615 18446744073709551615 IN IP4 192.168.0.1"
SEMS gets overwhelmed with that conversion inside the code make
it just to a string literal 'F'.
To overcome it, just use __uint128 (which is of 128bits size)
for the session origin id and version.
Change-Id: I2ad9659aa81dad79969749053dc3fd0d69e2cbd2
Use `unsigned long long` for SDP session id and version
instead of unsigned int.
Refactor all usage of them accordingly.
Additionally intrdouce new utils functions for conversion:
- `ulonglong2str()` - converts `unsigned long long` to `string`
- `str2ull()` - converts `string` to `unsigned long long`
Change-Id: I4210349a5442d4173b14227497f4a01d68cad7a4
Add a function to the AmSipDialog class interface,
to be able to check whether the OA currently expects an offer.
Use it then in the `CallLeg::updateLocalSdp(AmSdp &sdp)`
Change-Id: I1c4f4364ce13c7b03e22e0f037d19b99245a0be8
Do not take into account `send_491_on_pending_session_leg`
when processing pending updates for call-pick call scenario.
This is required to let the A side (so caller) be updated,
which in a cascading manner later triggers 200OK sending
towards the call pick-up'er, and further media updates
via re-invite.
`send_491_on_pending_session_leg` is used to prevent
overlapping updates towards the same other leg.
In this situation however, two updates towards the caller
is a proper way to finish the call-pickup, so the media update.
A new header for interaction between SBC<->B2B introduced:
`P-Force-491`, which takes either of values '1' or '0'.
If set to '0' the `send_491_on_pending_session_leg` will always
be ignored by SBC, and hence re-invite will reach the target,
regardless if there has been anyone shortly before.
Change-Id: Iee7d2c6ef38e568e7c57a89358b22be0b1cb0438
We need to take care of cases, when one leg has pending
transaction(s), and an opposite leg triggers media re-negotiations,
which assumes we have to update the first leg as well (the one which
has a pending transaction).
Perviously we used to only support sending a fake 200OK to the one,
who triggered a media attributes re-negotiation, and scheduling
an update for the opposite leg for a later time (as soon as its done
with its own transaction(s) ).
For now we can optionally decide whether:
- to send 200OK to the one who triggers re-INVITE
- to send 491 Pending to the one who triggers re-INVITE
Using the approach with 491, gives a solution to the problem,
when a fake 200OK is sent to the remote side, and ACK after a while
is not matched to any of the existing local transactions.
This can happen in case, we have sent a fake 200OK, but SBC triggers
one more transaction towards the same side (over already existing one).
This behavior leads to a failure when trying to match coming ACK to the fake 200OK.
By default, enabled behavior - generate fake 200OK.
Optionally it's now possible to enable 491 Pending response,
by setting sems.conf option:
- send_491_on_pending_session_leg = 'yes'
Change-Id: I17f41833651eb006666315c1f9a7cfd4c0441f8a
Core in CE is missing currently functions to accept
pending invitations, introduce them from PRO version:
- `acceptPendingInviteB2B()`
- `acceptPendingInvite()`
Additionally:
- add a helper to create fake replies `createFakeReply()`
Change-Id: Icc5be22051f68f269d4b93637f2b3b59498dbd25
Sync the `CallLeg::onB2BReconnect()` with PRO code version,
and add second part of SDP origin manipulation fix.
Change-Id: I7d7558bc88ab91d00bac72a22e1f713afd218233
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