aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapps/app_queue.c2
-rwxr-xr-xchannels/chan_zap.c6
-rwxr-xr-xmanager.c20
-rwxr-xr-xres/res_features.c4
4 files changed, 28 insertions, 4 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 07b5eaa95..a2f2ae53c 100755
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2047,6 +2047,7 @@ static int manager_queues_status( struct mansession *s, struct message *m )
/* List queue properties */
if(q->callscompleted > 0)
sl = 100*((float)q->callscompletedinsl/(float)q->callscompleted);
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd, "Event: QueueParams\r\n"
"Queue: %s\r\n"
"Max: %d\r\n"
@@ -2088,6 +2089,7 @@ static int manager_queues_status( struct mansession *s, struct message *m )
"%s"
"\r\n",
q->name, pos++, qe->chan->name, (qe->chan->callerid ? qe->chan->callerid : ""), (long)(now - qe->start), idText);
+ ast_mutex_unlock(&s->lock);
ast_mutex_unlock(&q->lock);
}
ast_mutex_unlock(&qlock);
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index d6749540c..e17af276a 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -8511,7 +8511,7 @@ static int action_zapshowchannels(struct mansession *s, struct message *m)
while (tmp) {
if (tmp->channel > 0) {
int alarm = get_alarms(tmp);
-
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd,
"Event: ZapShowChannels\r\n"
"Channel: %d\r\n"
@@ -8522,6 +8522,7 @@ static int action_zapshowchannels(struct mansession *s, struct message *m)
"\r\n",
tmp->channel, sig2str(tmp->sig), tmp->context,
alarm2str(alarm), idText);
+ ast_mutex_unlock(&s->lock);
}
tmp = tmp->next;
@@ -8529,12 +8530,13 @@ static int action_zapshowchannels(struct mansession *s, struct message *m)
ast_mutex_unlock(&iflock);
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd,
"Event: ZapShowChannelsComplete\r\n"
"%s"
"\r\n",
idText);
-
+ ast_mutex_unlock(&s->lock);
return 0;
}
diff --git a/manager.c b/manager.c
index 0ce2bc0d7..168a2e26f 100755
--- a/manager.c
+++ b/manager.c
@@ -492,6 +492,7 @@ static int action_listcommands(struct mansession *s, struct message *m)
if (id && !ast_strlen_zero(id))
snprintf(idText,256,"ActionID: %s\r\n",id);
ast_cli(s->fd, "Response: Success\r\n%s", idText);
+ ast_mutex_lock(&s->lock);
ast_mutex_lock(&actionlock);
while (cur) { /* Walk the list of actions */
if ((s->writeperm & cur->authority) == cur->authority)
@@ -500,6 +501,7 @@ static int action_listcommands(struct mansession *s, struct message *m)
}
ast_mutex_unlock(&actionlock);
ast_cli(s->fd, "\r\n");
+ ast_mutex_unlock(&s->lock);
return 0;
}
@@ -636,11 +638,13 @@ static int action_getvar(struct mansession *s, struct message *m)
varval=pbx_builtin_getvar_helper(c,varname);
ast_mutex_unlock(&c->lock);
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd, "Response: Success\r\n"
"%s: %s\r\n" ,varname,varval);
if (id && !ast_strlen_zero(id))
ast_cli(s->fd, "ActionID: %s\r\n",id);
ast_cli(s->fd, "\r\n");
+ ast_mutex_unlock(&s->lock);
return 0;
}
@@ -679,6 +683,7 @@ static int action_status(struct mansession *s, struct message *m)
snprintf(bridge, sizeof(bridge), "Link: %s\r\n", c->bridge->name);
else
bridge[0] = '\0';
+ ast_mutex_lock(&s->lock);
if (c->pbx) {
if (c->cdr) {
elapsed_seconds = now.tv_sec - c->cdr->start.tv_sec;
@@ -716,16 +721,19 @@ static int action_status(struct mansession *s, struct message *m)
c->accountcode,
ast_state2str(c->_state), bridge, c->uniqueid, idText);
}
+ ast_mutex_unlock(&s->lock);
ast_mutex_unlock(&c->lock);
if (name && !ast_strlen_zero(name)) {
break;
}
c = ast_channel_walk_locked(c);
}
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd,
"Event: StatusComplete\r\n"
"%s"
"\r\n",idText);
+ ast_mutex_unlock(&s->lock);
return 0;
}
@@ -921,17 +929,21 @@ static int action_mailboxstatus(struct mansession *s, struct message *m)
char *mailbox = astman_get_header(m, "Mailbox");
char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
+ int ret;
if (!mailbox || ast_strlen_zero(mailbox)) {
astman_send_error(s, m, "Mailbox not specified");
return 0;
}
if (id && !ast_strlen_zero(id))
snprintf(idText,256,"ActionID: %s\r\n",id);
+ ret = ast_app_has_voicemail(mailbox);
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd, "Response: Success\r\n"
"%s"
"Message: Mailbox Status\r\n"
"Mailbox: %s\r\n"
- "Waiting: %d\r\n\r\n", idText, mailbox, ast_app_has_voicemail(mailbox));
+ "Waiting: %d\r\n\r\n", idText, mailbox, ret);
+ ast_mutex_unlock(&s->lock);
return 0;
}
@@ -949,6 +961,7 @@ static int action_mailboxcount(struct mansession *s, struct message *m)
if (id && !ast_strlen_zero(id)) {
snprintf(idText,256,"ActionID: %s\r\n",id);
}
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd, "Response: Success\r\n"
"%s"
"Message: Mailbox Message Count\r\n"
@@ -957,6 +970,7 @@ static int action_mailboxcount(struct mansession *s, struct message *m)
"OldMessages: %d\r\n"
"\r\n",
idText,mailbox, newmsgs, oldmsgs);
+ ast_mutex_unlock(&s->lock);
return 0;
}
@@ -979,6 +993,7 @@ static int action_extensionstate(struct mansession *s, struct message *m)
if (id && !ast_strlen_zero(id)) {
snprintf(idText,256,"ActionID: %s\r\n",id);
}
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd, "Response: Success\r\n"
"%s"
"Message: Extension Status\r\n"
@@ -987,6 +1002,7 @@ static int action_extensionstate(struct mansession *s, struct message *m)
"Hint: %s\r\n"
"Status: %d\r\n\r\n",
idText,exten, context, hint, status);
+ ast_mutex_unlock(&s->lock);
return 0;
}
@@ -1049,10 +1065,12 @@ static int process_message(struct mansession *s, struct message *m)
snprintf(s->challenge, sizeof(s->challenge), "%d", rand());
ast_mutex_unlock(&s->lock);
}
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd, "Response: Success\r\n"
"%s"
"Challenge: %s\r\n\r\n",
idText,s->challenge);
+ ast_mutex_unlock(&s->lock);
return 0;
} else {
astman_send_error(s, m, "Must specify AuthType");
diff --git a/res/res_features.c b/res/res_features.c
index 2697f1fcd..e9cb7e7c3 100755
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -797,6 +797,7 @@ static int manager_parking_status( struct mansession *s, struct message *m )
cur=parkinglot;
while(cur) {
+ ast_mutex_lock(&s->lock);
ast_cli(s->fd, "Event: ParkedCall\r\n"
"Exten: %d\r\n"
"Channel: %s\r\n"
@@ -808,8 +809,9 @@ static int manager_parking_status( struct mansession *s, struct message *m )
,(long)cur->start.tv_sec + (long)(cur->parkingtime/1000) - (long)time(NULL)
,(cur->chan->callerid ? cur->chan->callerid : "")
,idText);
+ ast_mutex_unlock(&s->lock);
- cur = cur->next;
+ cur = cur->next;
}
ast_cli(s->fd,