route[HANDLE_INVITE] {
if (!has_totag()) {
if (!t_newtran()) {
xlog("L_ERROR", "Failed to create new transaction\n");
sl_reply_error();
exit;
}
if (!is_present_hf("X-VICIdial-Client-Id")) {
xlog("L_WARN", "INVITE received without X-VICIdial-Client-Id header\n");
t_reply("400", "Bad Request - Missing Client ID");
exit;
}
if ($rU == $null) {
xlog("L_WARN", "INVITE received with empty Request-URI username\n");
t_reply("400", "Bad Request - Missing User");
exit;
}
$var(full_client_id) = $hdr(X-VICIdial-Client-Id);
# Extract parent ID
if ($var(full_client_id) =~ "^(CID_[0-9]+)-[a-z]$") {
$var(parent_client_id) = $(var(full_client_id){re.subst,/^(CID_[0-9]+)-[a-z]$/\1/});
} else {
$var(parent_client_id) = $var(full_client_id);
}
# CPS Check and Rate Limiting
lock("cps_counter");
# Get current CPS count and max limit
$var(current_cps) = $sht(client_limits=>$var(parent_client_id));
$var(max_cps) = $sht(client_max_cps=>$var(parent_client_id));
xlog("L_INFO", "CPS Check - Client: $var(parent_client_id), Current: $var(current_cps), Max: $var(max_cps)\n");
# Check for configured limit
if($var(max_cps) == $null) {
unlock("cps_counter");
xlog("L_WARN", "No CPS limit configured for client $var(parent_client_id)\n");
t_reply("403", "Client Not Authorized");
exit;
}
# Get concurrent calls
$var(concurrent_calls) = $sht(client_calls=>$var(parent_client_id));
if($var(concurrent_calls) == $null) {
$var(concurrent_calls) = 0;
}
# Strict limit check
if($var(concurrent_calls) >= $var(max_cps)) {
unlock("cps_counter");
xlog("L_WARN", "Concurrent call limit reached for $var(parent_client_id): $var(concurrent_calls)/$var(max_cps)\n");
t_reply("503", "Concurrent Call Limit Exceeded");
exit;
}
# Allow call and increment counter
if($var(current_cps) == $null) {
$sht(client_limits=>$var(parent_client_id)) = 1;
} else {
$sht(client_limits=>$var(parent_client_id)) = $var(current_cps) + 1;
}
xlog("L_INFO", "Call allowed for $var(parent_client_id): Concurrent=$var(concurrent_calls+1)/$var(max_cps)\n");
unlock("cps_counter");
$var(user) = $rU;
# Extract parent client ID if this is a child ID
if ($var(full_client_id) =~ "^(CID_[0-9]+)-[a-z]$") {
$var(parent_client_id) = $(var(full_client_id){re.subst,/^(CID_[0-9]+)-[a-z]$/\1/});
$var(is_child) = 1;
} else {
$var(parent_client_id) = $var(full_client_id);
$var(is_child) = 0;
}
$avp(full_client_id) = $var(full_client_id);
$avp(parent_client_id) = $var(parent_client_id);
$avp(user) = $var(user);
$var(call_id) = $ci;
route(GENERATE_SERIAL_NUMBER);
# Track client calls
lock("client_counter");
# Update parent counter
$var(parent_calls) = $sht(client_calls=>$var(parent_client_id));
if($var(parent_calls) == $null) {
$var(parent_calls) = 0;
}
$sht(client_calls=>$var(parent_client_id)) = $var(parent_calls) + 1;
# If it's a child ID, update its individual counter too
if ($var(is_child) == 1) {
$var(child_calls) = $sht(client_calls=>$var(full_client_id));
if($var(child_calls) == $null) {
$var(child_calls) = 0;
}
$sht(client_calls=>$var(full_client_id)) = $var(child_calls) + 1;
}
# Store mappings
$sht(client_calls=>$var(call_id)) = $var(parent_client_id);
$sht(client_original=>$var(call_id)) = $var(full_client_id);
unlock("client_counter");
# Find destination with lowest active calls
$var(min_calls) = 999;
$var(selected_dst) = "";
lock("calls_counter");
if (ds_select_dst("4", "4")) {
$var(count) = 0; # Add counter
$var(current_calls) = $sht(active_calls=>$du);
if ($var(current_calls) == $null) {
$var(current_calls) = 0;
}
if ($var(current_calls) < $var(min_calls)) {
$var(min_calls) = $var(current_calls);
$var(selected_dst) = $du;
}
while(ds_next_dst() && $var(count) < 350) { # Set higher than 280
$var(count) = $var(count) + 1;
$var(current_calls) = $sht(active_calls=>$du);
if ($var(current_calls) == $null) {
$var(current_calls) = 0;
}
if ($var(current_calls) < $var(min_calls)) {
$var(min_calls) = $var(current_calls);
$var(selected_dst) = $du;
}
}
}
if ($var(selected_dst) != "" && $var(min_calls) < 25) {
$du = $var(selected_dst);
# Add this block - Double check the count hasn't changed
$var(current_count) = $sht(active_calls=>$du);
if ($var(current_count) >= 25) {
unlock("calls_counter");
xlog("L_ERROR", "Count increased during selection for $du to $var(current_count)\n");
t_reply("503", "Service Unavailable");
exit;
}
# Store Call-ID to destination mapping
$sht(active_calls=>$var(call_id)) = $du;
# Increment call counter
$sht(active_calls=>$du) = $var(min_calls) + 1;
unlock("calls_counter");
route(RELAY_INVITE);
} else {
unlock("calls_counter");
xlog("L_NOTICE", "Unlocked $ci");
$du = "sip:34.125.5.64:5060";
t_on_failure("FINAL_FAILURE");
if (!t_relay()) {
t_reply("500", "Internal Server Error");
}
}
} else {
route(RELAY);
}
} here is my invite rout configuration if you look at to the cps limit this is occultly the call per second limit on the client id when i set it 200 and the start calling up to 3000 per seconds so some time or for a bit of time it exceed the limit 201 or 202 then it start enforce 200 so if anyone have the best idea or suggestion regarding to this with the good ms time
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4040
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4040(a)github.com>
Dear Kamailio Team,
My name is Marletta, and I am a technician.
I am working on a project involving Kamailio and need some information or assistance to configure its integration with Microsoft Teams and Asterisk.
Specifically, I would like to know:
1. Is this integration feasible?
2. Which certificates should be used?
3. How can I validate the communication between Kamailio and Teams?
I have consulted the official documentation and forums but could not find comprehensive answers.
Would it be possible to receive your support or be directed to relevant resources or experts?
Thank you in advance for your time and for the work you do to support this remarkable open-source community.
I remain available to provide further details or clarifications.
Best regards / æ¤è‡´
[cid:image001.png@01DB3F60.F5D74DE0]
Giuseppe Marletta
Viale Europa, 128 - 65010 SPOLTORE (PE)
Tel [+39] 085 4450011- Fax [+39] 085 4459477
PI e C.F. 01635460684
www.tecnojest.com<http://www.tecnojest.com/>
[Image result for you tube icon]<https://www.youtube.com/@tecnojestsrl>[cid:image003.png@01DB3F60.F5D74DE0]<http://www.tecnojest.com/> [cid:image004.png@01DB3F60.F5D74DE0] <https://www.linkedin.com/company/tecnojests.r.l./>
Le informazioni contenute nella presente e-mail e nei documenti eventualmente allegati possono essere confidenziali e sono comunque riservate al destinatario della stessa. La loro diffusione, distribuzione e/o copiatura da parte di terzi è proibita. I contenuti testuali sono divulgati a mero titolo informativo, gli stessi non possono essere rivendicati come impegni, ordini o commesse se non accompagnati da specifico documento firmato a norma di legge. Se avete ricevuto questa comunicazione per errore, Vi preghiamo di informare immediatamente il mittente del messaggio e di distruggere questa e-mail.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
Module: kamailio
Branch: master
Commit: 77e7494d29d891c44a49377a462b0c82e6769f1e
URL: https://github.com/kamailio/kamailio/commit/77e7494d29d891c44a49377a462b0c8…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2024-11-26T10:46:10+01:00
modules: readme files regenerated - dispatcher ... [skip ci]
---
Modified: src/modules/dispatcher/README
---
Diff: https://github.com/kamailio/kamailio/commit/77e7494d29d891c44a49377a462b0c8…
Patch: https://github.com/kamailio/kamailio/commit/77e7494d29d891c44a49377a462b0c8…
---
diff --git a/src/modules/dispatcher/README b/src/modules/dispatcher/README
index ef5c56f6df6..44439a450d7 100644
--- a/src/modules/dispatcher/README
+++ b/src/modules/dispatcher/README
@@ -1678,6 +1678,11 @@ onreply_route {
The parameters can include variables.
+ The returns 1 (cfg-true) when the oc attrbutes are udpated for a
+ destination record; -1 (cfg-false) when there is an internal error; -2
+ (cfg-false) when no destination is updated (e.g., not found or the
+ ocseq condition fails).
+
This function can be used from ANY_ROUTE.
Example 1.61. ds_oc_set_attrs() usage
Module: kamailio
Branch: master
Commit: 76f2d91dc00fa33368d4df0d5a25a2dbbbc9f8c7
URL: https://github.com/kamailio/kamailio/commit/76f2d91dc00fa33368d4df0d5a25a2d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-11-26T10:39:35+01:00
dispatcher: updated docs for ds_oc_set_attrs()
---
Modified: src/modules/dispatcher/doc/dispatcher_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/76f2d91dc00fa33368d4df0d5a25a2d…
Patch: https://github.com/kamailio/kamailio/commit/76f2d91dc00fa33368d4df0d5a25a2d…
---
diff --git a/src/modules/dispatcher/doc/dispatcher_admin.xml b/src/modules/dispatcher/doc/dispatcher_admin.xml
index 5e7cb95953c..f311be2f1ff 100644
--- a/src/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/src/modules/dispatcher/doc/dispatcher_admin.xml
@@ -2073,6 +2073,10 @@ onreply_route {
</listitem>
</itemizedlist>
<para>The parameters can include variables.</para>
+ <para>The returns 1 (cfg-true) when the oc attrbutes are udpated for a
+ destination record; -1 (cfg-false) when there is an internal error;
+ -2 (cfg-false) when no destination is updated (e.g., not found or the
+ ocseq condition fails).</para>
<para>
This function can be used from ANY_ROUTE.
</para>
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
Various fixes for issues discovered with the Coverity static analysis tooling.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4030
-- Commit Summary --
* cdp: fixes for various issues found with coverity
-- File Changes --
M src/modules/cdp/authstatemachine.c (2)
M src/modules/cdp/common.c (8)
M src/modules/cdp/diameter_peer.c (6)
M src/modules/cdp/receiver.c (4)
M src/modules/cdp/session.c (12)
M src/modules/cdp/session.h (13)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4030.patchhttps://github.com/kamailio/kamailio/pull/4030.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4030
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4030(a)github.com>
Module: kamailio
Branch: master
Commit: 1ceeba7364b745b6ca2840e830d006a37460d10e
URL: https://github.com/kamailio/kamailio/commit/1ceeba7364b745b6ca2840e830d006a…
Author: Dragos Vingarzan <vingarzan(a)gmail.com>
Committer: Dragos Vingarzan <dragos(a)neatpath.net>
Date: 2024-11-25T13:33:40+01:00
cdp: fixed issues discovered during static code analysis
This fixes:
- 4-bytes (typically uint32_t) used for time_t storage (Y2K38)
- print of time_t with %d instead of %ld
- reuse of same loop index variable in a sub-loop
- use of random(), when kam_rand() could theoretically be better
- copy-paste mistake in sp2/sp parameter, where sp2 was meant and sp is probably NULL
---
Modified: src/modules/cdp/authstatemachine.c
Modified: src/modules/cdp/common.c
Modified: src/modules/cdp/diameter_peer.c
Modified: src/modules/cdp/receiver.c
Modified: src/modules/cdp/session.c
Modified: src/modules/cdp/session.h
---
Diff: https://github.com/kamailio/kamailio/commit/1ceeba7364b745b6ca2840e830d006a…
Patch: https://github.com/kamailio/kamailio/commit/1ceeba7364b745b6ca2840e830d006a…
- Added parameter to control the interval
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
This PR adds a timer that its interval can be controlled with the param `ping_interval`.
The timer pings all registered rtpengines and disables if any are found not responsive and vice versa.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4016
-- Commit Summary --
* Add timer to ping rtpengines
-- File Changes --
M src/modules/rtpengine/rtpengine.c (50)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4016.patchhttps://github.com/kamailio/kamailio/pull/4016.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4016
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4016(a)github.com>