Merge "pbx_dundi: Added IPv6 support for dundi"
authorJenkins2 <jenkins2@gerrit.asterisk.org>
Mon, 27 Aug 2018 14:38:15 +0000 (09:38 -0500)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Mon, 27 Aug 2018 14:38:15 +0000 (09:38 -0500)
1  2 
pbx/dundi-parser.c
pbx/pbx_dundi.c

Simple merge
diff --cc pbx/pbx_dundi.c
@@@ -1318,12 -1321,10 +1321,12 @@@ static int do_register_expire(const voi
  {
        struct dundi_peer *peer = (struct dundi_peer *)data;
        char eid_str[20];
 +
        ast_debug(1, "Register expired for '%s'\n", ast_eid_to_str(eid_str, sizeof(eid_str), &peer->eid));
 +      ast_db_del("dundi/dpeers", dundi_eid_to_str_short(eid_str, sizeof(eid_str), &peer->eid));
        peer->registerexpire = -1;
        peer->lastms = 0;
-       memset(&peer->addr, 0, sizeof(peer->addr));
+       ast_sockaddr_setnull(&peer->addr);
        return 0;
  }
  
@@@ -4944,14 -4987,31 +5007,34 @@@ static int set_config(char *config_file
                }
                v = v->next;
        }
+       if (port == 0) {
+               port = DUNDI_PORT;
+       }
+       if (ast_sockaddr_isnull(sin)) {
+               sprintf(bind_addr, "0.0.0.0:%d", port);
+               ast_sockaddr_parse(sin, bind_addr, 0);
+       } else {
+               ast_sockaddr_set_port(sin, port);
+       }
+       if (last_port == 0) {
+               last_port = port;
+       } else if (last_port != port) {
+               ast_log(LOG_WARNING, "change to port ignored until next asterisk re-start\n");
+       }
+       set_host_ipaddr(sin);
        AST_LIST_UNLOCK(&peers);
 +
        mark_mappings();
        v = ast_variable_browse(cfg, "mappings");
 -      while(v) {
 +      while (v) {
 +              AST_LIST_LOCK(&peers);
                build_mapping(v->name, v->value);
 +              AST_LIST_UNLOCK(&peers);
                v = v->next;
        }
        prune_mappings();