From c587025a3cc4cd01e72025c9513c47460ffff9c8 Mon Sep 17 00:00:00 2001 From: MelwareDE Date: Wed, 27 Jul 2005 18:17:41 +0000 Subject: [PATCH] Allow using interface name in Dial(). --- README | 4 ++++ chan_capi.c | 24 ++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/README b/README index 9766b55..dfdd8b9 100644 --- a/README +++ b/README @@ -68,6 +68,7 @@ The Dial string Example: Dial(CAPI/g/[/]) Or: Dial(CAPI/contr/[/]) + Or: Dial(CAPI//[/]) 'group' can be a value, comma separated list of values or a range using '-'. The according interface is found by searching a match with @@ -81,6 +82,9 @@ The Dial string (This is useful, when further digits shall be send to complete the destination address). + If the is used in dialstring, be sure the name (specified + in capi.conf) does not start with 'contr' or 'g'. + CLIP/CLIR uses the calling presentation of the calling channel, which can be modified using the SetCallerPres() application. Use SetCallerPres(prohib_not_screened) for CLIR. That is why the msn= param in diff --git a/chan_capi.c b/chan_capi.c index e262eb9..b3a8a09 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -1399,19 +1399,17 @@ struct ast_channel *capi_request(char *type, int format, void *data) return NULL; } - if (((char *)interface)[0] == 'g') { - interface++; - capigroup = ast_get_group(interface); + if (interface[0] == 'g') { + capigroup = ast_get_group(interface + 1); cc_ast_verbose(1, 1, VERBOSE_PREFIX_3 "capi request group = %d\n", capigroup); } else if (!strncmp(interface, "contr", 5)) { - interface += 5; - controller = atoi(interface); + controller = atoi(interface + 5); cc_ast_verbose(1, 1, VERBOSE_PREFIX_3 "capi request controller = %d\n", controller); } else { - ast_log(LOG_ERROR,"Syntax error in dialstring. Read the docs!\n"); - return NULL; + cc_ast_verbose(1, 1, VERBOSE_PREFIX_3 "capi request for interface '%s'\n", + interface); } ast_mutex_lock(&iflock); @@ -1433,7 +1431,13 @@ struct ast_channel *capi_request(char *type, int format, void *data) foundcontroller = controller; } else { /* DIAL(CAPI/gX/...) */ - if (!(i->group & capigroup)) { + if ((interface[0] == 'g') && (!(i->group & capigroup))) { + /* keep on running! */ + ast_mutex_unlock(&contrlock); + continue; + } + /* DIAL(CAPI//...) */ + if ((interface[0] != 'g') && (strcmp(interface, i->name))) { /* keep on running! */ ast_mutex_unlock(&contrlock); continue; @@ -1466,8 +1470,8 @@ struct ast_channel *capi_request(char *type, int format, void *data) return tmp; } ast_mutex_unlock(&iflock); - ast_log(LOG_NOTICE, "didn't find capi device with controller = %d or group = %d.\n", - controller, capigroup); + ast_log(LOG_NOTICE, "didn't find capi device for interface '%s'\n", + interface); return NULL; }