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
recvB2BINVITE now tracks the Call-ID of every completed dialog in a
class-level set (_stale_b2b_cids) and skips any INVITE whose Call-ID
appears in that set. tearDown populates the set from _current_b2b_cid,
which recvB2BINVITE sets on each successful return.
This closes the narrow race window left by the setUp non-blocking drain:
a retransmission that arrives between setUp and the recvB2BINVITE call
can no longer poison b2b_cid for the current test, regardless of timing.
Change-Id: I206ff35e0c04f80d4bcd12eaa4a7dd56acb08152
On a heavily loaded CI host the SIP T1 retransmit timer (500 ms) fires
before the test framework processes responses, leaving extra datagrams
in the shared _uas_sock that survive tearDown. Additionally, SEMS
generates its own Call-ID for B-leg dialogs, so messages from different
tests mix on the same socket.
Changes:
t/sems_tester.py:
recvB2BINVITE(): new helper — reads from shared UAS socket skipping
any non-INVITE datagrams (stale BYE/ACK from previous tests)
recvSIPForCall(sock, b2b_cid): new helper — reads from shared UAS
socket discarding messages whose Call-ID doesn't match the current
B2B dialog
t/test-b2b.py:
tearDown: increase drain timeout 0.5 s → 1.5 s (covers up to 3×T1)
All recvFromSIP(_uas_sock) INVITE reads replaced with
recvB2BINVITE() + b2b_cid = _hdr(…, "Call-ID")
All subsequent recvSIP(_uas_sock) reads replaced with
recvSIPForCall(_uas_sock, b2b_cid) to discard stale datagrams
testInviteRetransmission: "must NOT forward" block filters by Call-ID
testEarlyCancelRace / testRtpDirectionHold: BYE/CANCEL acceptance
conditions extended with `and b2b_cid in msg`
testConcurrentCalls: setup_call() uses recvB2BINVITE +
recvSIPForCall, BYE waits keyed on per-call b2b_call_id
Change-Id: Id8987d3594c487d8b78c38ed3b9f580544a83693
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