[svn-commits] russell: branch russell/bindings r103281 - in /team/russell/bindings: binding...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Feb 10 20:17:46 CST 2008


Author: russell
Date: Sun Feb 10 20:17:45 2008
New Revision: 103281

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103281
Log:
check in progress ... mostly infrastructure in prep for some new stuff

Added:
    team/russell/bindings/bindings/ast_channel.i   (with props)
    team/russell/bindings/res/res_python/channel.c   (with props)
Modified:
    team/russell/bindings/bindings/Makefile
    team/russell/bindings/res/Makefile
    team/russell/bindings/res/res_python.c
    team/russell/bindings/res/res_python/cdr.c
    team/russell/bindings/res/res_python/res_python.h

Modified: team/russell/bindings/bindings/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/bindings/bindings/Makefile?view=diff&rev=103281&r1=103280&r2=103281
==============================================================================
--- team/russell/bindings/bindings/Makefile (original)
+++ team/russell/bindings/bindings/Makefile Sun Feb 10 20:17:45 2008
@@ -11,17 +11,23 @@
 # the GNU General Public License
 #
 
-PYTHON_MODS:=ast_cdr.py
+PYTHON_MODS:=ast_cdr.py ast_channel.py
 
-all: ast_cdr_wrap.c swigpyrun.h
+all: ast_channel_wrap.c ast_cdr_wrap.c swigpyrun.h
 
-ast_cdr.i: ../include/asterisk/cdr.h
+ast_channel.i: $(ASTTOPDIR)/include/asterisk/channel.h
+
+ast_cdr.i: $(ASTTOPDIR)/include/asterisk/cdr.h
 	$(AWK) -f get_swig $< >> $@
 
 ast_cdr_wrap.c: ast_cdr.i
 ifneq ($(SWIG),:)
 	$(SWIG) -I$(ASTTOPDIR)/include -python ast_cdr.i
-	$(SWIG) -I$(ASTTOPDIR)/include -python -external-runtime
+endif
+
+ast_channel_wrap.c: ast_channel.i
+ifneq ($(SWIG),:)
+	$(SWIG) -I$(ASTTOPDIR)/include -python ast_channel.i
 endif
 
 swigpyrun.h:
@@ -37,7 +43,7 @@
 	for x in $(PYTHON_MODS); do rm -f $(DESTDIR)$(PYTHON_DIR)/$$x $(DESTDIR)$(PYTHON_DIR)/$${x}c ; done
 
 clean:
-	rm -f _ast_cdr.so ast_cdr_wrap.c ast_cdr.py ast_cdr.pyc swigpyrun.h
+	rm -f _ast_cdr.so ast_cdr_wrap.c ast_cdr.py ast_cdr.pyc swigpyrun.h ast_channel_wrap.c ast_channel.py ast_channel.pyc
 	rm -rf build
 
 distclean: clean

Added: team/russell/bindings/bindings/ast_channel.i
URL: http://svn.digium.com/view/asterisk/team/russell/bindings/bindings/ast_channel.i?view=auto&rev=103281
==============================================================================
--- team/russell/bindings/bindings/ast_channel.i (added)
+++ team/russell/bindings/bindings/ast_channel.i Sun Feb 10 20:17:45 2008
@@ -1,0 +1,17 @@
+%module ast_channel
+
+%{
+#include "asterisk.h"
+#include "asterisk/channel.h"
+
+#include "res_python/res_python.h"
+%}
+
+struct ast_channel {
+};
+
+%extend ast_channel {
+    const char *get_name(void) {
+        return $self->name;
+    }
+};

Propchange: team/russell/bindings/bindings/ast_channel.i
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/russell/bindings/bindings/ast_channel.i
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/russell/bindings/bindings/ast_channel.i
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/russell/bindings/res/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/bindings/res/Makefile?view=diff&rev=103281&r1=103280&r2=103281
==============================================================================
--- team/russell/bindings/res/Makefile (original)
+++ team/russell/bindings/res/Makefile Sun Feb 10 20:17:45 2008
@@ -48,9 +48,19 @@
 
 ael/pval.o: ael/pval.c
 
-res_python.so: res_python.o python_ast_cdr_wrap.o res_python/cdr.o
+PYTHON_WRAPPERS:=python_ast_cdr_wrap.o python_ast_channel_wrap.o
+RES_PYTHON_OBJS:=res_python.o res_python/cdr.o res_python/channel.o
+
+res_python.so: $(RES_PYTHON_OBJS) $(PYTHON_WRAPPERS)
+
+res_python/channel.o: ASTCFLAGS+=$(PYTHON_INCLUDE)
 
 res_python/cdr.o: ASTCFLAGS+=$(PYTHON_INCLUDE)
+
+python_ast_channel_wrap.o: ASTCFLAGS+=$(PYTHON_INCLUDE)
+	
+python_ast_channel_wrap.c: ../bindings/ast_channel_wrap.c
+	@cp $< $@
 
 python_ast_cdr_wrap.o: ASTCFLAGS+=$(PYTHON_INCLUDE)
 
