mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-27 14:41:58 +00:00
The chan_skinny Dial() syntax was funky. You had to do Dial(Skinny/line@device)
This allows you to just Dial(Skinny/line), as long as line isn't ambiguous. Note that this does not remove or deprecate the "old" syntax, as it's still quite useful - even moreso if shared lines get implemented. Initial patch by me, with some changes and suggestions from wedhorn. (closes issue #10263) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76785 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1267,37 +1267,49 @@ static struct skinny_line *find_line_by_instance(struct skinny_device *d, int in
|
|||||||
static struct skinny_line *find_line_by_name(const char *dest)
|
static struct skinny_line *find_line_by_name(const char *dest)
|
||||||
{
|
{
|
||||||
struct skinny_line *l;
|
struct skinny_line *l;
|
||||||
|
struct skinny_line *tmpl = NULL;
|
||||||
struct skinny_device *d;
|
struct skinny_device *d;
|
||||||
char line[256];
|
char line[256];
|
||||||
char *at;
|
char *at;
|
||||||
char *device;
|
char *device;
|
||||||
|
int checkdevice = 0;
|
||||||
|
|
||||||
ast_copy_string(line, dest, sizeof(line));
|
ast_copy_string(line, dest, sizeof(line));
|
||||||
at = strchr(line, '@');
|
at = strchr(line, '@');
|
||||||
if (!at) {
|
if (at)
|
||||||
ast_log(LOG_NOTICE, "Device '%s' has no @ (at) sign!\n", dest);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*at++ = '\0';
|
*at++ = '\0';
|
||||||
device = at;
|
device = at;
|
||||||
|
|
||||||
|
if (!ast_strlen_zero(device))
|
||||||
|
checkdevice = 1;
|
||||||
|
|
||||||
ast_mutex_lock(&devicelock);
|
ast_mutex_lock(&devicelock);
|
||||||
for (d = devices; d; d = d->next) {
|
for (d = devices; d; d = d->next) {
|
||||||
if (!strcasecmp(d->name, device)) {
|
if (checkdevice && tmpl)
|
||||||
|
break;
|
||||||
|
else if (!checkdevice) {
|
||||||
|
/* This is a match, since we're checking for line on every device. */
|
||||||
|
} else if (!strcasecmp(d->name, device)) {
|
||||||
if (skinnydebug)
|
if (skinnydebug)
|
||||||
ast_verbose("Found device: %s\n", d->name);
|
ast_verbose(VERBOSE_PREFIX_2 "Found device: %s\n", d->name);
|
||||||
/* Found the device */
|
} else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Found the device (or we don't care which device) */
|
||||||
for (l = d->lines; l; l = l->next) {
|
for (l = d->lines; l; l = l->next) {
|
||||||
/* Search for the right line */
|
/* Search for the right line */
|
||||||
if (!strcasecmp(l->name, line)) {
|
if (!strcasecmp(l->name, line)) {
|
||||||
ast_mutex_unlock(&devicelock);
|
if (tmpl) {
|
||||||
return l;
|
ast_verbose(VERBOSE_PREFIX_2 "Ambiguous line name: %s\n", line);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Device not found */
|
|
||||||
ast_mutex_unlock(&devicelock);
|
ast_mutex_unlock(&devicelock);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
} else
|
||||||
|
tmpl = l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ast_mutex_unlock(&devicelock);
|
||||||
|
return tmpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It's quicker/easier to find the subchannel when we know the instance number too */
|
/* It's quicker/easier to find the subchannel when we know the instance number too */
|
||||||
|
|||||||
Reference in New Issue
Block a user