### Description
When setting `listen` with `advertise` in the configuration file the advertise section cannot contain an address that has the string `dns` within it. If at any point the domain used in advertise contains the three letters consecutively without being broken by a hypen or a dot it causes the parser to fail, see logging below.
I tried quoting the string but it didn't seam to parse properly. It interpenetrated the full thing as the listen address portion.
### Troubleshooting
#### Reproduction
Add any advertise address to the config file with the string dns. e.g. ``` listen=tcp:127.0.0.1:5060 advertise sip.dns.example.com:5060 ```
Also using it in the `advertised_address` section without quotes causes the error. ``` advertised_address=sip.dns.example.com:5060 ```
#### Log Messages
`````` 0(98) CRITICAL: <core> [core/cfg.y:3507]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 62, column 43-45: syntax error 0(98) CRITICAL: <core> [core/cfg.y:3507]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 62, column 43-45: invalid host or interface name 0(98) CRITICAL: <core> [core/cfg.y:3507]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 62, column 43-45: ip address, interface name or hostname expected 0(98) CRITICAL: <core> [core/cfg.y:3507]: yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 62, column 47-54: ERROR: bad config file (4 errors) ```
### Possible Solutions
A solution could be to use the a `advertised_address` though the cookbook states that this could be deprecated in future and that the `listen` config parameter is preferred.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 5.2.1 (x86_64/linux) flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: unknown compiled with gcc 6.3.0 ```
* **Operating System**:
Running in Debian container image. ``` PRETTY_NAME="Debian GNU/Linux 9 (stretch)" NAME="Debian GNU/Linux" VERSION_ID="9" VERSION="9 (stretch)" ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" Linux 1498e1ef835d 4.20.6-arch1-1-ARCH #1 SMP PREEMPT Thu Jan 31 08:22:01 UTC 2019 x86_64 GNU/Linux ```
Looks like it happens for any of the keywords in the config file. I managed to replicate it with the following keywords: ``` fork user route ```
It also only happens if the full word is not appended or prepended with anything. e.g. ``` listen=tcp:127.0.0.1:5060 advertise sip.fork.example.com:5060 listen=tcp:127.0.0.1:5060 advertise sip-fork.example.com:5060 listen=tcp:127.0.0.1:5060 advertise sip-route-test.example.com:5060 ``` The following work: ``` listen=tcp:127.0.0.1:5060 advertise sip.forka.example.com:5060 listen=tcp:127.0.0.1:5060 advertise sip-forks.example.com:5060 listen=tcp:127.0.0.1:5060 advertise sip-fo-rk.example.com:5060 ```
Try with the hostname in between quotes, like:
``` listen=tcp:127.0.0.1:5060 advertise "sip.dns.example.com":5060 ```
If it doesn't work, reopen.
Closed #1854.
Thanks, this resolved the issue. May I suggest the documentation be updated to reflect this as its non intuitive behaviour to quote only the hostname and not the port.
Done: https://www.kamailio.org/wiki/cookbooks/devel/core