[asterisk-commits] branch bweschke/gain_functions r15020 - in
/team/bweschke/gain_functions: ./ ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Mar 26 08:29:35 MST 2006
Author: bweschke
Date: Sun Mar 26 09:29:30 2006
New Revision: 15020
URL: http://svn.digium.com/view/asterisk?rev=15020&view=rev
Log:
Merged revisions 14837,14869-14870,14886,14915,14952-14953,14988 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r14837 | tilghman | 2006-03-24 23:02:19 -0600 (Fri, 24 Mar 2006) | 10 lines
Merged revisions 14830 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r14830 | tilghman | 2006-03-24 23:01:16 -0600 (Fri, 24 Mar 2006) | 2 lines
Fix incorrect size of zeroing (left over from when maxmsg was hardcoded at 100)
........
................
r14869 | tilghman | 2006-03-24 23:10:07 -0600 (Fri, 24 Mar 2006) | 10 lines
Merged revisions 14868 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r14868 | tilghman | 2006-03-24 23:07:52 -0600 (Fri, 24 Mar 2006) | 2 lines
Bug 6601 - More configuration abilities for the RH init script
........
................
r14870 | tilghman | 2006-03-24 23:24:52 -0600 (Fri, 24 Mar 2006) | 2 lines
Bug 6670 - Additional parameters to the CHANNEL func
................
r14886 | tilghman | 2006-03-25 00:02:46 -0600 (Sat, 25 Mar 2006) | 2 lines
Bug 4377 - Round 2 of the loader updates
................
r14915 | tilghman | 2006-03-25 00:14:10 -0600 (Sat, 25 Mar 2006) | 2 lines
Bug 6508 - Redirect arbitrary channel to another extension from the dialplan
................
r14952 | kpfleming | 2006-03-25 17:22:44 -0600 (Sat, 25 Mar 2006) | 2 lines
revert loader changes that have clearly not undergone adequate testing before commit
................
r14953 | markster | 2006-03-25 17:50:09 -0600 (Sat, 25 Mar 2006) | 3 lines
Add micro-http server and abstract manager interface, make snmp not die
on reload.
................
r14988 | russell | 2006-03-26 00:59:10 -0600 (Sun, 26 Mar 2006) | 2 lines
suppress some compiler warnings on mac
................
Added:
team/bweschke/gain_functions/apps/app_managerredirect.c (props changed)
- copied unchanged from r14988, trunk/apps/app_managerredirect.c
team/bweschke/gain_functions/configs/http.conf.sample (props changed)
- copied unchanged from r14988, trunk/configs/http.conf.sample
team/bweschke/gain_functions/http.c (props changed)
- copied unchanged from r14988, trunk/http.c
team/bweschke/gain_functions/include/asterisk/http.h (props changed)
- copied unchanged from r14988, trunk/include/asterisk/http.h
Modified:
team/bweschke/gain_functions/ (props changed)
team/bweschke/gain_functions/Makefile
team/bweschke/gain_functions/apps/app_queue.c
team/bweschke/gain_functions/apps/app_voicemail.c
team/bweschke/gain_functions/asterisk.c
team/bweschke/gain_functions/channels/chan_agent.c
team/bweschke/gain_functions/channels/chan_iax2.c
team/bweschke/gain_functions/channels/chan_sip.c
team/bweschke/gain_functions/channels/chan_zap.c
team/bweschke/gain_functions/contrib/init.d/rc.redhat.asterisk
team/bweschke/gain_functions/db.c
team/bweschke/gain_functions/funcs/func_channel.c
team/bweschke/gain_functions/include/asterisk/manager.h
team/bweschke/gain_functions/loader.c
team/bweschke/gain_functions/manager.c
team/bweschke/gain_functions/res/res_features.c
team/bweschke/gain_functions/res/res_snmp.c
Propchange: team/bweschke/gain_functions/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/bweschke/gain_functions/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Mar 26 09:29:30 2006
@@ -1,1 +1,1 @@
-/trunk:1-14825
+/trunk:1-15019
Modified: team/bweschke/gain_functions/Makefile
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/Makefile?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/Makefile (original)
+++ team/bweschke/gain_functions/Makefile Sun Mar 26 09:29:30 2006
@@ -364,7 +364,7 @@
astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
- cryptostub.o sha1.o
+ cryptostub.o sha1.o http.o
# we need to link in the objects statically, not as a library, because
# otherwise modules will not have them available if none of the static
Propchange: team/bweschke/gain_functions/apps/app_managerredirect.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/bweschke/gain_functions/apps/app_managerredirect.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/bweschke/gain_functions/apps/app_managerredirect.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/bweschke/gain_functions/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/apps/app_queue.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/apps/app_queue.c (original)
+++ team/bweschke/gain_functions/apps/app_queue.c Sun Mar 26 09:29:30 2006
@@ -3357,7 +3357,7 @@
AST_LIST_UNLOCK(&queues);
}
-static int __queues_show(int manager, int fd, int argc, char **argv, int queue_show)
+static int __queues_show(struct mansession *s, int manager, int fd, int argc, char **argv, int queue_show)
{
struct ast_call_queue *q;
struct queue_ent *qe;
@@ -3381,10 +3381,17 @@
AST_LIST_LOCK(&queues);
if (AST_LIST_EMPTY(&queues)) {
AST_LIST_UNLOCK(&queues);
- if (queue_show)
- ast_cli(fd, "No such queue: %s.%s",argv[2], term);
- else
- ast_cli(fd, "No queues.%s", term);
+ if (queue_show) {
+ if (s)
+ astman_append(s, "No such queue: %s.%s",argv[2], term);
+ else
+ ast_cli(fd, "No such queue: %s.%s",argv[2], term);
+ } else {
+ if (s)
+ astman_append(s, "No queues.%s", term);
+ else
+ ast_cli(fd, "No queues.%s", term);
+ }
return RESULT_SUCCESS;
}
AST_LIST_TRAVERSE(&queues, q, list) {
@@ -3409,10 +3416,17 @@
sl = 0;
if(q->callscompleted > 0)
sl = 100*((float)q->callscompletedinsl/(float)q->callscompleted);
- ast_cli(fd, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
- q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
+ if (s)
+ astman_append(s, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
+ q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
+ else
+ ast_cli(fd, "%-12.12s has %d calls (max %s) in '%s' strategy (%ds holdtime), W:%d, C:%d, A:%d, SL:%2.1f%% within %ds%s",
+ q->name, q->count, max_buf, int2strat(q->strategy), q->holdtime, q->weight, q->callscompleted, q->callsabandoned,sl,q->servicelevel, term);
if (q->members) {
- ast_cli(fd, " Members: %s", term);
+ if (s)
+ astman_append(s, " Members: %s", term);
+ else
+ ast_cli(fd, " Members: %s", term);
for (mem = q->members; mem; mem = mem->next) {
max_buf[0] = '\0';
max = max_buf;
@@ -3429,19 +3443,37 @@
mem->calls, (long)(time(NULL) - mem->lastcall));
} else
ast_build_string(&max, &max_left, " has taken no calls yet");
- ast_cli(fd, " %s%s%s", mem->interface, max_buf, term);
- }
- } else
+ if (s)
+ astman_append(s, " %s%s%s", mem->interface, max_buf, term);
+ else
+ ast_cli(fd, " %s%s%s", mem->interface, max_buf, term);
+ }
+ } else if (s)
+ astman_append(s, " No Members%s", term);
+ else
ast_cli(fd, " No Members%s", term);
if (q->head) {
pos = 1;
- ast_cli(fd, " Callers: %s", term);
- for (qe = q->head; qe; qe = qe->next)
- ast_cli(fd, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++, qe->chan->name,
- (long)(now - qe->start) / 60, (long)(now - qe->start) % 60, qe->prio, term);
- } else
+ if (s)
+ astman_append(s, " Callers: %s", term);
+ else
+ ast_cli(fd, " Callers: %s", term);
+ for (qe = q->head; qe; qe = qe->next) {
+ if (s)
+ astman_append(s, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++, qe->chan->name,
+ (long)(now - qe->start) / 60, (long)(now - qe->start) % 60, qe->prio, term);
+ else
+ ast_cli(fd, " %d. %s (wait: %ld:%2.2ld, prio: %d)%s", pos++, qe->chan->name,
+ (long)(now - qe->start) / 60, (long)(now - qe->start) % 60, qe->prio, term);
+ }
+ } else if (s)
+ astman_append(s, " No Callers%s", term);
+ else
ast_cli(fd, " No Callers%s", term);
- ast_cli(fd, "%s", term);
+ if (s)
+ astman_append(s, "%s", term);
+ else
+ ast_cli(fd, "%s", term);
ast_mutex_unlock(&q->lock);
if (queue_show)
break;
@@ -3452,12 +3484,12 @@
static int queues_show(int fd, int argc, char **argv)
{
- return __queues_show(0, fd, argc, argv, 0);
+ return __queues_show(NULL, 0, fd, argc, argv, 0);
}
static int queue_show(int fd, int argc, char **argv)
{
- return __queues_show(0, fd, argc, argv, 1);
+ return __queues_show(NULL, 0, fd, argc, argv, 1);
}
static char *complete_queue(const char *line, const char *word, int pos, int state)
@@ -3485,8 +3517,8 @@
static int manager_queues_show( struct mansession *s, struct message *m )
{
char *a[] = { "show", "queues" };
- __queues_show(1, s->fd, 2, a, 0);
- ast_cli(s->fd, "\r\n\r\n"); /* Properly terminate Manager output */
+ __queues_show(s, 1, -1, 2, a, 0);
+ astman_append(s, "\r\n\r\n"); /* Properly terminate Manager output */
return RESULT_SUCCESS;
}
@@ -3518,7 +3550,7 @@
if (ast_strlen_zero(queuefilter) || !strcmp(q->name, queuefilter)) {
if(q->callscompleted > 0)
sl = 100*((float)q->callscompletedinsl/(float)q->callscompleted);
- ast_cli(s->fd, "Event: QueueParams\r\n"
+ astman_append(s, "Event: QueueParams\r\n"
"Queue: %s\r\n"
"Max: %d\r\n"
"Calls: %d\r\n"
@@ -3535,7 +3567,7 @@
/* List Queue Members */
for (mem = q->members; mem; mem = mem->next) {
if (ast_strlen_zero(memberfilter) || !strcmp(mem->interface, memberfilter)) {
- ast_cli(s->fd, "Event: QueueMember\r\n"
+ astman_append(s, "Event: QueueMember\r\n"
"Queue: %s\r\n"
"Location: %s\r\n"
"Membership: %s\r\n"
@@ -3553,7 +3585,7 @@
/* List Queue Entries */
pos = 1;
for (qe = q->head; qe; qe = qe->next) {
- ast_cli(s->fd, "Event: QueueEntry\r\n"
+ astman_append(s, "Event: QueueEntry\r\n"
"Queue: %s\r\n"
"Position: %d\r\n"
"Channel: %s\r\n"
@@ -3572,7 +3604,7 @@
}
AST_LIST_UNLOCK(&queues);
- ast_cli(s->fd,
+ astman_append(s,
"Event: QueueStatusComplete\r\n"
"%s"
"\r\n",idText);
Modified: team/bweschke/gain_functions/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/apps/app_voicemail.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/apps/app_voicemail.c (original)
+++ team/bweschke/gain_functions/apps/app_voicemail.c Sun Mar 26 09:29:30 2006
@@ -3882,7 +3882,7 @@
return ERROR_LOCK_PATH;
vms->curmsg = -1;
- for (x=0;x < vmu->maxmsg;x++) {
+ for (x = 0; x < vmu->maxmsg; x++) {
if (!vms->deleted[x] && (strcasecmp(vms->curbox, "INBOX") || !vms->heard[x])) {
/* Save this message. It's not in INBOX or hasn't been heard */
make_file(vms->fn, sizeof(vms->fn), vms->curdir, x);
@@ -3916,9 +3916,9 @@
done:
if (vms->deleted)
- memset(vms->deleted, 0, sizeof(vms->deleted));
+ memset(vms->deleted, 0, vmu->maxmsg * sizeof(int));
if (vms->heard)
- memset(vms->heard, 0, sizeof(vms->heard));
+ memset(vms->heard, 0, vmu->maxmsg * sizeof(int));
return 0;
}
Modified: team/bweschke/gain_functions/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/asterisk.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/asterisk.c (original)
+++ team/bweschke/gain_functions/asterisk.c Sun Mar 26 09:29:30 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -107,6 +107,7 @@
#include "asterisk/pbx.h"
#include "asterisk/enum.h"
#include "asterisk/rtp.h"
+#include "asterisk/http.h"
#if defined(T38_SUPPORT)
#include "asterisk/udptl.h"
#endif
@@ -882,11 +883,11 @@
if (ast_socket > -1) {
close(ast_socket);
ast_socket = -1;
+ unlink(ast_config_AST_SOCKET);
+ pthread_cancel(lthread);
}
if (ast_consock > -1)
close(ast_consock);
- if (ast_socket > -1)
- unlink(ast_config_AST_SOCKET);
if (!ast_opt_remote)
unlink(ast_config_AST_PID);
printf(term_quit());
@@ -1847,7 +1848,8 @@
return 0;
}
-static void ast_readconfig(void) {
+static void ast_readconfig(void)
+{
struct ast_config *cfg;
struct ast_variable *v;
char *config = AST_CONFIG_FILE;
@@ -2321,6 +2323,7 @@
printf(term_quit());
exit(1);
}
+ ast_http_init();
ast_channels_init();
if (init_manager()) {
printf(term_quit());
Modified: team/bweschke/gain_functions/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/channels/chan_agent.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/channels/chan_agent.c (original)
+++ team/bweschke/gain_functions/channels/chan_agent.c Sun Mar 26 09:29:30 2006
@@ -1411,7 +1411,7 @@
status = "AGENT_LOGGEDOFF";
}
- ast_cli(s->fd, "Event: Agents\r\n"
+ astman_append(s, "Event: Agents\r\n"
"Agent: %s\r\n"
"Name: %s\r\n"
"Status: %s\r\n"
@@ -1424,7 +1424,7 @@
ast_mutex_unlock(&p->lock);
}
AST_LIST_UNLOCK(&agents);
- ast_cli(s->fd, "Event: AgentsComplete\r\n"
+ astman_append(s, "Event: AgentsComplete\r\n"
"%s"
"\r\n",idText);
return 0;
Modified: team/bweschke/gain_functions/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/channels/chan_iax2.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/channels/chan_iax2.c (original)
+++ team/bweschke/gain_functions/channels/chan_iax2.c Sun Mar 26 09:29:30 2006
@@ -673,7 +673,7 @@
static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in *sin);
static void destroy_peer(struct iax2_peer *peer);
-static int ast_cli_netstats(int fd, int limit_fmt);
+static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt);
#define IAX_IOSTATE_IDLE 0
#define IAX_IOSTATE_READY 1
@@ -4324,7 +4324,7 @@
#undef FORMAT2
}
-static int __iax2_show_peers(int manager, int fd, int argc, char *argv[])
+static int __iax2_show_peers(int manager, int fd, struct mansession *s, int argc, char *argv[])
{
regex_t regexbuf;
int havepattern = 0;
@@ -4376,7 +4376,10 @@
}
ast_mutex_lock(&peerl.lock);
- ast_cli(fd, FORMAT2, "Name/Username", "Host", " ", "Mask", "Port", " ", "Status", term);
+ if (s)
+ astman_append(s, FORMAT2, "Name/Username", "Host", " ", "Mask", "Port", " ", "Status", term);
+ else
+ ast_cli(fd, FORMAT2, "Name/Username", "Host", " ", "Mask", "Port", " ", "Status", term);
for (peer = peerl.peers;peer;peer = peer->next) {
char nm[20];
char status[20];
@@ -4410,7 +4413,15 @@
ntohs(peer->addr.sin_port), ast_test_flag(peer, IAX_TRUNK) ? "(T)" : " ",
peer->encmethods ? "(E)" : " ", status, term);
- ast_cli(fd, FORMAT, name,
+ if (s)
+ astman_append(s, FORMAT, name,
+ peer->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), peer->addr.sin_addr) : "(Unspecified)",
+ ast_test_flag(peer, IAX_DYNAMIC) ? "(D)" : "(S)",
+ nm,
+ ntohs(peer->addr.sin_port), ast_test_flag(peer, IAX_TRUNK) ? "(T)" : " ",
+ peer->encmethods ? "(E)" : " ", status, term);
+ else
+ ast_cli(fd, FORMAT, name,
peer->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), peer->addr.sin_addr) : "(Unspecified)",
ast_test_flag(peer, IAX_DYNAMIC) ? "(D)" : "(S)",
nm,
@@ -4420,7 +4431,10 @@
}
ast_mutex_unlock(&peerl.lock);
- ast_cli(fd,"%d iax2 peers [%d online, %d offline, %d unmonitored]%s", total_peers, online_peers, offline_peers, unmonitored_peers, term);
+ if (s)
+ astman_append(s,"%d iax2 peers [%d online, %d offline, %d unmonitored]%s", total_peers, online_peers, offline_peers, unmonitored_peers, term);
+ else
+ ast_cli(fd,"%d iax2 peers [%d online, %d offline, %d unmonitored]%s", total_peers, online_peers, offline_peers, unmonitored_peers, term);
if (havepattern)
regfree(®exbuf);
@@ -4473,12 +4487,12 @@
static int iax2_show_peers(int fd, int argc, char *argv[])
{
- return __iax2_show_peers(0, fd, argc, argv);
+ return __iax2_show_peers(0, fd, NULL, argc, argv);
}
static int manager_iax2_show_netstats( struct mansession *s, struct message *m )
{
- ast_cli_netstats(s->fd, 0);
- ast_cli(s->fd, "\r\n");
+ ast_cli_netstats(s, -1, 0);
+ astman_append(s, "\r\n");
return RESULT_SUCCESS;
}
@@ -4515,9 +4529,9 @@
char *id;
id = astman_get_header(m,"ActionID");
if (!ast_strlen_zero(id))
- ast_cli(s->fd, "ActionID: %s\r\n",id);
- ret = __iax2_show_peers(1, s->fd, 3, a );
- ast_cli(s->fd, "\r\n\r\n" );
+ astman_append(s, "ActionID: %s\r\n",id);
+ ret = __iax2_show_peers(1, -1, s, 3, a );
+ astman_append(s, "\r\n\r\n" );
return ret;
} /* /JDG */
@@ -4651,7 +4665,7 @@
#undef FORMATB
}
-static int ast_cli_netstats(int fd, int limit_fmt)
+static int ast_cli_netstats(struct mansession *s, int fd, int limit_fmt)
{
int x;
int numchans = 0;
@@ -4660,13 +4674,21 @@
if (iaxs[x]) {
#ifdef BRIDGE_OPTIMIZATION
if (iaxs[x]->bridgecallno) {
- if (limit_fmt)
- ast_cli(fd, "%-25.25s <NATIVE BRIDGED>",
- iaxs[x]->owner ? iaxs[x]->owner->name : "(None)");
- else
- ast_cli(fd, "%s <NATIVE BRIDGED>",
- iaxs[x]->owner ? iaxs[x]->owner->name : "(None)");
- } else
+ if (limit_fmt) {
+ if (s)
+ astman_append(s, "%-25.25s <NATIVE BRIDGED>",
+ iaxs[x]->owner ? iaxs[x]->owner->name : "(None)");
+ else
+ ast_cli(fd, "%-25.25s <NATIVE BRIDGED>",
+ iaxs[x]->owner ? iaxs[x]->owner->name : "(None)");
+ } else {
+ if (s)
+ astman_append(s, "%s <NATIVE BRIDGED>",
+ iaxs[x]->owner ? iaxs[x]->owner->name : "(None)");
+ else
+ ast_cli(fd, "%s <NATIVE BRIDGED>",
+ iaxs[x]->owner ? iaxs[x]->owner->name : "(None)");
+ } else
#endif
{
int localjitter, localdelay, locallost, locallosspct, localdropped, localooo;
@@ -4705,7 +4727,27 @@
fmt = "%-25.25s %4d %4d %4d %5d %3d %5d %4d %6d %4d %4d %5d %3d %5d %4d %6d\n";
else
fmt = "%s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n";
- ast_cli(fd, fmt,
+ if (s)
+
+ astman_append(s, fmt,
+ iaxs[x]->owner ? iaxs[x]->owner->name : "(None)",
+ iaxs[x]->pingtime,
+ localjitter,
+ localdelay,
+ locallost,
+ locallosspct,
+ localdropped,
+ localooo,
+ iaxs[x]->frames_received/1000,
+ iaxs[x]->remote_rr.jitter,
+ iaxs[x]->remote_rr.delay,
+ iaxs[x]->remote_rr.losscnt,
+ iaxs[x]->remote_rr.losspct,
+ iaxs[x]->remote_rr.dropped,
+ iaxs[x]->remote_rr.ooo,
+ iaxs[x]->remote_rr.packets/1000);
+ else
+ ast_cli(fd, fmt,
iaxs[x]->owner ? iaxs[x]->owner->name : "(None)",
iaxs[x]->pingtime,
localjitter,
@@ -4738,7 +4780,7 @@
return RESULT_SHOWUSAGE;
ast_cli(fd, " -------- LOCAL --------------------- -------- REMOTE --------------------\n");
ast_cli(fd, "Channel RTT Jit Del Lost %% Drop OOO Kpkts Jit Del Lost %% Drop OOO Kpkts\n");
- numchans = ast_cli_netstats(fd, 1);
+ numchans = ast_cli_netstats(NULL, fd, 1);
ast_cli(fd, "%d active IAX channel%s\n", numchans, (numchans != 1) ? "s" : "");
return RESULT_SUCCESS;
}
Modified: team/bweschke/gain_functions/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/channels/chan_sip.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/channels/chan_sip.c (original)
+++ team/bweschke/gain_functions/channels/chan_sip.c Sun Mar 26 09:29:30 2006
@@ -7600,9 +7600,9 @@
astman_send_ack(s, m, "Peer status list will follow");
/* List the peers in separate manager events */
- _sip_show_peers(s->fd, &total, s, m, 3, a);
+ _sip_show_peers(-1, &total, s, m, 3, a);
/* Send final confirmation */
- ast_cli(s->fd,
+ astman_append(s,
"Event: PeerlistComplete\r\n"
"ListItems: %d\r\n"
"%s"
@@ -7712,7 +7712,7 @@
realtimepeers ? (ast_test_flag(iterator, SIP_REALTIME) ? "Cached RT":"") : "");
} else { /* Manager format */
/* The names here need to be the same as other channels */
- ast_cli(fd,
+ astman_append(s,
"Event: PeerEntry\r\n%s"
"Channeltype: SIP\r\n"
"ObjectName: %s\r\n"
@@ -8031,9 +8031,9 @@
a[3] = peer;
if (!ast_strlen_zero(id))
- ast_cli(s->fd, "ActionID: %s\r\n",id);
- ret = _sip_show_peer(1, s->fd, s, m, 4, a );
- ast_cli( s->fd, "\r\n\r\n" );
+ astman_append(s, "ActionID: %s\r\n",id);
+ ret = _sip_show_peer(1, -1, s, m, 4, a );
+ astman_append(s, "\r\n\r\n" );
return ret;
}
@@ -8067,7 +8067,7 @@
peer = find_peer(argv[3], NULL, load_realtime);
if (s) { /* Manager */
if (peer)
- ast_cli(s->fd, "Response: Success\r\n");
+ astman_append(s, "Response: Success\r\n");
else {
snprintf (cbuf, sizeof(cbuf), "Peer %s not found.\n", argv[3]);
astman_send_error(s, m, cbuf);
@@ -8161,73 +8161,73 @@
} else if (peer && type == 1) { /* manager listing */
char *actionid = astman_get_header(m,"ActionID");
- ast_cli(fd, "Channeltype: SIP\r\n");
+ astman_append(s, "Channeltype: SIP\r\n");
if (actionid)
- ast_cli(fd, "ActionID: %s\r\n", actionid);
- ast_cli(fd, "ObjectName: %s\r\n", peer->name);
- ast_cli(fd, "ChanObjectType: peer\r\n");
- ast_cli(fd, "SecretExist: %s\r\n", ast_strlen_zero(peer->secret)?"N":"Y");
- ast_cli(fd, "MD5SecretExist: %s\r\n", ast_strlen_zero(peer->md5secret)?"N":"Y");
- ast_cli(fd, "Context: %s\r\n", peer->context);
- ast_cli(fd, "Language: %s\r\n", peer->language);
+ astman_append(s, "ActionID: %s\r\n", actionid);
+ astman_append(s, "ObjectName: %s\r\n", peer->name);
+ astman_append(s, "ChanObjectType: peer\r\n");
+ astman_append(s, "SecretExist: %s\r\n", ast_strlen_zero(peer->secret)?"N":"Y");
+ astman_append(s, "MD5SecretExist: %s\r\n", ast_strlen_zero(peer->md5secret)?"N":"Y");
+ astman_append(s, "Context: %s\r\n", peer->context);
+ astman_append(s, "Language: %s\r\n", peer->language);
if (!ast_strlen_zero(peer->accountcode))
- ast_cli(fd, "Accountcode: %s\r\n", peer->accountcode);
- ast_cli(fd, "AMAflags: %s\r\n", ast_cdr_flags2str(peer->amaflags));
- ast_cli(fd, "CID-CallingPres: %s\r\n", ast_describe_caller_presentation(peer->callingpres));
+ astman_append(s, "Accountcode: %s\r\n", peer->accountcode);
+ astman_append(s, "AMAflags: %s\r\n", ast_cdr_flags2str(peer->amaflags));
+ astman_append(s, "CID-CallingPres: %s\r\n", ast_describe_caller_presentation(peer->callingpres));
if (!ast_strlen_zero(peer->fromuser))
- ast_cli(fd, "SIP-FromUser: %s\r\n", peer->fromuser);
+ astman_append(s, "SIP-FromUser: %s\r\n", peer->fromuser);
if (!ast_strlen_zero(peer->fromdomain))
- ast_cli(fd, "SIP-FromDomain: %s\r\n", peer->fromdomain);
- ast_cli(fd, "Callgroup: ");
+ astman_append(s, "SIP-FromDomain: %s\r\n", peer->fromdomain);
+ astman_append(s, "Callgroup: ");
print_group(fd, peer->callgroup, 1);
- ast_cli(fd, "Pickupgroup: ");
+ astman_append(s, "Pickupgroup: ");
print_group(fd, peer->pickupgroup, 1);
- ast_cli(fd, "VoiceMailbox: %s\r\n", peer->mailbox);
- ast_cli(fd, "LastMsgsSent: %d\r\n", peer->lastmsgssent);
- ast_cli(fd, "Call limit: %d\r\n", peer->call_limit);
- ast_cli(fd, "Dynamic: %s\r\n", (ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC)?"Y":"N"));
- ast_cli(fd, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, ""));
- ast_cli(fd, "RegExpire: %ld seconds\r\n", ast_sched_when(sched,peer->expire));
- ast_cli(fd, "SIP-AuthInsecure: %s\r\n", insecure2str(ast_test_flag(peer, SIP_INSECURE_PORT), ast_test_flag(peer, SIP_INSECURE_INVITE)));
- ast_cli(fd, "SIP-NatSupport: %s\r\n", nat2str(ast_test_flag(peer, SIP_NAT)));
- ast_cli(fd, "ACL: %s\r\n", (peer->ha?"Y":"N"));
- ast_cli(fd, "SIP-CanReinvite: %s\r\n", (ast_test_flag(peer, SIP_CAN_REINVITE)?"Y":"N"));
- ast_cli(fd, "SIP-PromiscRedir: %s\r\n", (ast_test_flag(peer, SIP_PROMISCREDIR)?"Y":"N"));
- ast_cli(fd, "SIP-UserPhone: %s\r\n", (ast_test_flag(peer, SIP_USEREQPHONE)?"Y":"N"));
+ astman_append(s, "VoiceMailbox: %s\r\n", peer->mailbox);
+ astman_append(s, "LastMsgsSent: %d\r\n", peer->lastmsgssent);
+ astman_append(s, "Call limit: %d\r\n", peer->call_limit);
+ astman_append(s, "Dynamic: %s\r\n", (ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC)?"Y":"N"));
+ astman_append(s, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, ""));
+ astman_append(s, "RegExpire: %ld seconds\r\n", ast_sched_when(sched,peer->expire));
+ astman_append(s, "SIP-AuthInsecure: %s\r\n", insecure2str(ast_test_flag(peer, SIP_INSECURE_PORT), ast_test_flag(peer, SIP_INSECURE_INVITE)));
+ astman_append(s, "SIP-NatSupport: %s\r\n", nat2str(ast_test_flag(peer, SIP_NAT)));
+ astman_append(s, "ACL: %s\r\n", (peer->ha?"Y":"N"));
+ astman_append(s, "SIP-CanReinvite: %s\r\n", (ast_test_flag(peer, SIP_CAN_REINVITE)?"Y":"N"));
+ astman_append(s, "SIP-PromiscRedir: %s\r\n", (ast_test_flag(peer, SIP_PROMISCREDIR)?"Y":"N"));
+ astman_append(s, "SIP-UserPhone: %s\r\n", (ast_test_flag(peer, SIP_USEREQPHONE)?"Y":"N"));
/* - is enumerated */
- ast_cli(fd, "SIP-DTMFmode %s\r\n", dtmfmode2str(ast_test_flag(peer, SIP_DTMF)));
- ast_cli(fd, "SIPLastMsg: %d\r\n", peer->lastmsg);
- ast_cli(fd, "ToHost: %s\r\n", peer->tohost);
- ast_cli(fd, "Address-IP: %s\r\nAddress-Port: %d\r\n", peer->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), peer->addr.sin_addr) : "", ntohs(peer->addr.sin_port));
- ast_cli(fd, "Default-addr-IP: %s\r\nDefault-addr-port: %d\r\n", ast_inet_ntoa(iabuf, sizeof(iabuf), peer->defaddr.sin_addr), ntohs(peer->defaddr.sin_port));
- ast_cli(fd, "Default-Username: %s\r\n", peer->username);
+ astman_append(s, "SIP-DTMFmode %s\r\n", dtmfmode2str(ast_test_flag(peer, SIP_DTMF)));
+ astman_append(s, "SIPLastMsg: %d\r\n", peer->lastmsg);
+ astman_append(s, "ToHost: %s\r\n", peer->tohost);
+ astman_append(s, "Address-IP: %s\r\nAddress-Port: %d\r\n", peer->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), peer->addr.sin_addr) : "", ntohs(peer->addr.sin_port));
+ astman_append(s, "Default-addr-IP: %s\r\nDefault-addr-port: %d\r\n", ast_inet_ntoa(iabuf, sizeof(iabuf), peer->defaddr.sin_addr), ntohs(peer->defaddr.sin_port));
+ astman_append(s, "Default-Username: %s\r\n", peer->username);
if (!ast_strlen_zero(global_regcontext))
- ast_cli(fd, "RegExtension: %s\r\n", peer->regexten);
- ast_cli(fd, "Codecs: ");
+ astman_append(s, "RegExtension: %s\r\n", peer->regexten);
+ astman_append(s, "Codecs: ");
ast_getformatname_multiple(codec_buf, sizeof(codec_buf) -1, peer->capability);
- ast_cli(fd, "%s\r\n", codec_buf);
- ast_cli(fd, "CodecOrder: ");
+ astman_append(s, "%s\r\n", codec_buf);
+ astman_append(s, "CodecOrder: ");
pref = &peer->prefs;
for(x = 0; x < 32 ; x++) {
codec = ast_codec_pref_index(pref,x);
if (!codec)
break;
- ast_cli(fd, "%s", ast_getformatname(codec));
+ astman_append(s, "%s", ast_getformatname(codec));
if (x < 31 && ast_codec_pref_index(pref,x+1))
- ast_cli(fd, ",");
- }
-
- ast_cli(fd, "\r\n");
- ast_cli(fd, "Status: ");
+ astman_append(s, ",");
+ }
+
+ astman_append(s, "\r\n");
+ astman_append(s, "Status: ");
peer_status(peer, status, sizeof(status));
- ast_cli(fd, "%s\r\n", status);
- ast_cli(fd, "SIP-Useragent: %s\r\n", peer->useragent);
- ast_cli(fd, "Reg-Contact : %s\r\n", peer->fullcontact);
+ astman_append(s, "%s\r\n", status);
+ astman_append(s, "SIP-Useragent: %s\r\n", peer->useragent);
+ astman_append(s, "Reg-Contact : %s\r\n", peer->fullcontact);
if (peer->chanvars) {
for (v = peer->chanvars ; v ; v = v->next) {
- ast_cli(fd, "ChanVariable:\n");
- ast_cli(fd, " %s,%s\r\n", v->name, v->value);
+ astman_append(s, "ChanVariable:\n");
+ astman_append(s, " %s,%s\r\n", v->name, v->value);
}
}
Modified: team/bweschke/gain_functions/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/channels/chan_zap.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/channels/chan_zap.c (original)
+++ team/bweschke/gain_functions/channels/chan_zap.c Sun Mar 26 09:29:30 2006
@@ -10272,7 +10272,7 @@
while (tmp) {
if (tmp->channel > 0) {
int alarm = get_alarms(tmp);
- ast_cli(s->fd,
+ astman_append(s,
"Event: ZapShowChannels\r\n"
"Channel: %d\r\n"
"Signalling: %s\r\n"
@@ -10291,7 +10291,7 @@
ast_mutex_unlock(&iflock);
- ast_cli(s->fd,
+ astman_append(s,
"Event: ZapShowChannelsComplete\r\n"
"%s"
"\r\n",
Propchange: team/bweschke/gain_functions/configs/http.conf.sample
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/bweschke/gain_functions/configs/http.conf.sample
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/bweschke/gain_functions/configs/http.conf.sample
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/bweschke/gain_functions/contrib/init.d/rc.redhat.asterisk
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/contrib/init.d/rc.redhat.asterisk?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/contrib/init.d/rc.redhat.asterisk (original)
+++ team/bweschke/gain_functions/contrib/init.d/rc.redhat.asterisk Sun Mar 26 09:29:30 2006
@@ -20,15 +20,29 @@
# - Added support for -U and -G command line options
# - Modified "reload" to call asterisk -rx 'reload'
+# Use this option to specify a different configuration directory
+#AST_CONFIG=/etc/asterisk
+
+# Installation directory
+AST_SBIN=/usr/sbin
+
+# Uncomment the following and set them to the user/groups that you
+# want to run Asterisk as. NOTE: this requires substantial work to
+# be sure that Asterisk's environment has permission to write the
+# files required for its operation, including logs, its comm
+# socket, the asterisk database, etc.
+#AST_USER="asterisk"
+#AST_GROUP="asterisk"
+
# Source function library.
. /etc/rc.d/init.d/functions
-if ! [ -x /usr/sbin/asterisk ] ; then
+if ! [ -x $AST_SBIN/asterisk ] ; then
echo "ERROR: /usr/sbin/asterisk not found"
exit 0
fi
-if ! [ -d /etc/asterisk ] ; then
+if ! [ -d $AST_CONFIG ] ; then
echo "ERROR: /etc/asterisk directory not found"
exit 0
fi
@@ -37,18 +51,19 @@
# export LD_ASSUME_KERNEL=2.4.1
# Full path to asterisk binary
-DAEMON=/usr/sbin/asterisk
+DAEMON=$AST_SBIN/asterisk
# Full path to safe_asterisk script
-SAFE_ASTERISK=/usr/sbin/safe_asterisk
+SAFE_ASTERISK=$AST_SBIN/safe_asterisk
-# Uncomment the following and set them to the user/groups that you
-# want to run Asterisk as. NOTE: this requires substantial work to
-# be sure that Asterisk's environment has permission to write the
-# files required for its operation, including logs, its comm
-# socket, the asterisk database, etc.
-#AST_USER="asterisk"
-#AST_GROUP="asterisk"
+# Allow configuration overrides in /etc/sysconfig/asterisk
+CONFIG0=`readlink $0`
+if [ $CONFIG0 = "" ]; then
+ CONFIGFILE=/etc/sysconfig/`basename $0`
+else
+ CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
+fi
+[ -x $CONFIGFILE ] && . $CONFIGFILE
RETVAL=0
@@ -62,7 +77,10 @@
ASTARGS="-U $AST_USER"
fi
if [ $AST_GROUP ] ; then
- ASTARGS="`echo $ASTARGS` -G $AST_GROUP"
+ ASTARGS="$ASTARGS -G $AST_GROUP"
+ fi
+ if [ $AST_CONFIG ]; then
+ ASTARGS="$ASTARGS -C $AST_CONFIG"
fi
daemon $DAEMON $ASTARGS
RETVAL=$?
Modified: team/bweschke/gain_functions/db.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/db.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/db.c (original)
+++ team/bweschke/gain_functions/db.c Sun Mar 26 09:29:30 2006
@@ -568,7 +568,7 @@
astman_send_error(s, m, "Database entry not found");
} else {
astman_send_ack(s, m, "Result will follow");
- ast_cli(s->fd, "Event: DBGetResponse\r\n"
+ astman_append(s, "Event: DBGetResponse\r\n"
"Family: %s\r\n"
"Key: %s\r\n"
"Val: %s\r\n"
Modified: team/bweschke/gain_functions/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/funcs/func_channel.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/funcs/func_channel.c (original)
+++ team/bweschke/gain_functions/funcs/func_channel.c Sun Mar 26 09:29:30 2006
@@ -74,7 +74,14 @@
locked_copy_string(chan, buf, chan->language, len);
else if (!strcasecmp(data, "musicclass"))
locked_copy_string(chan, buf, chan->musicclass, len);
- else if (!chan->tech->func_channel_read
+ else if (!strcasecmp(data, "state"))
+ locked_copy_string(chan, buf, ast_state2str(chan->_state), len);
+ else if (!strcasecmp(data, "channeltype"))
+ locked_copy_string(chan, buf, chan->tech->type, len);
+ else if (!strcasecmp(data, "callgroup")) {
+ char groupbuf[256];
+ locked_copy_string(chan, buf, ast_print_group(groupbuf, sizeof(groupbuf), chan->callgroup), len);
+ } else if (!chan->tech->func_channel_read
|| chan->tech->func_channel_read(chan, function, data, buf, len)) {
ast_log(LOG_WARNING, "Unknown or unavailable item requested: '%s'\n", data);
ret = -1;
@@ -93,6 +100,8 @@
locked_string_field_set(chan, language, value);
else if (!strcasecmp(data, "musicclass"))
locked_string_field_set(chan, musicclass, value);
+ else if (!strcasecmp(data, "callgroup"))
+ chan->callgroup = ast_get_group(data);
else if (!strcasecmp(data, "txgain")) {
sscanf(value, "%hhd", &gainset);
ast_channel_setoption(chan, AST_OPTION_TXGAIN, &gainset, sizeof(gainset), 0);
@@ -118,9 +127,12 @@
"R/O audioreadformat format currently being read\n"
"R/O audionativeformat format used natively for audio\n"
"R/O audiowriteformat format currently being written\n"
+ "R/W callgroup call groups for call pickup\n"
+ "R/O channeltype technology used for channel\n"
"R/W language language for sounds played\n"
"R/W musicclass class (from musiconhold.conf) for hold music\n"
"R/W rxgain set rxgain level on channel techs that support it\n"
+ "R/O state state for channel\n"
"R/O tonezone zone for indications played\n"
"R/W txgain set txgain level on channel techs that support it\n"
"R/O videonativeformat format used natively for video\n"
Propchange: team/bweschke/gain_functions/http.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/bweschke/gain_functions/http.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/bweschke/gain_functions/http.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: team/bweschke/gain_functions/include/asterisk/http.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/bweschke/gain_functions/include/asterisk/http.h
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/bweschke/gain_functions/include/asterisk/http.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/bweschke/gain_functions/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/include/asterisk/manager.h?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/include/asterisk/manager.h (original)
+++ team/bweschke/gain_functions/include/asterisk/manager.h Sun Mar 26 09:29:30 2006
@@ -64,40 +64,7 @@
char eventdata[1];
};
-struct mansession {
- /*! Execution thread */
- pthread_t t;
- /*! Thread lock -- don't use in action callbacks, it's already taken care of */
- ast_mutex_t __lock;
- /*! socket address */
- struct sockaddr_in sin;
- /*! TCP socket */
- int fd;
- /*! Whether or not we're busy doing an action */
- int busy;
- /*! Whether or not we're "dead" */
- int dead;
- /*! Logged in username */
- char username[80];
- /*! Authentication challenge */
- char challenge[10];
- /*! Authentication status */
- int authenticated;
- /*! Authorization for reading */
- int readperm;
- /*! Authorization for writing */
- int writeperm;
- /*! Buffer */
- char inbuf[AST_MAX_MANHEADER_LEN];
- int inlen;
- int send_events;
- /* Queued events that we've not had the ability to send yet */
- struct eventqent *eventq;
- /* Timeout for ast_carefulwrite() */
- int writetimeout;
- struct mansession *next;
-};
-
+struct mansession;
struct message {
int hdrcount;
@@ -164,6 +131,10 @@
extern void astman_send_response(struct mansession *s, struct message *m, char *resp, char *msg);
extern void astman_send_ack(struct mansession *s, struct message *m, char *msg);
+extern void astman_append(struct mansession *s, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+
+
/*! Called by Asterisk initialization */
extern int init_manager(void);
/*! Called by Asterisk initialization */
Modified: team/bweschke/gain_functions/loader.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/gain_functions/loader.c?rev=15020&r1=15019&r2=15020&view=diff
==============================================================================
--- team/bweschke/gain_functions/loader.c (original)
+++ team/bweschke/gain_functions/loader.c Sun Mar 26 09:29:30 2006
@@ -43,6 +43,7 @@
#include "asterisk/cdr.h"
#include "asterisk/enum.h"
#include "asterisk/rtp.h"
+#include "asterisk/http.h"
#include "asterisk/lock.h"
#ifdef DLFCNCOMPAT
#include "asterisk/dlfcn-compat.h"
@@ -115,6 +116,7 @@
{ "enum", ast_enum_reload },
{ "manager", reload_manager },
{ "rtp", ast_rtp_reload },
+ { "http", ast_http_reload },
{ NULL, NULL }
};
Modified: team/bweschke/gain_functions/manager.c
[... 288 lines stripped ...]
More information about the asterisk-commits
mailing list