Module: kamailio
Branch: master
Commit: e997473fd2dea1056b601ab76693e071f3480866
URL: 
https://github.com/kamailio/kamailio/commit/e997473fd2dea1056b601ab76693e071f3480866

Author: Morten Tryfoss <mor...@tryfoss.no>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2023-11-13T11:25:42+01:00

cdp: Support for diameter routing agent (DRA) / relay

If an endpoint responds with a CEA indicating support for relaying
(application-id 0xffffffff), let this endpoint be used for any application.

---

Modified: src/modules/cdp/diameter.h
Modified: src/modules/cdp/routing.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/e997473fd2dea1056b601ab76693e071f3480866.diff
Patch: 
https://github.com/kamailio/kamailio/commit/e997473fd2dea1056b601ab76693e071f3480866.patch

---

diff --git a/src/modules/cdp/diameter.h b/src/modules/cdp/diameter.h
index 1e69dd2be62..b84f01b4787 100644
--- a/src/modules/cdp/diameter.h
+++ b/src/modules/cdp/diameter.h
@@ -87,6 +87,8 @@
 #define to_32x_len(_len_) ((_len_) + (((_len_)&3) ? 4 - ((_len_)&3) : 0))
 
 
+#define RELAY_APP_ID 0xffffffff
+
 /* AAA TYPES */
 
 #define AAA_NO_VENDOR_ID 0
diff --git a/src/modules/cdp/routing.c b/src/modules/cdp/routing.c
index 82b6b15eda0..53a660960bb 100644
--- a/src/modules/cdp/routing.c
+++ b/src/modules/cdp/routing.c
@@ -98,7 +98,8 @@ peer *get_first_connected_route(
                                        cdp_session
                                                        ->hash); /*V1.1 - As we 
were...no call seems to pass cdp_session unlocked */
                        if(p && !p->disabled && (p->state == I_Open || p->state 
== R_Open)
-                                       && peer_handles_application(p, app_id, 
vendor_id)) {
+                                       && (peer_handles_application(p, app_id, 
vendor_id)
+                                                       || 
peer_handles_application(p, RELAY_APP_ID, 0))) {
                                p->last_selected = time(NULL);
                                LM_DBG("Found a sticky peer [%.*s] for this 
session - "
                                           "re-using\n",
@@ -121,7 +122,8 @@ peer *get_first_connected_route(
                                        (p->state == I_Open || p->state == 
R_Open) ? "opened"
                                                                                
                                           : "closed");
                if(p && !p->disabled && (p->state == I_Open || p->state == 
R_Open)
-                               && peer_handles_application(p, app_id, 
vendor_id)) {
+                               && (peer_handles_application(p, app_id, 
vendor_id)
+                                               || peer_handles_application(p, 
RELAY_APP_ID, 0))) {
                        LM_DBG("The peer %.*s matches - will forward there\n", 
i->fqdn.len,
                                        i->fqdn.s);
                        if(peer_count != 0) { //check the metric

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to