Allow using interface name in Dial().

V0_6
MelwareDE 2005-07-27 18:17:41 +00:00
parent 13a3bfba4b
commit c587025a3c
2 changed files with 18 additions and 10 deletions

4
README
View File

@ -68,6 +68,7 @@ The Dial string
Example: Dial(CAPI/g<group>/<destination>[/<params>])
Or: Dial(CAPI/contr<controller>/<destination>[/<params>])
Or: Dial(CAPI/<interface-name>/<destination>[/<params>])
'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 <interface-name> 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

View File

@ -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/<interface-name>/...) */
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;
}