Introduce a pair of getter and setter.
Then use them to appeal to `AmSessionTimerConfig::StrictMode`.
Then move the `AmSessionTimerConfig::StrictMode` to private
scope for incapsulation reasons, this is now possible
because of having the getter and setter.
Change-Id: I1cf6d9bbb30be925b8b885b36cbc123a96d334cb
Upon sending request/reply (`SessionTimer::onSendRequest()` /
`SessionTimer::onSendReply()`) don't re-append `Session-Expires`
(and rest of timer related headers) if this leg doesn't actually
support them.
Appending them may just confuse remote side and it may
act strictly and drop the call (e.g. remote side didn't explicitly
declare it supports timers, but we still sent it `Session-Expires`).
By default we always assume that remote side supports SST timers,
unless not proved the opposite with absent SST related headers
in any first seen 200OK or INVITE/UPDATE request. Then it gets
disabled. This policy is quite explicit and allows to gracefully
step back from SST scheduling, if remote side doesn't support timers.
Change-Id: I8581418c60bde912e01e2429844720dc19034c81
Make both `updateTimer()` overloads be returning true/false,
this will allow to react on the func caller's side to act
accordingly whenever required.
Change-Id: Iba6bfa6b21e74d657652c649064fe0a93ad6f1eb
Check also for requests (as well as for answers) that B2B's profile
actually supports timers, before to proceed with processing.
Change-Id: If86ab5a546040781715812eb882fbdb314462078
Just by default construct as true.
By default we always assume that remote side supports SST timers,
unless not proved the opposite with absent SST related headers
in any first seen 200OK or INVITE/UPDATE request.
Then it gets disabled.
This policy is quite explicit and allows to gracefully
step back from SST scheduling, if remote side doesn't support timers.
Change-Id: I422c76c42d44bcf2e775ffb9afa5842a9def1402
Introduce explicit policy for within-dialog SST support:
- whenever remote side (call leg) doesn't explicitly declare
it supports timers (with `Supported: timer`), disable all
previously set timers for this particular leg
- this touches request originator, as well as answerer
- requests: only UPDATE and INVITE methods are affected
- answers: only positive answers are affected
- by default this behavior is always disabled if not enabled
explicitly in the profile's config with `sst_strict_mode`
- sst_strict_mode takes either `yes` or `no`
P.S.: the `sst_strict_mode` must not be initialized to true
by default, because RFC 4028 explicitly tells to support
the operation even when only one UA understands session timers.
So we have to be quite accurate and not enforce the strict mode.
Change-Id: Ie6647eb061a73dc052367dbd291589198487093c
Only for UPDATE method for now, track whether remote side
actually declares it supports timers, if not remove.
This may affect things, in case remote side expects timers
should have been declared only once during the session
origination, but all in all remote side must always add
the `Supported: timer` header to keep us explicitly aware.
Additionally: improve logs.
Change-Id: I80d4efbe38701b95549d02830392b93019cc2b85
Align the port value accordingly to the requested transport.
Do take the config parameter `contact_hostport` into account
only then, when the contact URI given by DI is empty.
In case DI provides a full contact value, with a transport,
then accordingly inspect it and rebuild from scratch,
using the following uri schema:
`sip + username + @ + host + port + uuid + transport`
Default port values are:
- udp = 5060
- tcp = 5060
- tls = 5061
the config parameter has a value only as a fallback.
Change-Id: Ibf2a7a1d74d438e853c02bfe77478ac62216dbca
add B2B SBC integration test suite (port from sems-pbx)
Port the 20-test B2B suite from sems-pbx. CE-specific differences:
- sip_port=5062 (avoids conflict with orphaned sockets on :5060)
- default_bl_ttl=0 in t/b2b.conf (disables destination blacklisting
so a 503 response in one test does not block subsequent tests)
- no g729 in load_plugins (codec not present in CE)
- plugin_config_path requires trailing slash
- 100 response matched as "100 [^\r]+" (CE sends "100 Connecting"
instead of "100 Trying")
sems_tester.py: add makeUACSocket/makeUASSocket, recvSIP, recvFromSIP,
sendToSIP, assertSIP helpers; create t/run/ in setUpClass; clean up
PID file in tearDownClass; skip testPreload when rtpe-preload.so is
not loaded.
testEarlyCancelRace: use 10 s socket timeout with inner try/except
so the test passes on loaded CI machines where BYE may arrive late.
Change-Id: Iecb563dee6a27cf46b9883c42154a4486b3f6429
Internally the parsing still happens on pointers, but the externally
visible function will be using string_view eventually, when all other
users are converted.
Change-Id: I87d3be9e41fd96f656ce242edc1c403425f3eb65
If the `postDtmfEvent()` doesn't acquire the ownershop
over the allocated event, then no one actually takes care
to release it.
Modify func to return true/false, and react accordingly
on the caller's side.
Change-Id: If683eeba275d71850f67d961e9a1cdefe3fe6619
In case the override func of virtual `onStop()`
anyhow reaches the AmSession again, and falls into
the scope where the same mutex lock is used (snapshot_lock)
this will be a dead-lock.
Hence preserve such, but manually managing the lock,
and release it, when calling the virtual func.
Change-Id: I7c7c4700767dd3aed1c482559be02e3a97cca407
No need to do local copy operations, because:
- local copy on stack created
- then another copy on stack created when returning
So this does two copy operations.
Instead just do one during return, this is still covered
with the lock guard.
Additionally: split `getMaxSessionNum()` into getter
and setter, because the name is misleading now.
Hence those callers, who want to get the max session number,
are obligated to also update to the new value.
Change-Id: Icc775d9236d5c80de829c55638e1da47ae095289
In some of the usages of manual lock/unlock,
an exception can leave the mutex locked.
So the guard should fit this better.
Change-Id: I3541abe7a0ec63edffe1e180c691531cabb3fccd
If stop bookkeeping is ever called twice or
without a successful start, it wraps to a huge value,
because the `session_num` is `unsigned int`.
Just a guard and throw a warning accordingly,
when 0 is reached.
Change-Id: Ic9cef4aa7ae827fc8ce68808a2e6f5753697ebbb
Out of the `SESSION_THREADPOOL` def block,
because actually used not only with it
(see implementation .cpp file).
Change-Id: I84549ea185b660cdde7619de3ddf5c5034bccfd1
Automatic memory management and less error prone as it avoids manual
pointer manipulations.
No functional change.
Change-Id: Id35f4e4dc8918436589001db4acdf55ff9c60e5f
Update the usage of the `getParameter()` through
the modules, whereas the default value isn't given.
Change-Id: I4c725639f56b70e5548fa3da321c8452675cdf99
Rework plug-ins parser so that it supports
the multi-line parsing.
E.g.:
load_plugins=wav;\
gsm;\
g729;\
opus;\
g722;\
di_dial;\
...
Change-Id: Ic672ff72db73279d9fd3d52ba9a60fa5f6d7eb25
uac_auth: fix 407 auth retry failing due to stuck OA state
When SEMS sent an INVITE with SDP to a peer requiring proxy
authentication, the 407 response was forwarded to the caller
instead of being handled transparently with a retry.
Root cause: AmOfferAnswer::onReplyIn() did not reset the OA state
for error replies (>= 300). After the initial INVITE, OA state
was OA_OfferSent. When the 407 arrived (no SDP body), the state
remained OA_OfferSent. UACAuth then tried to retry the INVITE
with the original SDP body, but onTxSdp() rejected it:
"There is already a pending offer".
Fix: add early return with clearTransitionalState() at the top of
AmOfferAnswer::onReplyIn() for replies with code >= 300, matching
the behavior already present in sems-pbx. This ensures the OA
state is reset to OA_None before UACAuth attempts the retry.
Additionally, store req.r_uri in SIPRequestInfo and use it for
digest URI computation instead of dlg->getRemoteUri(). This
ensures the Authorization uri field always matches the original
Request-URI, as required by RFC 2617, regardless of any dialog
state changes between the initial request and the 407 handler.
Change-Id: I780bc98f193421481156de3f69497d26b893c49d
Fixes:
AmUtils.cpp: In function ‘bool str2int(const std::string&, double&)’:
AmUtils.cpp:286:21: warning: catching polymorphic type ‘const class std::invalid_argument’ by value [-Wcatch-value=]
286 | catch (const std::invalid_argument)
| ^~~~~~~~~~~~~~~~
AmUtils.cpp:290:21: warning: catching polymorphic type ‘const class std::out_of_range’ by value [-Wcatch-value=]
290 | catch (const std::out_of_range)
| ^~~~~~~~~~~~
Change-Id: I3d112aff65ea6e90803b6be7c138227a36975d9f