[asterisk-commits] branch crichter/0.3.0 - r7650 in
/team/crichter/0.3.0: channels/ channels/mis...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Dec 27 04:04:34 CST 2005
Author: crichter
Date: Tue Dec 27 04:04:29 2005
New Revision: 7650
URL: http://svn.digium.com/view/asterisk?rev=7650&view=rev
Log:
added support for reading ptp config from /etc/misdn-init.conf, added option for path of misdn-init.conf. Updated docs and samples. Now there is no L2 Setting in misdn.conf anymore.
Modified:
team/crichter/0.3.0/channels/chan_misdn.c
team/crichter/0.3.0/channels/chan_misdn_config.c
team/crichter/0.3.0/channels/misdn/chan_misdn_config.h
team/crichter/0.3.0/configs/misdn.conf.sample
team/crichter/0.3.0/doc/README.misdn
Modified: team/crichter/0.3.0/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/chan_misdn.c?rev=7650&r1=7649&r2=7650&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_misdn.c (original)
+++ team/crichter/0.3.0/channels/chan_misdn.c Tue Dec 27 04:04:29 2005
@@ -604,6 +604,8 @@
free_robin_list();
misdn_cfg_reload();
+
+ misdn_cfg_update_ptp();
misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
@@ -3535,7 +3537,10 @@
ast_mutex_init(&cl_te_lock);
ast_mutex_init(&release_lock_mutex);
+
+ misdn_cfg_update_ptp();
misdn_cfg_get_ports_string(ports);
+
if (strlen(ports))
chan_misdn_log(0, 0, "Got: %s from get_ports\n",ports);
Modified: team/crichter/0.3.0/channels/chan_misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/chan_misdn_config.c?rev=7650&r1=7649&r2=7650&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/chan_misdn_config.c (original)
+++ team/crichter/0.3.0/channels/chan_misdn_config.c Tue Dec 27 04:04:29 2005
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <errno.h>
#include "chan_misdn_config.h"
@@ -85,6 +86,7 @@
};
struct general_config {
+ char *misdn_init;
int *debug;
char *tracefile;
int *trace_calls;
@@ -108,7 +110,39 @@
/* storing the ptp flag separated to save memory */
static int *ptp;
-static ast_mutex_t config_mutex;
+static ast_mutex_t config_mutex;
+
+
+void misdn_cfg_update_ptp( void )
+{
+ char misdn_init[256];
+
+ misdn_cfg_get( 0, MISDN_GEN_MISDN_INIT, &misdn_init, sizeof(misdn_init));
+ FILE *fp=fopen(misdn_init,"r");
+
+ if (fp) {
+ char line[128];
+
+ while(fgets(line, sizeof(line), fp)) {
+ if (!strncmp(line,"nt_ptp",6)) {
+ char *tok, *p;
+ for( tok=strtok_r( line,",=", &p);
+ tok;
+ tok=strtok_r( NULL,",=", &p)) {
+ char *p;
+ int port=strtol(tok, &p,10);
+
+ if (p!=tok) {
+ ptp[port]=1;
+ }
+ }
+ }
+ }
+ fclose(fp);
+ } else {
+ ast_log(LOG_WARNING,"Couldn't open %s because:%s\n",misdn_init,strerror(errno));
+ }
+}
static inline void misdn_cfg_lock (void) {
@@ -191,7 +225,8 @@
if (general_cfg->elem) \
free(general_cfg->elem); \
})
-
+
+ FREE_GEN_ELEM(misdn_init);
FREE_GEN_ELEM(debug);
FREE_GEN_ELEM(tracefile);
FREE_GEN_ELEM(trace_calls);
@@ -342,6 +377,8 @@
break;
case MISDN_GEN_TRACEFILE: GET_GENCFG_STRCPY(tracefile);
break;
+ case MISDN_GEN_MISDN_INIT: GET_GENCFG_STRCPY(misdn_init);
+ break;
case MISDN_GEN_TRACE_CALLS: GET_GENCFG_MEMCPY(trace_calls);
break;
case MISDN_GEN_TRACE_DIR: GET_GENCFG_STRCPY(trace_dir);
@@ -438,6 +475,7 @@
return re;
}
+
void misdn_cfg_get_ports_string (char *ports) {
*ports = 0;
@@ -625,6 +663,8 @@
break;
case MISDN_GEN_TRACEFILE: GET_GEN_STRING(TRACEFILE, tracefile);
break;
+ case MISDN_GEN_MISDN_INIT: GET_GEN_STRING(MISDN_INIT, misdn_init);
+ break;
case MISDN_GEN_TRACE_CALLS: GET_GEN_BOOL(TRACE_CALLS, trace_calls, true, false);
break;
case MISDN_GEN_TRACE_DIR: GET_GEN_STRING(TRACE_DIR, trace_dir);
@@ -721,6 +761,7 @@
for (; v; v = v->next) {
+ PARSE_GEN_STR(misdn_init);
PARSE_GEN_INT(debug);
PARSE_GEN_STR(tracefile);
PARSE_GEN_BOOL(trace_calls);
@@ -917,6 +958,11 @@
general_cfg->bridging = (int*)malloc(sizeof(int));
*general_cfg->bridging = 1;
}
+
+ if (!general_cfg->misdn_init) {
+ general_cfg->misdn_init = strdup("/etc/misdn-init.conf");
+ }
+
if (!general_cfg->stop_tone_after_first_digit) {
general_cfg->stop_tone_after_first_digit = (int*)malloc(sizeof(int));
*general_cfg->stop_tone_after_first_digit = 1;
Modified: team/crichter/0.3.0/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/channels/misdn/chan_misdn_config.h?rev=7650&r1=7649&r2=7650&view=diff
==============================================================================
--- team/crichter/0.3.0/channels/misdn/chan_misdn_config.h (original)
+++ team/crichter/0.3.0/channels/misdn/chan_misdn_config.h Tue Dec 27 04:04:29 2005
@@ -55,6 +55,7 @@
/* general config items */
MISDN_GEN_FIRST,
+ MISDN_GEN_MISDN_INIT, /* char[] */
MISDN_GEN_DEBUG, /* int */
MISDN_GEN_TRACEFILE, /* char[] */
MISDN_GEN_TRACE_CALLS, /* int (bool) */
@@ -80,6 +81,8 @@
void misdn_cfg_reload(void);
void misdn_cfg_destroy(void);
+void misdn_cfg_update_ptp( void );
+
/* if you requst a general config element, the port value is ignored. if the requested
* value is not available, or the buffer is too small, the buffer will be nulled (in
* case of a char* only its first byte will be nulled). */
Modified: team/crichter/0.3.0/configs/misdn.conf.sample
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/configs/misdn.conf.sample?rev=7650&r1=7649&r2=7650&view=diff
==============================================================================
--- team/crichter/0.3.0/configs/misdn.conf.sample (original)
+++ team/crichter/0.3.0/configs/misdn.conf.sample Tue Dec 27 04:04:29 2005
@@ -8,6 +8,10 @@
;
[general]
+;
+; Sets the Path to the misdn-init.conf (for nt_ptp mode checking)
+;
+misdn_init=/etc/misdn-init.conf
; set debugging flag:
; 0 - No Debug
@@ -276,10 +280,12 @@
context=Intern
[internPP]
-; if you want to have pp Protocol on one nt Port, you need
-; to add a ptp directly after the portnumber, you can still add
-; more ports and multiple ptp adds in your config.
-ports=3ptp
+;
+; adding the postfix 'ptp' to a port number is obsolete now, chan_misdn
+; parses /etc/misdn-init.conf and sets the ptp mode to the corresponding
+; configs. For backwards compatibility you can still set ptp here.
+;
+ports=3
[first_extern]
; again port defs
Modified: team/crichter/0.3.0/doc/README.misdn
URL: http://svn.digium.com/view/asterisk/team/crichter/0.3.0/doc/README.misdn?rev=7650&r1=7649&r2=7650&view=diff
==============================================================================
--- team/crichter/0.3.0/doc/README.misdn (original)
+++ team/crichter/0.3.0/doc/README.misdn Tue Dec 27 04:04:29 2005
@@ -140,10 +140,6 @@
a context variable resides in the user sections, which tells chan_misdn where
to send incoming calls to in the Asterisk dial plan (extension.conf).
-In NT-Mode Ports there is a new option, directly after the port number you can
-write ptp, this enables PP Mode for this port, please look at misdn.conf.sample for
-an example.
-
Dial and Options String
-----------------------
@@ -283,31 +279,6 @@
it, you can just change pci_find_subsys to pci_get_subsys, this works.
-- chan_misdn-0.0.3-rc1:
- * linux-kernel >= 2.6.3 (but at least 2.6)
- * asterisk >= v1-0
- * mISDN/mISDNuser since September/04
-
-- chan_misdn-0.0.3-rc3:
- * linux-kernel >= 2.6.3 (but at least 2.6)
- * asterisk >= v1-0.2
- * mISDN/mISDNuser since December/04
-
-- chan_misdn-0.0.3-rc4:
- * linux-kernel >= 2.6.8 (but at least 2.6)
- * asterisk >= v1-0.2
- * mISDN/mISDNuser head on cvs.isdn4linux.de
-
-- chan_misdn-0.0.3-rc6:
- * linux-kernel >= 2.6.8 (but at least 2.6)
- * asterisk >= v1-0.2
- * mISDN/mISDNuser head on cvs.isdn4linux.de
-
-- chan_misdn-0.1.0
- * linux-kernel >= 2.6.8 (but at least 2.6)
- * asterisk >= v1-0.2 , also CVS Head
- * mISDN/mISDNuser (3.0-beta) from isdn.jolly.de
-
- chan_misdn-0.2.1
* linux-kernel >= 2.6.8 (but at least 2.6)
* asterisk >= v1.2 , also CVS Head
More information about the asterisk-commits
mailing list