static char gatekeeper[100];
static int gatekeeper_disable = 1;
static int gatekeeper_discover = 0;
-static int manual = 0;
static int usingGk;
static int port = 1720;
static int jitter;
free(user);
return NULL;
}
+ /* Let us know we need to use ip authentication */
+ user->host = 1;
} else if (!strcasecmp(v->name, "amaflags")) {
format = ast_cdr_amaflags2int(v->value);
if (format < 0) {
if (strlen(i->callerid))
tmp->callerid = strdup(i->callerid);
if (state != AST_STATE_DOWN) {
- printf ("oh323_new EXTEN: %s\n", tmp->exten);
- printf ("oh323_new CONTEXT: %s\n", tmp->context);
if (ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
ast_hangup(tmp);
int setup_incoming_call(call_details_t cd)
{
-
- ast_log(LOG_DEBUG, "default_context [%s]\n", default_context);
struct oh323_pvt *p = NULL;
struct ast_channel *c = NULL;
strncpy(p->context, default_context, sizeof(p->context)-1);
ast_log(LOG_DEBUG, "Sending %s to context [%s]\n", cd.call_source_aliases, p->context);
} else {
+ if (user->host) {
+ if (strcasecmp(cd.sourceIp, inet_ntoa(user->addr.sin_addr))){
+ ast_log(LOG_ERROR, "Call from user '%s' rejected due to non-matching IP address of '%s'\n", user->name, cd.sourceIp);
+ return 0;
+ }
+ }
if (user->incominglimit > 0) {
if (user->inUse >= user->incominglimit) {
ast_log(LOG_ERROR, "Call from user '%s' rejected due to usage limit of %d\n", user->name, user->incominglimit);
}
}
- printf ("CONTEXT: [%s]\n", p->context);
- printf ("EXTEN: [%s]\n", p->exten);
/* allocate a channel and tell asterisk about it */
c = oh323_new(p, AST_STATE_RINGING, cd.call_token);
h323_gk_urq();
/* Possibly register with a GK */
- if (!gatekeeper_disable) {
+ if (gatekeeper_disable == 0) {
if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) {
ast_log(LOG_ERROR, "Gatekeeper registration failed.\n");
h323_end_process();
} else if (!strcasecmp(v->name, "context")) {
strncpy(default_context, v->value, sizeof(default_context)-1);
printf(" == Setting default context to %s\n", default_context);
- } else if (!strcasecmp(v->name, "manual")) {
- manual = ast_true(v->value);
} else if (!strcasecmp(v->name, "dtmfmode")) {
if (!strcasecmp(v->value, "inband"))
dtmfmode=H323_DTMF_INBAND;
reload_config();
/* Possibly register with a GK */
- if (!gatekeeper_disable) {
+ if (gatekeeper_disable == 0) {
if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) {
ast_log(LOG_ERROR, "Gatekeeper registration failed.\n");
h323_end_process();
}
/* Possibly register with a GK */
- if (!gatekeeper_disable) {
+ if (gatekeeper_disable == 0) {
if (h323_set_gk(gatekeeper_discover, gatekeeper, secret)) {
ast_log(LOG_ERROR, "Gatekeeper registration failed.\n");
h323_end_process();