The 'dlg.profile_get_size' is specified to return a single value, so
we cannot return a list, otherwise on the XMLRPC interface it gets
serialized into a concatenated list of structs, instead of an actual
array of structs.
Instead we remove the previous overloaded semantics and add a new
command that returns a list, and has a more explicit plural name
following the existing naming convention.
Fixes: commit 7168dd66db
Change-Id: Ib4a620ed680fac340bf4926dc0f1529195c9818c
When using the command 'dlg.profile_get_size' in 'ngcp-kamcmd' one must specify the profile to get its size.
Whith this modification when no parameter is used a list of all profiles with their sizes,
this avoid having to execute the command multiple times.
Change-Id: Ia49a5b1feb08b592d7be9b8d2ce0bc43311aaa24
allows to skip processing messages that don't belong to a test scenario
* improve detection of dynamic format
* fix memory leaks
Change-Id: I63bf4176a5e8dace49c7bd8595a6fb77016818cd
Previously, to remove a parameter from a header it was needed to create a complex method on the configuration file for each header/parameter. This modification moves this complexity to the 'pv_headers' module.
Two new functions:
* pvh_header_param_exists
* pvh_remove_header_param
Both functions take as parameters the name of the header and the name of the parameter.
It returns '-1' if the combination header/parameter:
- is not found (pvh_header_param_exists)
- couldn't be removed (pvh_remove_header_param).
Examples (proxy configuration):
if (pvh_header_param_exists("Supported", "100rel"))
{
// "100rel" is present on the "Supported" header
}
if (pvh_remove_header_param("Supported", "100rel"))
{
// "100rel" removed from header "Supported"
}
Change-Id: I2a95bcb54bf21d64cbf2c6f894b76e9f3cc7bdbc
In the current implementation only parsing of ICE candidate
attributes is supported, which makes it Possible to work
with ICE candidates and parameters specifically related per
candidate, but makes it Impossible to work
with ICE options of the media stream level (ICE options which
have an impact on the whole specific media stream).
ICE candidate attributes and ICE media options have different
dedication.
In order to target this matter, a new linked list is introduced
to store ICE media stream options.
Additionally, now when parsing media stream's attributes,
a couple of new helper functions have been introduced to
properly extract and store ICE media options:
- extract_ice_option()
- add_sdp_ice_opt()
The following extraction approaches are supported:
- multi-valued ICE options attribute (more than one value per a= header)
- one value per attribute (multiple a= headers with ICE options present)
Also now the way how a "zeroed" on-hold is detected is improved,
in case of the ICE (re)negotiation (when the connection address is equal
to '0.0.0.0', the media port is equal to '9' and ice-option 'trickle' is
present) the SDP is Not considered as an on-hold case, and it clearly
detects it's the ICE (re)negotiation (RFC 8840), which for e.g.
leads to a proper work of other side modules' functions (which use SDP
parser's data structures),
such as 'is_audio_on_hold()' from the textops.so module.
Additionally:
core: improve an existing data structures cloning in the SDP parser
It's been noticed that the cloning of SDP session(s) and
SDP stream(s) structures doesn't allocate the ICE candidate attributes,
nor it allocates (recently introduced) ICE media stream options.
In order to target this a couple of new functions have been introduced:
- clone_sdp_opt_attr()
- clone_sdp_ice_attr()
And additionally the following functions have been improved, in order to
properly clone/free ICE candidate attributes and (recently introduced)
ICE media stream options:
- clone_sdp_stream_cell()
- free_cloned_sdp_stream()
- free_sdp()
- print_sdp_stream()
Additionally for a proper new structure length calculation, the following
function is fixed:
- clone_sdp_session_cell()
Change-Id: Ie357cb236af35f1fc7f0efceababc8920206b375
It has been noticed, that after a list of contributions into lcr:
* 14e6fc8
* d8583d6
* 470fd5b
* aa8d3ed
the gateways matching when a search is being done based on
the IP address and the src_port (through the list of GWs with the same IP)
works, but not fully correct.
It is only related to the usage with the third parameter 'src_port',
when calling from_gw() and from_any_gw(), and, only when the search
is done through the gateways list, which have the same IP address
(but different ports). If gateways have different IPs, the issue
is not catchable.
The problem is in the algorithm used for matching based on
two objects (ip_addr and src_port) - the binary search.
It's not fully suitable for a search based on two (or more) objects.
The binary works completely fine, when only one object is used for searching,
but works not fully correct when the search is based on a comparison
of two (or more) objects. A division happening based on the value of
the first object, gives a chance that the second object will never
be found in the current half being looked up.
This commit concerns switching to a full cycling through the list of
gateways of the same lcr_id, and gives a proper work of the do_from_gw().
The slight drawback of the new method is that we have to do a cycling
through the whole list of GWs of the same lcr_id, but on the other hand
it is much more efficient than trying to build up a matching using binary
based on two objects (ip_addr and src_port) being used for comparison.
Change-Id: I8751adb5137a79e585c21b182319e7496412d81f
This commit deprecates:
* tm: previously added function t_append_branch_by_contact().
* tsilo: previously added functions ts_append_by_contact() / ts_append_by_contact_to()
TM. This commit introduces a possibility of TM's API to append a branch
based on a specific location (Contact's URI).
The function 't_append_branches()' has been extended, and is now able
to obtain a parameter Contact of str type and takes care of appending a branch only for it.
The way how the function acts now depends on if the contact parameter of str type
is given or not (empty or not). If the contact parameter is given, then only a desired location
is meant for appending. If not found in the location table, an append will not happen for this AOR.
Otherwise create branches for all existing location records
of this particular AOR. Search for locations is done in the location table.
TSILO. Add support of a lookup and branch creating by contact
Improvement of the TSILO module, which allows to run a lookup using the provided RURI,
but only to create a new branch for the Contact, which is set in the currently processed REGISTER.
Or optionally a Contact URI value given as a parameter to the function.
If the Contact URI for a lookup, is given as a parameter,
it is possible to provide it as a pseudo-variable.
Hence it is now possible to append new branch(es) for only UAC(s)
getting REGISTERED at the moment of calling script function 'ts_append_by_contact()'.
Previously it was only possible to create new branches
for all previously present location records (for this specific URI), which was in some circumstances undesired.
New script functions introduced: ts_append_by_contact(table, ruri [, contact])
New module functions introduced:
* w_ts_append_by_contact2() / ki_ts_append_by_contact()
* w_ts_append_by_contact3 / ki_ts_append_by_contact_uri()
Change-Id: Idd4775000f8e80999455680704c64a1208c67b3f
* skip_headers is now ignored when a branch's xavps are cloned,
this is needed to transparency that all headers that came with
the SIP message are avaialable via $x_hdr, wheres pv_headers
skips them when they are applied to the SIP message.
Change-Id: I742b373a3a0d38c755aa5ecfb8683e172a4d52f2
generate an uuid for PUBLISH id field instead of callid
https://github.com/kamailio/kamailio/issues/2906
Not exactly the same version from upstream since we
have changes in the module not yet merged
Change-Id: I50dd72f427b94da41c1d46236c05aa041b15f1cb
We need to rewrok TSILO module and partially TM's API,
so that it is able to run a lookup using the provided RURI,
but only create a new branch for the Contact,
which is set in the currently processed REGISTER.
Optionally add a possibility to provide a contact as a pseudo-variable.
Hence we will be able to append new branches for only UAC(s) comming
online now (being REGISTERED).
New script functions introduced, tsilo:
- ts_append_by_contact(table, ruri [, contact])
New functions introduced, tsilo:
- w_ts_append_by_contact2() / ki_ts_append_by_contact()
- w_ts_append_by_contact3 / ki_ts_append_by_contact_uri()
- ts_append_by_contact() / ts_append_by_contact_to()
New functions introduced, TM:
- t_append_branch_by_contact()
Change-Id: Id321a261b137c83bfa38a150c6ff67ca312ae61d
It has been noticed, that after a list of contributions into lcr.so of kamailio,
the from_gw() and from_any_gw() functions are not working fully correct.
However it is only related to the usage with the third parameter 'src_port'.
Last time (last commit into lcr.so), the back compatibility was provided not to break anything for the kamailio community,
this means, it's only related to usage with the 'src_port' parameter.
from_gw() and from_any_gw() functions are not working fine,
when we have tens of gateways with the same IP address in the 'lcr_gw', and you use src_port for searching as well.
It works fine, if you have 2-5 gateways, but not with tens of them.
This is all the matter of the implementation and some limitations of how
the iteration through the memory is done (memory allocated for a list of specific structures),
and binary search used for that.
This is our own Sipwise's patch to handle that case which is intended to be kept internally.
This patch introduces a more simple iteration, but it works more efficient,
when the search for two objects at a time for matching items is done.
Change-Id: I0e7fb2ea59edb7d22636e58f002ca9cb59d42315
Improve binary search in the lcr module and add a possibility
to do a matching not only based on an IP address of a GW, but also using a source port.
When a possibility to use 'src_port' parameter in from_gw() and from_any_gw() was introduced,
the bsearch() remained untouched, and hence the matching (iteration through existing GWs)
is now done only based on an IP address.
This leads to the issue, when there are more than one GW with the same IP address in gws table,
and from_gw() and from_any_gw() functions are used with the 'src_port' parameter,
it can happen that a wrong GW is picked out by bsearch() from gws table (lcr_gw) and
a check by from_gw() and from_any_gw() returns False.
Hence the matching based on IP address and source port is required for bsearch(),
when from_gw() and from_any_gw() functions are used with the 'src_port' parameter.
This means backwards compatibility is still present (when one uses functions without 'src_port').
Change-Id: I90327ef69d8132cc9e11522567cbc026e0808602
A simple change, which allows to check, if a coming request matches
not only by an IP address and a transport protocol,
but also using the source port of a request.
Improvements are done for the following functions of the lcr module:
- from_any_gw()
- from_gw()
Back compatibility provided, hence it does not affect already existing behavior.
Change-Id: Id0496fad75ce64f1abecaa4747b4a77ec6b87cbf
If we set Diversion in split_headers and we get a header like
> "RULTEST, normalaa" <sip:0046341355354340@whatever.net;user=phone>;reason=unconditional
There was false detection of two Diversion headers.
Skip split marker between double quotes to avoid this
Change-Id: Ib2189bc0029f244fd59f14df5b3d1df745271038
Since we use Redis SETs to simulate non-unique indexes, we can use these
SETs to perform a much faster table scan when an appropriate index
exists. For usrloc expiry query in a typical scenario, this brings the
list of key strings that need to be checked down from 170k to 19k.
Change-Id: I1c4841be5cd28ad42196b4da6b5bb3e6e1b6ed50
Instead of making the COUNT increase and falloff dependent on the number
of results produced, we make it dependent on the query run time. This is
to prevent Redis being blocked by extended consecutive SCAN queries.
Each individual query should not run longer than 100 ms, and we also add
a short pause before going to the next SCAN to give competing queries a
chance to run.
Change-Id: I6b88cacf795513cf3e0aeefc67fbedef8e1bb8c1
We have value-less master keys to keep track of entries. These keys are
useless when looking for fast-searching keys and are not better than a
full table scan, but are erroneously seen as a better key match than
range-matching keys. Therefore just ignore value-less master keys.
Change-Id: Ibc9ad87a42412b6cf21eac47fbe0ee8e39af4aff
(cherry picked from commit 79b4ac5bb75fe83914fddc104a8fc7c7ce2d0681)
* to control how stopper column is used.
0 => default behavior
1 => stopper will be checked after sort process
Change-Id: I2b59111e40a1aedbd6c5446a5906b53c687a8ad4
Use the avp value when creating P-Asserted-Identity instead of
values from Headers in order to allow to insert E164 format value.
If no value, skip creation of header.
Change-Id: I81282da27325d02987b3dc1079605de0d6b340a8
* if we use pv_get_spec_name() cfgt will throw errors trying to get values
like $x_hdr($xavp(whatever=>y)) when there's no $xavp(whatever=>y)
Change-Id: I88f91e30f969e309c566f6c15495796350b0ba5f
When AVP is used instead of value from header, we were missing
the call to parse_uri() so value at parsed_uri was empty
Change-Id: I37ce0626691eae4d313b39474d6d57cd8baf87dc
When a Redis key can be deleted directly, we still need to build the
list of type keys for that table in order to delete dependent entries,
which are the indexes used for faster DB access.
Change-Id: Ib8fdad428946263fc9eba466868347fee219dfbc
* __dialog_created() -> get_dialog_data() -> creates dlg callbacks for
__dialog_sendpublish()
__dialog_sendpublish() can be executed by two different process and
if we use refresh_pubruri_avps_flag shared memory can change in between
Change-Id: Id81b66209c27a900033f557cfa175ca3067aa34c
* remove pvh_remove_xavi()
* rework pvh_set_header():
use core pv_get_spec_*
use PV_IDX_NONE to detect no index case
remove values instead of adding NULL if PV_IDX_ALL
* changes needed from upstream:
https://github.com/kamailio/kamailio/pull/2341
Introducing PV_IDX_NONE so we can know when idx == 0
if $x_hdr(HEADER) or $x_hdr(HEADER[0])
So we can append or set the value
Change-Id: I496d65cc7e0e92167967edfb592fff6a6b0d6e3b
* for split_headers and for applying multi index
headers str_hash_case_get() is now used instead of str_hash_get()
to follow the case insensitive approach
Change-Id: I9c99f91e68836df593e0120596494829aab2363a
* header names are now case insenstitive when used to store
or retrieve values
* check for skip headers should be insensitive too
Change-Id: Ie0f5c45ce5ce24623c6233e342b646525c6081b9
* pv_headers same version from upstream
* move patches contributed upstream from sipwise to upstream
Change-Id: I7a484c589d1c28e869490e2737f94c9daf8bb9ff
Fails due to:
| Traceback (most recent call last):
| File "/usr/lib/x86_64-linux-gnu/kamailio/kamctl/dbtextdb/dbtextdb.py", line 1239, in <module>
| main(sys.argv)
| File "/usr/lib/x86_64-linux-gnu/kamailio/kamctl/dbtextdb/dbtextdb.py", line 1233, in main
| except (Error, e):
| NameError: name 'e' is not defined
Change-Id: I09ed6d0bd1b6fdad5f9b04cd54fef1ee43a44312
* support refreshing info after dlg_manage() is called via a new flag
Find the callee is been resolved way after in our config
* control local identity value via dlg_var
Change-Id: I6c9781626944c427693a30ed0e67d32cc582a714
* don't try to detect branch every time
* reduce use of dynamic memory
* rework reply scenario, keep reply_counter in xavp
* hook to branch event too
Change-Id: I0adf97d4cb2d214e80fae48f8fdc643c1a644cc6
* Modified funtion t_load_contact adding the 'mode' parameter:
- if equals to 0 or missing, it behaves as before (standard behavior)
- if equals to 1, contacts are ordered using a proportional algorithm
that use to q-value to calculate the weight of each contact. Higher
is the q value, higher is the probability to be contacted as first.
* Added new function ki_t_load_contact_mode to be able to set the
'mode' paramenter also from KEMI.
* Additionally a small code refactory has been done in order to
keep the code easier to read and to avoid duplications.
Change-Id: Ic39a70e43004422e2b6e5db4788df68d9e223129
The fix for issues with tls with openssl 1.1.X was not included
on debs due to We set CC_EXTRA_OPTS and LC_EXTRA_OPTS on debian/rules
Change-Id: I5cd35bcbd6f33042a7ef43ddac2c7972273da206
* tls fix is included since 5.2.5
* rename tt41650 patch to more descriptive name
* reorder patches from us
* add upstream links for the ones that have PR
Change-Id: I69c2a7bf8a805744d3eda4ee4294fa1698187b16
* fix sipwise/fix_error_in_cfgt_module.patch:
not_sip needs to be reset for sip messages after non_sip detection
* reorder some patches to avoid confusion
* Let's try to keep the descriptions for patches in order to be
able to track them easily
Change-Id: I11ea589387696f10d2f86b4e65b0dee85175ffbb
* use pvh_ prefix not to collide with pv
* use generic PKG_MEM_ERROR, SHM_MEM_ERROR
* split code into more small files
* create proper source doc
* clang-format with kamailio's settings
Change-Id: I6baaa658ae56763bca48f298e37410966414f270
A recent Kamailio version update has added an extra field to the end of
the gw list returned by load_gws() (the rule ID), which throws off
lcr_rate() as it looks at the last field in each gw string. Reverse the
approach to instead count the number of fields from the start of the
string to allow possible future extension of the field list.
Change-Id: I143e738553cec57047b19d94b6effa59788c1dc9
We should not be calling async-signal-unsafe functions from within
signal handlers. This is in general bad on a non-threaded program,
but probably way worse with threading enabled.
Change-Id: I2931ce394f703b420c491438136029a670c83207
Kamailio always checks configs on start and will NOT start
of configs are NOT OK and/or damaged.
The old kamailio SysV init script also had such check
to prevent kamailio _stop_ in case if configs are not OK.
It is not the case for systemd unit file anyway.
There is no reason to check configs and then start kamailio,
it is just wasting of time (each check 1-2 seconds) on Jenkins VMs.
Change-Id: Ic0d3d8efa0ad2a3fb3f9ea5e13fd1204d95f584f
The upstream parts will get updated when we switch to the next upstream
release as they have already been merged in upstream's master from the
pull request <https://github.com/kamailio/kamailio/pull/2110>.
Change-Id: I6408ee3d47d87be9bbe719b0e6da41e85d875764
It turned out that keep the package name ngcp-kamailio-python-modules,
previous name, after the switch to python3 creates issue during the
building of the related debug symbols.
Issue is solved if we move to the new name ngcp-kamailio-python3-modules.
This is also more consistent to the startard package naming we already
have in use.
Currently during the upgrade to the new kamailo version the new package
have to be installed manually (we never install/use this package in
our standard NGCP systems).
If a customer installed the python2 version of the package should check
itself the compatibility of the created python2 code with python3.
Change-Id: I4e80d11fab53014c0e50848cbafef6e9df16fdce
Necessary because python2 is being removed from Debian, and is
going to be EOL soon enough by python upstream
Change-Id: I98d94cdfdac2d8ebc8d5a22130656d198433f5eb
dfks_subs_handler does not set default values for XML elements extracted
from the body and ends up doing a strlen(NULL) if the elements are
missing.
Change-Id: I520f9f0a45c35bfb134fac5a0aa275ee3d2613f3
- build long orderless lists in reverse (forward list building has
exponential runtime)
- fix mem leaks
Change-Id: I00aa4d6bfd3eda5b37e04e79143b74b3ebd6224e
Adding a value-less key makes it a SET that contains all entry keys,
making it possible to use SCARD to count all entries.
Change-Id: I8da92944dda9df9c381d1a08ce23b142af68a69b
KEYS is considerably faster then SCAN, even with just one iteration, and
since we're always reading the full set of keys in one go anyway,
there's no benefit of using multiple SCAN invocations.
Change-Id: I0771db1b90273bf3bf73cb6b53e7d9ef8c43fcc6
We introduce a special case handling of range matching (< or > operator)
against timestamp key values, as required by the usrloc module. Without
this, the timer handling the removal of expired location entries would
have to a full table scan every time it runs (including at shutdown).
This feature detects the special case (a usable timestamp key type) and
converts the range match into a series of wildcarded SCAN statements. So
instead of doing a single full table scan which mostly returns non
matching rows, we do a series of more specific table scans, each of
which only returns relevant matching rows, or no rows at all.
Change-Id: I6c77b9d595b5f70aed976bdcd0cae329f198937b
If an update changes the value of a type key, we must propagate that
updated value to the respective type keys.
Change-Id: I7ad5c85aa9e7540e2ac558ca6b8c3125f2dfec9a
When looking for usable type keys, we must consider only types using the
DB "=" operator. Skip type keys that use any other operator.
Change-Id: I2ef696dc6d4930bc63e102c8251082ef9e3ff6b8
Redis is allowed to return an empty list in response to a SCAN even when
the iteration isn't complete yet. Only a zero cursor value returned from
a SCAN is indicative of the SCAN being complete.
Change-Id: Ib5da589c6944fcd46b2bbdc11c200e6a4f7108cb
This reverts commit 1192c499ca.
Reverted because ngcp-check-status-integrity complains about integrity
of Debian package files after changes are applied with ngcpcfg framework.
Change-Id: I7d1e998b226712614a681800082ab94979fcd355
In postinst file add commands to move db_redis table descriptor
in /etc/kamailio folder in oreder to be oevrwritten using ngcpcfg
framework
Change-Id: Id855946b59f65ca36c011949db3dfd01556530da
This reduces substantially the debian/rules file, simplifies it, and as
a side-effect also fixes the jobserver warnings previously emitted by
make.
Change-Id: I1347c888ba16aff42be5e0912d03bcd9bf7e919b
When we need to call make from within a Makefile, we should do so by
using the MAKE variable, which has special meaning for make itself.
This makes sure, it will get marked as recursive command, and will
make it possible to use the make jobserver.
Change-Id: I8c37f2906b7e2592cb02912a59c7979b79d33f2a
Since the upgrade to 5.2.3 carrierroute module as been moved to
extra module group, as it don't depends on the libconfuse library
anymore. Thus it can be integrated in the main kamailio package.
Change-Id: Ia904ac665258174c85bd88bfd32c99b9535c0a92
* add modparam=auto_msg that is enabled by default
and if the tm module is also loaded it automatically
collects and applies the headers on incoming request/reply
and when a request/reply is forwarded
* for SIP_REPLY messages the FL_NAME_PV_HDRS_COLLECTED,
FL_NAME_PV_HDRS_COLLECTED flags are applied for the message
of the branch
Change-Id: Ife3a8d92ecd33263c35e554bb8da364ee3f03703