aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-06 19:10:24 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-06 19:10:24 +0000
commitb8b4ef0a9b0e87105eb0220cecfc205c23898fd5 (patch)
tree5e942c7b351edf9ee9b5da67ec7b4d41fbcfa5d9 /pbx.c
parent249face569822d37bb4d950272923c28f365842d (diff)
PBX updates from andre
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@760 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/pbx.c b/pbx.c
index ac1b00cc4..8d848eedb 100755
--- a/pbx.c
+++ b/pbx.c
@@ -1145,23 +1145,23 @@ static int ast_extension_state2(struct ast_exten *e)
res = ast_device_state(cur);
switch (res) {
- case AST_DEVICE_NOT_INUSE:
+ case AST_DEVICE_NOT_INUSE:
allunavailable = 0;
allbusy = 0;
break;
- case AST_DEVICE_INUSE:
+ case AST_DEVICE_INUSE:
return AST_EXTENSION_INUSE;
- case AST_DEVICE_BUSY:
+ case AST_DEVICE_BUSY:
allunavailable = 0;
allfree = 0;
busy = 1;
break;
- case AST_DEVICE_UNAVAILABLE:
- case AST_DEVICE_INVALID:
+ case AST_DEVICE_UNAVAILABLE:
+ case AST_DEVICE_INVALID:
allbusy = 0;
allfree = 0;
break;
- default:
+ default:
allunavailable = 0;
allbusy = 0;
allfree = 0;
@@ -1170,14 +1170,14 @@ static int ast_extension_state2(struct ast_exten *e)
} while (cur);
if (allfree)
- return AST_EXTENSION_NOT_INUSE;
+ return AST_EXTENSION_NOT_INUSE;
if (allbusy)
- return AST_EXTENSION_BUSY;
+ return AST_EXTENSION_BUSY;
if (allunavailable)
- return AST_EXTENSION_UNAVAILABLE;
+ return AST_EXTENSION_UNAVAILABLE;
if (busy)
- return AST_EXTENSION_INUSE;
-
+ return AST_EXTENSION_INUSE;
+
return AST_EXTENSION_NOT_INUSE;
}
@@ -1207,6 +1207,11 @@ int ast_device_state_changed(const char *fmt, ...)
va_start(ap, fmt);
vsnprintf(device, sizeof(device)-1, fmt, ap);
va_end(ap);
+
+ rest = strchr(device, '-');
+ if (rest) {
+ *rest = 0;
+ }
pthread_mutex_lock(&hintlock);
@@ -1223,7 +1228,7 @@ int ast_device_state_changed(const char *fmt, ...)
rest++;
}
- if (!strncmp(cur, device, strlen(cur))) {
+ if (!strcmp(cur, device)) {
// Found extension execute callbacks
state = ast_extension_state2(list->exten);
if ((state != -1) && (state != list->laststate)) {
@@ -3770,6 +3775,9 @@ int ast_pbx_outgoing_app(char *type, int format, void *data, int timeout, char *
static void destroy_exten(struct ast_exten *e)
{
+ if (e->priority == PRIORITY_HINT)
+ ast_remove_hint(e);
+
if (e->datad)
e->datad(e->data);
free(e);
@@ -3812,11 +3820,6 @@ void ast_context_destroy(struct ast_context *con, char *registrar)
free(swl);
swl = sw;
}
- for (e = tmp->root; e; ) {
- if (e->priority == PRIORITY_HINT)
- ast_remove_hint(e);
- e = e->next;
- }
for (e = tmp->root; e;) {
for (en = e->peer; en;) {
el = en;