[asterisk-commits] jpeeler: branch jpeeler/chan_dahdi r119064 - in /team/jpeeler/chan_dahdi: ./ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 29 14:28:11 CDT 2008
Author: jpeeler
Date: Thu May 29 14:28:10 2008
New Revision: 119064
URL: http://svn.digium.com/view/asterisk?view=rev&rev=119064
Log:
Map zap to dahdi so existing dialplans can make calls. Add configuration option in asterisk.conf (dahdichanname) to control whether channel name is zap or dahdi.
Modified:
team/jpeeler/chan_dahdi/Makefile
team/jpeeler/chan_dahdi/apps/app_chanspy.c
team/jpeeler/chan_dahdi/apps/app_dial.c
team/jpeeler/chan_dahdi/apps/app_zapscan.c
team/jpeeler/chan_dahdi/include/asterisk/options.h
team/jpeeler/chan_dahdi/main/asterisk.c
team/jpeeler/chan_dahdi/main/channel.c
Modified: team/jpeeler/chan_dahdi/Makefile
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/Makefile?view=diff&rev=119064&r1=119063&r2=119064
==============================================================================
--- team/jpeeler/chan_dahdi/Makefile (original)
+++ team/jpeeler/chan_dahdi/Makefile Thu May 29 14:28:10 2008
@@ -680,6 +680,7 @@
echo ";transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly" ; \
echo ";runuser = asterisk ; The user to run as" ; \
echo ";rungroup = asterisk ; The group to run as" ; \
+ echo "dahdichanname = yes" ; Set channel name as DAHDI\
echo "" ; \
echo "; Changing the following lines may compromise your security." ; \
echo ";[files]" ; \
Modified: team/jpeeler/chan_dahdi/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_chanspy.c?view=diff&rev=119064&r1=119063&r2=119064
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_chanspy.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_chanspy.c Thu May 29 14:28:10 2008
@@ -47,6 +47,7 @@
#include "asterisk/translate.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
+#include "asterisk/options.h"
#define AST_NAME_STRLEN 256
#define NUM_SPYGROUPS 128
@@ -585,6 +586,7 @@
const char *exten, const char *context, struct chanspy_ds *chanspy_ds)
{
struct ast_channel *next;
+ char channel_name[AST_CHANNEL_NAME];
redo:
if (!ast_strlen_zero(spec))
@@ -597,7 +599,8 @@
if (!next)
return NULL;
- if (!strncmp(next->name, "Zap/pseudo", 10)) {
+ snprintf(channel_name, AST_CHANNEL_NAME, "%s/pseudo", dahdi_chan_name);
+ if (!strncmp(next->name, channel_name, 10)) {
ast_channel_unlock(next);
goto redo;
} else if (next == chan) {
Modified: team/jpeeler/chan_dahdi/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_dial.c?view=diff&rev=119064&r1=119063&r2=119064
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_dial.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_dial.c Thu May 29 14:28:10 2008
@@ -1895,7 +1895,7 @@
res = -1;
goto done;
}
- if (opermode && !strncmp(chan->name, "dahdi", 3) && !strncmp(peer->name, "dahdi", 3)) {
+ if (opermode && !strncmp(chan->tech->type, "dahdi", 3) && !strncmp(peer->name, "dahdi", 3)) {
/* what's this special handling for dahdi <-> dahdi ?
* A: dahdi to dahdi calls are natively bridged at the kernel driver
* level, so we need to ensure that this mode gets propagated
Modified: team/jpeeler/chan_dahdi/apps/app_zapscan.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/apps/app_zapscan.c?view=diff&rev=119064&r1=119063&r2=119064
==============================================================================
--- team/jpeeler/chan_dahdi/apps/app_zapscan.c (original)
+++ team/jpeeler/chan_dahdi/apps/app_zapscan.c Thu May 29 14:28:10 2008
@@ -66,7 +66,7 @@
static struct ast_channel *get_dahdi_channel_locked(int num) {
char name[80];
- snprintf(name, sizeof(name), "DAHDI/%d-1", num);
+ snprintf(name, sizeof(name), "%s/%d-1", dahdi_chan_name, num);
return ast_get_channel_by_name_locked(name);
}
Modified: team/jpeeler/chan_dahdi/include/asterisk/options.h
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/include/asterisk/options.h?view=diff&rev=119064&r1=119063&r2=119064
==============================================================================
--- team/jpeeler/chan_dahdi/include/asterisk/options.h (original)
+++ team/jpeeler/chan_dahdi/include/asterisk/options.h Thu May 29 14:28:10 2008
@@ -29,6 +29,8 @@
#define AST_CACHE_DIR_LEN 512
#define AST_FILENAME_MAX 80
+#define AST_CHANNEL_NAME 80 /*!< Max length of an ast_channel name */
+
/*! \ingroup main_options */
enum ast_option_flags {
@@ -127,6 +129,7 @@
extern pid_t ast_mainpid;
extern char record_cache_dir[AST_CACHE_DIR_LEN];
+extern char dahdi_chan_name[AST_CHANNEL_NAME];
extern int ast_language_is_prefix;
Modified: team/jpeeler/chan_dahdi/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/main/asterisk.c?view=diff&rev=119064&r1=119063&r2=119064
==============================================================================
--- team/jpeeler/chan_dahdi/main/asterisk.c (original)
+++ team/jpeeler/chan_dahdi/main/asterisk.c Thu May 29 14:28:10 2008
@@ -165,6 +165,7 @@
#if defined(HAVE_SYSINFO)
long option_minmemfree; /*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
#endif
+char dahdi_chan_name[AST_CHANNEL_NAME] = "Zap";
/*! @} */
@@ -2751,6 +2752,10 @@
option_minmemfree = 0;
}
#endif
+ } else if (!strcasecmp(v->name, "dahdichanname")) {
+ if (!strcasecmp(v->value, "yes")) {
+ ast_copy_string(dahdi_chan_name, "dahdi", sizeof(dahdi_chan_name));
+ }
}
}
ast_config_destroy(cfg);
Modified: team/jpeeler/chan_dahdi/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/main/channel.c?view=diff&rev=119064&r1=119063&r2=119064
==============================================================================
--- team/jpeeler/chan_dahdi/main/channel.c (original)
+++ team/jpeeler/chan_dahdi/main/channel.c Thu May 29 14:28:10 2008
@@ -3404,6 +3404,11 @@
return NULL;
}
+ if (!strcasecmp(type, "Zap")) {
+ type = "DAHDI";
+ ast_log(LOG_NOTICE, "Zap interface translated to DAHDI.\n");
+ }
+
AST_LIST_TRAVERSE(&backends, chan, list) {
if (strcasecmp(type, chan->tech->type))
continue;
More information about the asterisk-commits
mailing list