[asterisk-commits] branch crichter/0.4.0 r29392 - in
/team/crichter/0.4.0/channels: ./ misdn/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon May 22 03:39:56 MST 2006
Author: crichter
Date: Mon May 22 05:39:55 2006
New Revision: 29392
URL: http://svn.digium.com/view/asterisk?rev=29392&view=rev
Log:
added call counter options and l1 poll timer. also added cli command misdn show stats to show the call counters per port
Modified:
team/crichter/0.4.0/channels/Makefile
team/crichter/0.4.0/channels/chan_misdn.c
team/crichter/0.4.0/channels/misdn/chan_misdn_config.h
team/crichter/0.4.0/channels/misdn_config.c
Modified: team/crichter/0.4.0/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/Makefile?rev=29392&r1=29391&r2=29392&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/Makefile (original)
+++ team/crichter/0.4.0/channels/Makefile Mon May 22 05:39:55 2006
@@ -118,7 +118,7 @@
SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
endif
CFLAGS+=-DIAX_TRUNKING
- CHANNEL_LIBS+=chan_zap.so
+# CHANNEL_LIBS+=chan_zap.so
endif
endif # WITHOUT_ZAPTEL
@@ -200,11 +200,11 @@
chan_iax2.so: chan_iax2.o iax2-parser.o iax2-provision.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_iax2.o iax2-parser.o iax2-provision.o ${CYGSOLIB}
-chan_zap.o: chan_zap.c
- $(CC) -c $(CFLAGS) -o chan_zap.o chan_zap.c
-
-chan_zap.so: chan_zap.o
- $(CC) $(SOLINK) -o $@ $< $(ZAPPRI) $(ZAPR2) -ltonezone
+#chan_zap.o: chan_zap.c
+# $(CC) -c $(CFLAGS) -o chan_zap.o chan_zap.c
+
+#chan_zap.so: chan_zap.o
+# $(CC) $(SOLINK) -o $@ $< $(ZAPPRI) $(ZAPR2) -ltonezone
chan_sip.so: chan_sip.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_sip.o ${CYGSOLIB}
Modified: team/crichter/0.4.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/chan_misdn.c?rev=29392&r1=29391&r2=29392&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/chan_misdn.c (original)
+++ team/crichter/0.4.0/channels/chan_misdn.c Mon May 22 05:39:55 2006
@@ -282,6 +282,10 @@
static int *misdn_debug;
static int *misdn_debug_only;
static int max_ports;
+
+static int *misdn_in_calls;
+static int *misdn_out_calls;
+
struct chan_list dummy_cl;
@@ -647,6 +651,39 @@
misdn_debug[i] = cfg_debug;
misdn_debug_only[i] = 0;
}
+
+#ifdef M_TIMER
+ if (misdn_sched)
+ sched_context_destroy(misdn_sched);
+
+ misdn_sched=sched_context_create();
+
+ if (!misdn_sched) {
+ ast_log(LOG_ERROR,"Couldn't create scheduler\n");
+ return -1;
+ }
+
+ /* Loop through all ports and find out which one should be
+ * watched regarding the l1 */
+ int port;
+ int dotimer=0;
+ for ( port=misdn_cfg_get_next_port(0);
+ port;
+ port=misdn_cfg_get_next_port(port)) {
+ int l1timer;
+ misdn_cfg_get( port, MISDN_CFG_L1_TIMER, &l1timer, sizeof(l1timer));
+ if (l1timer>0) {
+ ast_sched_add(misdn_sched, l1timer*1000, l1_timer_cb, &port);
+ dotimer=1;
+; }
+ }
+
+ if (dotimer) {
+ /*start timer thread*/
+ pthread_create( &misdn_timer, NULL, (void*)misdn_timerd, NULL);
+ }
+#endif
+
}
static int misdn_reload (int fd, int argc, char *argv[])
@@ -780,6 +817,24 @@
}
+
+static int misdn_show_stats (int fd, int argc, char *argv[])
+{
+ int port;
+
+ ast_cli(fd, "Port\t|in_calls\tout_calls\n");
+
+ for (port=misdn_cfg_get_next_port(0); port > 0;
+ port=misdn_cfg_get_next_port(port)) {
+ ast_cli(fd,"%d\t%d\t%d\n",port,misdn_in_calls[port],misdn_out_calls[port]);
+ }
+ ast_cli(fd,"\n");
+
+ return 0;
+
+}
+
+
static int misdn_show_port (int fd, int argc, char *argv[])
{
int port;
@@ -1077,6 +1132,14 @@
"Usage: misdn show stacks\n"
};
+static struct ast_cli_entry cli_show_stats =
+{ {"misdn","show","stats", NULL},
+ misdn_show_stats,
+ "Shows chan_misdns call statistics",
+ "Usage: misdn show stats\n"
+};
+
+
static struct ast_cli_entry cli_show_port =
{ {"misdn","show","port", NULL},
misdn_show_port,
@@ -1519,6 +1582,7 @@
port=newbc->port;
strncpy(newbc->dad,ext,sizeof( newbc->dad));
strncpy(ast->exten,ext,sizeof(ast->exten));
+ misdn_out_calls[port]++;
chan_misdn_log(1, port, "* CALL: %s\n",dest);
@@ -2737,6 +2801,13 @@
} else {
if (!bc->nojitter)
chan_misdn_log(5,bc->port,"Jitterbuffer already destroyed.\n");
+ }
+
+
+ if (ch->orginator == ORG_AST) {
+ misdn_out_calls[bc->port]--;
+ } else {
+ misdn_in_calls[bc->port]--;
}
if (ch) {
@@ -3164,6 +3235,8 @@
chan_misdn_log(1, bc->port, " --> Ignoring Call, its not in our MSN List\n");
return RESPONSE_IGNORE_SETUP; /* Ignore MSNs which are not in our List */
}
+
+ misdn_in_calls[bc->port]++;
print_bearer(bc);
@@ -3674,6 +3747,21 @@
/** TE STUFF END **/
+#ifdef M_TIMER
+/* timer thread */
+pthread_t misdn_timer;
+struct sched_context *misdn_sched;
+
+void misdn_timerd(void *arg)
+{
+
+
+}
+
+
+/* timer thread end */
+#endif
+
/******************************************
*
* Asterisk Channel Endpoint END
@@ -3714,7 +3802,15 @@
if (strlen(tempbuf))
tracing = 1;
}
-
+
+ misdn_in_calls = (int *)malloc(sizeof(int) * (max_ports+1));
+ misdn_out_calls = (int *)malloc(sizeof(int) * (max_ports+1));
+
+ for (i=1; i <= max_ports; i++) {
+ misdn_in_calls[i]=0;
+ misdn_out_calls[i]=0;
+ }
+
ast_mutex_init(&cl_te_lock);
ast_mutex_init(&release_lock_mutex);
@@ -3755,6 +3851,7 @@
ast_cli_register(&cli_show_config);
ast_cli_register(&cli_show_port);
ast_cli_register(&cli_show_stacks);
+ ast_cli_register(&cli_show_stats);
ast_cli_register(&cli_restart_port);
ast_cli_register(&cli_port_up);
@@ -3783,6 +3880,9 @@
misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
+
+
+
chan_misdn_log(0, 0, "-- mISDN Channel Driver Registred -- (BE AWARE THIS DRIVER IS EXPERIMENTAL!)\n");
@@ -3810,7 +3910,7 @@
ast_cli_unregister(&cli_show_cl);
ast_cli_unregister(&cli_show_config);
ast_cli_unregister(&cli_show_port);
- ast_cli_unregister(&cli_show_stacks);
+ ast_cli_unregister(&cli_show_stats);
ast_cli_unregister(&cli_restart_port);
ast_cli_unregister(&cli_port_up);
ast_cli_unregister(&cli_port_down);
Modified: team/crichter/0.4.0/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/misdn/chan_misdn_config.h?rev=29392&r1=29391&r2=29392&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/misdn/chan_misdn_config.h (original)
+++ team/crichter/0.4.0/channels/misdn/chan_misdn_config.h Mon May 22 05:39:55 2006
@@ -55,6 +55,9 @@
MISDN_CFG_JITTERBUFFER_UPPER_THRESHOLD, /* int */
MISDN_CFG_CALLGROUP, /* ast_group_t */
MISDN_CFG_PICKUPGROUP, /* ast_group_t */
+ MISDN_CFG_MAX_IN, /* int */
+ MISDN_CFG_MAX_OUT, /* int */
+ MISDN_CFG_L1_POLL, /* int */
MISDN_CFG_MSNS, /* char[] */
MISDN_CFG_PTP, /* int (bool) */
MISDN_CFG_LAST,
Modified: team/crichter/0.4.0/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.4.0/channels/misdn_config.c?rev=29392&r1=29391&r2=29392&view=diff
==============================================================================
--- team/crichter/0.4.0/channels/misdn_config.c (original)
+++ team/crichter/0.4.0/channels/misdn_config.c Mon May 22 05:39:55 2006
@@ -116,6 +116,9 @@
{ "jitterbuffer_upper_threshold", MISDN_CFG_JITTERBUFFER_UPPER_THRESHOLD, MISDN_CTYPE_INT, "0", NONE },
{ "callgroup", MISDN_CFG_CALLGROUP, MISDN_CTYPE_ASTGROUP, NO_DEFAULT, NONE },
{ "pickupgroup", MISDN_CFG_PICKUPGROUP, MISDN_CTYPE_ASTGROUP, NO_DEFAULT, NONE },
+ { "max_incoming", MISDN_CFG_MAX_IN, MISDN_CTYPE_INT, "-1", NONE },
+ { "max_outgoing", MISDN_CFG_MAX_OUT, MISDN_CTYPE_INT, "-1", NONE },
+ { "l1_poll_timer", MISDN_CFG_L1_POLL, MISDN_CTYPE_INT, "-1", NONE },
{ "msns", MISDN_CFG_MSNS, MISDN_CTYPE_MSNLIST, NO_DEFAULT, NONE }
};
More information about the asterisk-commits
mailing list