[sr-dev] git:master:e7275114: uac: allow empty contact addr in rpc add command for uacreg

Daniel-Constantin Mierla miconda at gmail.com
Wed Sep 9 13:30:29 CEST 2020


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-09-09T13:20:44+02:00

uac: allow empty contact addr in rpc add command for uacreg

- it has to be set to .
- contact_addr parameter moved to be last, to be easier to just add to
existing commands

---

Modified: src/modules/uac/uac_reg.c

---

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

---

diff --git a/src/modules/uac/uac_reg.c b/src/modules/uac/uac_reg.c
index c636cc6cfa..379a544a7e 100644
--- a/src/modules/uac/uac_reg.c
+++ b/src/modules/uac/uac_reg.c
@@ -526,7 +526,7 @@ int reg_ht_add(reg_uac_t *reg)
 		return -1;
 	}
 
-	if (!reg->contact_addr.s || reg->contact_addr.len == 0) 
+	if (!reg->contact_addr.s || reg->contact_addr.len == 0)
 	{
 		reg->contact_addr=reg_contact_addr;
 	}
@@ -553,7 +553,7 @@ int reg_ht_add(reg_uac_t *reg)
 	memset(nr, 0, sizeof(reg_uac_t) + len);
 	nr->expires = reg->expires;
 	nr->flags   = reg->flags;
-	if (reg->reg_delay) 
+	if (reg->reg_delay)
 		nr->reg_delay = reg->reg_delay;
 	else if (reg_random_delay>0)
 		nr->reg_delay = kam_rand() % reg_random_delay;
@@ -594,9 +594,9 @@ int reg_ht_add(reg_uac_t *reg)
 }
 
 
- /**
-  *
-  */
+/**
+ *
+ */
 int reg_ht_rm(reg_uac_t *reg)
 {
 	unsigned int slot1, slot2;
@@ -2136,8 +2136,8 @@ static void rpc_uac_reg_add(rpc_t* rpc, void* ctx)
 				&reg.expires,
 				&reg.flags,
 				&reg.reg_delay,
-				&reg.contact_addr,
-				&reg.socket
+				&reg.socket,
+				&reg.contact_addr
 			)<1)
 	{
 		rpc->fault(ctx, 400, "Invalid Parameters");
@@ -2154,6 +2154,10 @@ static void rpc_uac_reg_add(rpc_t* rpc, void* ctx)
 		reg.auth_ha1.len = 0;
 	}
 
+	if(reg.contact_addr.len==1 && reg.contact_addr.s[0] == '.') {
+		reg.contact_addr = reg_contact_addr;
+	}
+
 	if(uac_reg_check_password(&reg) < 0) {
 		rpc->fault(ctx, 500, "Failed to add record - invalid password or ha1");
 		return;




More information about the sr-dev mailing list