@@ -60,4 +70,5 @@
 clean::
 	rm -f snmp/*.o
 	rm -f ael/*.o
-	rm -f python_ast_cdr_wrap.c
+	rm -f res_python/*.o
+	rm -f $(PYTHON_WRAPPERS:.o=.c)

Modified: team/russell/bindings/res/res_python.c
URL: http://svn.digium.com/view/asterisk/team/russell/bindings/res/res_python.c?view=diff&rev=103281&r1=103280&r2=103281
==============================================================================
--- team/russell/bindings/res/res_python.c (original)
+++ team/russell/bindings/res/res_python.c Sun Feb 10 20:17:45 2008
@@ -90,12 +90,18 @@
 
 static int reload_module(void)
 {
-	return python_cdr_reload();
+	int res;
+
+	res = python_cdr_reload();
+	res |= python_channel_reload();
+
+	return res;
 }
 
 static int unload_module(void)
 {
 	python_cdr_unload();
+	python_channel_unload();
 
 	ast_cli_unregister_multiple(cli_python, ARRAY_LEN(cli_python));
 
@@ -122,6 +128,7 @@
 	PyEval_InitThreads();
 
 	python_cdr_load();
+	python_channel_load();
 
 	main_thread_state = PyThreadState_Get();
 

Modified: team/russell/bindings/res/res_python/cdr.c
URL: http://svn.digium.com/view/asterisk/team/russell/bindings/res/res_python/cdr.c?view=diff&rev=103281&r1=103280&r2=103281
==============================================================================
--- team/russell/bindings/res/res_python/cdr.c (original)
+++ team/russell/bindings/res/res_python/cdr.c Sun Feb 10 20:17:45 2008
@@ -26,6 +26,8 @@
  *
  * \ingroup cdr_drivers
  */
+
+#include "asterisk.h"
 
 #include "asterisk/cdr.h"
 #include "asterisk/cli.h"

Added: team/russell/bindings/res/res_python/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/bindings/res/res_python/channel.c?view=auto&rev=103281
==============================================================================
--- team/russell/bindings/res/res_python/channel.c (added)
+++ team/russell/bindings/res/res_python/channel.c Sun Feb 10 20:17:45 2008
@@ -1,0 +1,70 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2008, Digium, Inc.
+ *
+ * Russell Bryant <russell at digium.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! \file
+ *
+ * \brief Python bindings for channels
+ *
+ * \author Russell Bryant <russell at digium.com>
+ *
+ * \ingroup applications
+ */
+
+#include "asterisk.h"
+
+#include "asterisk/cdr.h"
+#include "asterisk/cli.h"
+#include "asterisk/module.h"
+#include "asterisk/pbx.h"
+#include "asterisk/channel.h"
+
+#include "res_python.h"
+#include "../bindings/swigpyrun.h"
+
+static const char python_app[] = "Python";
+static const char python_synopsis[] = "Channel control via a Python application";
+static const char python_desc[] =
+"Python(<python module>):\n"
+"   Do stuff!\n"
+"";
+
+static int python_exec(struct ast_channel *chan, void *data)
+{
+	return 0;
+}
+
+int python_channel_reload(void)
+{
+	return 0;
+}
+
+int python_channel_unload(void)
+{
+	return ast_unregister_application(python_app);
+}
+
+int python_channel_load(void)
+{
+	int res;
+
+	init_ast_channel(); /* init ast_channel module from swig */
+
+	res = ast_register_application(python_app, python_exec, python_synopsis, python_desc);
+
+	return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
+}

Propchange: team/russell/bindings/res/res_python/channel.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/russell/bindings/res/res_python/channel.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/russell/bindings/res/res_python/channel.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/russell/bindings/res/res_python/res_python.h
URL: http://svn.digium.com/view/asterisk/team/russell/bindings/res/res_python/res_python.h?view=diff&rev=103281&r1=103280&r2=103281
==============================================================================
--- team/russell/bindings/res/res_python/res_python.h (original)
+++ team/russell/bindings/res/res_python/res_python.h Sun Feb 10 20:17:45 2008
@@ -23,7 +23,7 @@
 
 extern PyThreadState *main_thread_state;
 
-/*! defined by python_cdr_wrap.c */
+/*! defined by python_ast_cdr_wrap.c */
 void init_ast_cdr(void);
 
 int python_cdr_load(void);
@@ -31,4 +31,11 @@
 int python_cdr_reload(void);
 void print_python_cdr_settings(int *fd);
 
+/*! defined in python_ast_channel_wrap.c */
+void init_ast_channel(void);
+
+int python_channel_load(void);
+int python_channel_unload(void);
+int python_channel_reload(void);
+
 #endif /* RES_PYTHON_H */




More information about the svn-commits mailing list