[sr-dev] git:master:41ab78ed: core: added domain and auto_domains as variants for alias and auto_aliases

Daniel-Constantin Mierla miconda at gmail.com
Fri Jun 17 09:53:48 CEST 2022


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-06-17T09:53:01+02:00

core: added domain and auto_domains as variants for alias and auto_aliases

---

Modified: src/core/cfg.lex
Modified: src/core/cfg.y

---

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

---

diff --git a/src/core/cfg.lex b/src/core/cfg.lex
index 8e7b3d60cb..a5a595f98c 100644
--- a/src/core/cfg.lex
+++ b/src/core/cfg.lex
@@ -308,7 +308,9 @@ ADVERTISE	advertise|ADVERTISE
 VIRTUAL		virtual
 STRNAME		name|NAME
 ALIAS		alias
+DOMAIN		domain
 SR_AUTO_ALIASES	auto_aliases
+SR_AUTO_DOMAINS auto_domains
 DNS		 dns
 REV_DNS	 rev_dns
 DNS_TRY_IPV6	dns_try_ipv6
@@ -750,8 +752,11 @@ IMPORTFILE      "import_file"
 <INITIAL>{VIRTUAL}	{ count(); yylval.strval=yytext; return VIRTUAL; }
 <INITIAL>{STRNAME}	{ count(); yylval.strval=yytext; return STRNAME; }
 <INITIAL>{ALIAS}	{ count(); yylval.strval=yytext; return ALIAS; }
+<INITIAL>{DOMAIN}	{ count(); yylval.strval=yytext; return DOMAIN; }
 <INITIAL>{SR_AUTO_ALIASES}	{ count(); yylval.strval=yytext;
 									return SR_AUTO_ALIASES; }
+<INITIAL>{SR_AUTO_DOMAINS}	{ count(); yylval.strval=yytext;
+									return SR_AUTO_DOMAINS; }
 <INITIAL>{DNS}	{ count(); yylval.strval=yytext; return DNS; }
 <INITIAL>{REV_DNS}	{ count(); yylval.strval=yytext; return REV_DNS; }
 <INITIAL>{DNS_TRY_IPV6}	{ count(); yylval.strval=yytext;
diff --git a/src/core/cfg.y b/src/core/cfg.y
index acf5e8c490..dd93f5f98b 100644
--- a/src/core/cfg.y
+++ b/src/core/cfg.y
@@ -333,6 +333,8 @@ extern char *default_routename;
 %token STRNAME
 %token ALIAS
 %token SR_AUTO_ALIASES
+%token DOMAIN
+%token SR_AUTO_DOMAINS
 %token DNS
 %token REV_DNS
 %token DNS_TRY_IPV6
@@ -1737,8 +1739,22 @@ assign_stm:
 		free_socket_id_lst($3);
 	}
 	| ALIAS  EQUAL error  { yyerror("hostname expected"); }
+	| DOMAIN EQUAL  id_lst {
+		for(lst_tmp=$3; lst_tmp; lst_tmp=lst_tmp->next){
+			add_alias(	lst_tmp->addr_lst->name,
+						strlen(lst_tmp->addr_lst->name),
+						lst_tmp->port, lst_tmp->proto);
+			for (nl_tmp=lst_tmp->addr_lst->next; nl_tmp; nl_tmp=nl_tmp->next)
+				add_alias(nl_tmp->name, strlen(nl_tmp->name),
+							lst_tmp->port, lst_tmp->proto);
+		}
+		free_socket_id_lst($3);
+	}
+	| DOMAIN  EQUAL error  { yyerror("hostname expected"); }
 	| SR_AUTO_ALIASES EQUAL NUMBER { sr_auto_aliases=$3; }
 	| SR_AUTO_ALIASES EQUAL error  { yyerror("boolean value expected"); }
+	| SR_AUTO_DOMAINS EQUAL NUMBER { sr_auto_aliases=$3; }
+	| SR_AUTO_DOMAINS EQUAL error  { yyerror("boolean value expected"); }
 	| ADVERTISED_ADDRESS EQUAL listen_id {
 		if ($3){
 			default_global_address.s=$3;




More information about the sr-dev mailing list