aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-05 22:16:33 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-05 22:16:33 +0000
commita6d4c512c85a5c5a908521066fe4a7ba772e4aec (patch)
treeccaced165563a62abe8a3613e25cb0f1abc7295c /channels/chan_zap.c
parent5d863dcd8db84fab3df37c0f32fb459fd1b94948 (diff)
reduce stack consumption for AMI and AMI/HTTP requests by nearly 20K in most cases
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@49676 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-rw-r--r--channels/chan_zap.c97
1 files changed, 51 insertions, 46 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index fd82dc36d..fab61b857 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -9743,7 +9743,7 @@ static int zap_restart_cmd(int fd, int argc, char **argv)
return RESULT_SUCCESS;
}
-static int action_zaprestart(struct mansession *s, struct message *m)
+static int action_zaprestart(struct mansession *s, const struct message *m)
{
if (zap_restart() != 0) {
astman_send_error(s, m, "Failed rereading zaptel configuration");
@@ -10116,46 +10116,49 @@ static struct zt_pvt *find_channel(int channel)
return p;
}
-static int action_zapdndon(struct mansession *s, struct message *m)
-{
- struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
- if (ast_strlen_zero(channel)) {
- astman_send_error(s, m, "No channel specified");
- return 0;
- }
- p = find_channel(atoi(channel));
- if (!p) {
- astman_send_error(s, m, "No such channel");
- return 0;
- }
- p->dnd = 1;
- astman_send_ack(s, m, "DND Enabled");
- return 0;
-}
-
-static int action_zapdndoff(struct mansession *s, struct message *m)
-{
- struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
- if (ast_strlen_zero(channel)) {
- astman_send_error(s, m, "No channel specified");
- return 0;
- }
- p = find_channel(atoi(channel));
- if (!p) {
- astman_send_error(s, m, "No such channel");
- return 0;
- }
- p->dnd = 0;
- astman_send_ack(s, m, "DND Disabled");
- return 0;
-}
-
-static int action_transfer(struct mansession *s, struct message *m)
+static int action_zapdndon(struct mansession *s, const struct message *m)
{
struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
+ const char *channel = astman_get_header(m, "ZapChannel");
+
+ if (ast_strlen_zero(channel)) {
+ astman_send_error(s, m, "No channel specified");
+ return 0;
+ }
+ p = find_channel(atoi(channel));
+ if (!p) {
+ astman_send_error(s, m, "No such channel");
+ return 0;
+ }
+ p->dnd = 1;
+ astman_send_ack(s, m, "DND Enabled");
+ return 0;
+}
+
+static int action_zapdndoff(struct mansession *s, const struct message *m)
+{
+ struct zt_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "ZapChannel");
+
+ if (ast_strlen_zero(channel)) {
+ astman_send_error(s, m, "No channel specified");
+ return 0;
+ }
+ p = find_channel(atoi(channel));
+ if (!p) {
+ astman_send_error(s, m, "No such channel");
+ return 0;
+ }
+ p->dnd = 0;
+ astman_send_ack(s, m, "DND Disabled");
+ return 0;
+}
+
+static int action_transfer(struct mansession *s, const struct message *m)
+{
+ struct zt_pvt *p = NULL;
+ const char *channel = astman_get_header(m, "ZapChannel");
+
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
return 0;
@@ -10170,10 +10173,11 @@ static int action_transfer(struct mansession *s, struct message *m)
return 0;
}
-static int action_transferhangup(struct mansession *s, struct message *m)
+static int action_transferhangup(struct mansession *s, const struct message *m)
{
struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
+ const char *channel = astman_get_header(m, "ZapChannel");
+
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
return 0;
@@ -10188,12 +10192,13 @@ static int action_transferhangup(struct mansession *s, struct message *m)
return 0;
}
-static int action_zapdialoffhook(struct mansession *s, struct message *m)
+static int action_zapdialoffhook(struct mansession *s, const struct message *m)
{
struct zt_pvt *p = NULL;
- char *channel = astman_get_header(m, "ZapChannel");
- char *number = astman_get_header(m, "Number");
+ const char *channel = astman_get_header(m, "ZapChannel");
+ const char *number = astman_get_header(m, "Number");
int i;
+
if (ast_strlen_zero(channel)) {
astman_send_error(s, m, "No channel specified");
return 0;
@@ -10219,10 +10224,10 @@ static int action_zapdialoffhook(struct mansession *s, struct message *m)
return 0;
}
-static int action_zapshowchannels(struct mansession *s, struct message *m)
+static int action_zapshowchannels(struct mansession *s, const struct message *m)
{
struct zt_pvt *tmp = NULL;
- char *id = astman_get_header(m, "ActionID");
+ const char *id = astman_get_header(m, "ActionID");
char idText[256] = "";
astman_send_ack(s, m, "Zapata channel status will follow");