--- ../clean/asterisk-1.8.3/channels/chan_h323.c 2010-10-14 17:15:12.000000000 +0200 +++ ./channels/chan_h323.c 2011-03-02 07:56:13.000000000 +0200 @@ -134,6 +134,7 @@ /** H.323 configuration values */ static int h323_signalling_port = 1720; static char gatekeeper[100]; +static char gatewayid[100]; static int gatekeeper_disable = 1; static int gatekeeper_discover = 0; static int gkroute = 0; @@ -971,6 +972,7 @@ return -1; } } + our_addr.ss.ss_family=AF_INET; pvt->rtp = ast_rtp_instance_new("asterisk", sched, &our_addr, NULL); if (!pvt->rtp) { ast_mutex_unlock(&pvt->lock); @@ -1785,7 +1787,7 @@ host = tmp; } strtok_r(host, "/", &(h323id)); - if (!ast_strlen_zero(h323id)) { + if (!ast_strlen_zero(h323id) && gatekeeper_disable) { h323_set_id(h323id); } if (ext) { @@ -2735,7 +2737,7 @@ /* Possibly register with a GK */ if (!gatekeeper_disable) { - if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) { + if (h323_set_gk(gatekeeper_discover, gatekeeper, secret, gatewayid)) { ast_log(LOG_ERROR, "Gatekeeper registration failed.\n"); } } @@ -3029,6 +3031,8 @@ userbyalias = ast_true(v->value); } else if (!strcasecmp(v->name, "AcceptAnonymous")) { acceptAnonymous = ast_true(v->value); + } else if (!strcasecmp(v->name, "gatewayid")) { + ast_copy_string(gatewayid, v->value, sizeof(gatewayid)); } else if (!update_common_options(v, &global_options)) { /* dummy */ } @@ -3089,7 +3093,7 @@ ASTOBJ_CONTAINER_WRLOCK(&aliasl); ASTOBJ_CONTAINER_TRAVERSE(&aliasl, 1, do { ASTOBJ_RDLOCK(iterator); - if (h323_set_alias(iterator)) { + if (h323_set_alias(iterator, gatewayid)) { ast_log(LOG_ERROR, "Alias %s rejected by endpoint\n", alias->name); ASTOBJ_UNLOCK(iterator); continue; @@ -3110,7 +3114,7 @@ if(!gk_disable) h323_gk_urq(); if (!gatekeeper_disable) { - if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) { + if (h323_set_gk(gatekeeper_discover, gatekeeper, secret, gatewayid)) { ast_log(LOG_ERROR, "Gatekeeper registration failed.\n"); gatekeeper_disable = 1; } @@ -3347,7 +3351,7 @@ } /* Possibly register with a GK */ if (!gatekeeper_disable) { - if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) { + if (h323_set_gk(gatekeeper_discover, gatekeeper, secret, gatewayid)) { ast_log(LOG_ERROR, "Gatekeeper registration failed.\n"); gatekeeper_disable = 1; res = AST_MODULE_LOAD_SUCCESS;