Use smart pointers instead of handling with new/delete.
Fixes:
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable rev going out of scope leaks the storage it points to.
Change-Id: I33dfe6c4a74a01774093dc500248c3ed613b5710
When handling `XMLRPC2DIServer` allocation,
first make sure to have the `XmlRpcServer`
and then do rest of processing (e.g.: `di_export`,
`di_method`, `registerMethods()` etc.)
Otherwise can lead to seg.faults when appealing
to objects via still non-allocated `XmlRpcServer`
object.
Change-Id: Id3395ce3e0d6f2de76ed8caa1a786a6e139a851b
There is no need for a generic timer callback option without good
typing, as we can just subclass the timer class and use our own fire()
method and whatever other class members are needed.
Change-Id: I95cd60277b5b4d3f492389958fa7f2ead921479e
For the `XMLRPC2DIServer` class as well as for the
`XMLRPC2DI` one, heap allocated objects aren't properly
managed by destruction time.
Pointers have to be initialized as NULL, and point
only when allocation was successfull.
Then by a destruction time, check them and free.
Change-Id: I1a31813db254cc4ab0f7ecc7b382fcb3635feee0
There is only one instance of XMLRPC2DI API,
hence only one possible value for a list of
class members, such as:
- XML RPC port for DI
- XML RPC DI server
- variable, which defines, if that's configured
Additionally fixes:
Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member XMLRPCPort
is not initialized in this constructor nor in any functions that it calls.
Change-Id: I0120652220129774137e90d1ad8dfa579cca3202
It has no sense to keep it as `unsigned int`, because
it's used in comparisons with other `time_t` type
variables.
Although it's only used for now in `is_active()`.
Change-Id: Iceda2338d88ba7de38d084001bbfce03da75e452
No need to cast them into `unsigned int`,
especially using the C-style casting.
Fixes:
Use of 32-bit time_t (Y2K38_SAFETY)
store_truncates_time_t: A time_t value is stored in an integer
with too few bits to accommodate it.
The expression time(NULL) is cast to unsigned int.
Change-Id: I0b7ecb86d4941d4441c8e89ade589064693c226e
Use only references to pass parameters to constructor,
otherwise copy operation would be used instead of move.
Same for other class methods.
Fixes:
Variable copied when it could be moved (COPY_INSTEAD_OF_MOVE)
copy_constructor_call: direct_export is passed-by-value as parameter
to std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const &),
when it could be moved instead.
...
Change-Id: If4be730292b3329af1d806c8cf8292498428ea61
Fix possible memory leak during loading.
No functional change.
Fixes:
Resource leak (RESOURCE_LEAK)
leaked_storage: Variable s going
out of scope leaks the storage it points to.
Change-Id: Ibed584c7ce82056bf0d4c492d76b78584eb7ac08
Remove `uac_auth_f` from `RegistrationAgentFactory`,
not used.
Fixes:
Uninitialized pointer field (UNINIT_CTOR).
uninit_member: Non-static class member uac_auth_f
is not initialized in this constructor nor in any functions that it calls.
Change-Id: I3e8d0703d8bd7226369248bd87c1449f97e7ac6a
Don't use the `B2BgetHeaderReply()`, it's based on
last received positive reply (200OK), so quite useless
for provisional replies processing (18X).
Thus e.g. for 180 Ringing handling it will never
return anything, because it has no data to parse.
Instead cast event into B2BSipReplyEvent and
parse headers from there.
Change-Id: I4bc4ad5d3aebd7b9ea497bcd53f63736e89d61db
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
From MySQL (mariadb) release notes:
"Incompatible Change: The my_bool type is no longer used in MySQL source code.
Any third-party code that used this type to represent C boolean variables
should use the bool or int C type instead.
The change from my_bool to bool means that the mysql.h header file
now requires a C++ or C99 compiler to compile. "
Fixes:
SW_Vsc.cpp: In member function ‘virtual void SW_VscDialog::onInvite(const AmSipRequest&)’:
SW_Vsc.cpp:913:5: error: ‘my_bool’ was not declared in this scope; did you mean ‘bool’?
913 | my_bool recon = 1;
| ^~~~~~~
| bool
SW_Vsc.cpp:981:57: error: ‘recon’ was not declared in this scope
981 | if (mysql_options(my_handler, MYSQL_OPT_RECONNECT, &recon) != 0)
| ^~~~~
make: *** [../../core/plug-in/Makefile.app_module:83: SW_Vsc.o] Error 1
Change-Id: I74bc973299223fd00236569e905a57882b055f1a
Replace occurences of escaped CRLF used in
the hdrs value passed to the function.
This allows to pass multiple headers to the function,
whereas each header has `\r\n` at the end
(but the DSM script will always make it escaped,
hence the code must take care of it).
Change-Id: Ie76b44ff0f2d76105691aad6dbb5eb8d7dfb628a
This function replaces escaped `\r\n` occurences
into normal its view: `\r\n`.
Make this a function, to let it be reusable
for other DSM implementations.
Change-Id: Ica737df259fbf136b9a6855bc9439cbe005be6c1
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
Save last reply gotten and processed with
`DSMCallCalleeSession::onSipReply()`.
E.g. 18X are getting processed for DSM sessions there.
Change-Id: Ie0c44b1ddc8acd3fb07e01c6353eb2dce7a45a6e
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
Consider RecvonlyStream and None (sendrecv) hold types
as NonHold methods.
Fixes:
16: 52:44 CallLeg.cpp: In member function 'CallLeg::holdMethod CallLeg::updateHoldMethod(const AmSdp&)':
16: 52:44 CallLeg.cpp:1421:10: warning: enumeration value 'None' not handled in switch [-Wswitch]
16: 52:44 1421 | switch (hold_method)
16: 52:44 | ^
Change-Id: I2021dd7152ad258e03c28c56cb3b0c7a5e363266
Now `RecvonlyStream` is excluded from those
considered as SDP medias putting other side on hold
(with MoH). Hence no need to take it into account.
Change-Id: Ia04e7808898e0d5e4ac99b71a51e9c0126a0dc11
Rework this function so, that it has all
required for it handling in itself, and doesn't
depend on pre-calls of other things before.
Defined exact purpose of it:
- return `holdMethod` based on SDP
- update `hold_type_requested` class member
It uses `isHoldRequest()` to set the `holdMethod`
but doesn't take into account true/false returned
from it, hence uses this function only as a setter.
Change-Id: Ia89eb20294a2a2533b5fb1e6f5d6d95cbb6179dc
Don't consider (global) session level sendrecv
state, in case of media section absence, as
the `InactiveStream`.
Keep it consistent with a logic for media sections:
sendrecv - means active RTP stream on this leg,
hence no MoH to be provided.
Change-Id: I82f359823f69e7fc12835db1054d63621e7d1dad
Previously introduced by 175b00d72b79561d7
the `Recvonly` hold type had started to put
a call on MoH hold.
This was done so, to fulfill momentary demands
of call scenario which is in fact wrong and
should not be supported:
- A puts on sendonly hold B
- B puts vice-versa A on inactive hold
- now two-way MoH stream both sides
- B resumes his stream with recvonly (meanwhile
only sendrecv considered as the only possible
type to put off hold)
This commits keeps support of stream types
detection as it was, hence `RecvonlyStream` is
still supported. But not anymore considered as
a type which can trigger MoH, in other words
it doesn't put on hold.
This approach makes SEMS in sync with MoH
implementation in rtpengine, whereas only
sendonly and inactive states are allowed to trigger
MoH.
Change-Id: Icf5aa082092cd8f79e43d30339ae8f98a25a7381
Use `b2b_mark_dsm_for_updates` DSM session variable
to let updates towards caller have `P-DSM-App:`
header with a given value.
Change-Id: I4bc92f8ec9e2ec51bae70550c294a40581f92443
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
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
For cases when used in testing environment
add sw_vsc to the list of `exclude_app_modules`.
We cannot link this to the swrate library
while compiling locally, because swrate lib has
a separate repository.
Change-Id: Id5df2c197139a454b9338bb6bdccba87b1c78424
Fix a list of compilation warnings like:
warning: format ‘%llu’ expects argument of
type ‘long long unsigned int’, but argument 5 has
type ‘uint64_t’ {aka ‘long unsigned int’}
Change-Id: I93ca45869c33040d1e53bb8d29fdf7e7e70603bf
Add handling of the `ZeroedHold` and also handle the default action
in the switch inside `CallLeg::updateLocalSdp()`.
This eliminates the warning:
CallLeg.cpp: In member function 'virtual void CallLeg::updateLocalSdp(AmSdp&)':
CallLeg.cpp:2019:15: warning: enumeration value 'NonHold' not handled in switch [-Wswitch]
2019 | switch(hold_method_requested)
| ^
CallLeg.cpp:2019:15: warning: enumeration value 'ZeroedHold' not handled in switch [-Wswitch]
Change-Id: If0eebda2182b44aa591eb9aedd43481c94788b13
Exclude `mod_swrating` for the test environment,
because otherwise requires linkage with swrate
which is a separate, not visible library
for sems repository.
Change-Id: Ib4deaeebf6a1a411e473388920db017c1836842d
For cases when not defined explicitely
by given compilation variables, add
mod_py to the list of `exclude_dsm_modules`.
It's not used and relies on older python2,
which is not to see in newer environments.
Change-Id: Ic0b3bdb8530b21e9c25484487cbba075b8fea156
Improve Makefile so, that if the `exclude_app_modules`
isn't defined, it has a default value.
Also introduce the `TEST_ENVIRONMENT` variable
which defines, whether to take the `exclude_app_modules`
from given variables or take the one from the Makefile.
Change-Id: I046aa22be8042a053a844b9dd3ee283f7638b95e