This patch fixes http://www.magicphone.ca/src/PyAsterisk-200411180217.tar.gz so that it works with Asterisk 1.0.7 # # Patch managed by http://www.holgerschurig.de/patcher.html # --- PyAsterisk-200411180217/Makefile~fixes +++ PyAsterisk-200411180217/Makefile @@ -4,7 +4,7 @@ MODULES=res_python.so app_python.so cdr_python.so INCLUDES= -I/usr/include/python2.3 -I/src/asterisk/include -CFLAGS=-Wall -O2 ${INCLUDES} -DASTERISK_CONFIG_DIR=\"${ASTERISK_CONFIG_DIR}\" +CFLAGS=-Wall -O2 -fno-strict-aliasing ${INCLUDES} -DASTERISK_CONFIG_DIR=\"${ASTERISK_CONFIG_DIR}\" all: ${MODULES} @@ -13,7 +13,7 @@ res_python.so: res_python.o asterisk_wrap.o cc -shared -o res_python.so res_python.o asterisk_wrap.o \ - -lswigpy -lpython2.3 + -lpython2.3 app_python.so: app_python.o cc -shared -o app_python.so app_python.o -lpython2.3 --- PyAsterisk-200411180217/res_python.c~fixes +++ PyAsterisk-200411180217/res_python.c @@ -21,11 +21,11 @@ #include #include #include -#include +#include #include "py_asterisk.h" -#define PyASTERISK_VERSION "$Id: res_python.c,v 1.6 2004/11/18 07:17:10 ww Exp $" +#define PyASTERISK_VERSION "2004-04-28" #ifdef ASTERISK_1_0 #define ast_pthread_create pthread_create @@ -54,17 +54,6 @@ return python_interp; } -static PyObject *PyAsteriskLog(PyObject *self, PyObject *args) -{ - int level; - const char *s; - if(!PyArg_ParseTuple(args, "is", &level, &s)) - return NULL; - ast_log(level, _A_, "%s\n", s); - Py_INCREF(Py_None); - return Py_None; -} - /* * Asterisk Module Housekeeping. Ver' simple. */ @@ -73,6 +62,7 @@ /* ARGUSED */ { PyThreadState *tstate; + void init_asterisk(void); ast_log(LOG_DEBUG, "Initializing Python Interpreter.\n"); ast_verbose("Python %s %s\n", Py_GetPlatform(), Py_GetVersion()); --- PyAsterisk-200411180217/helpers.i~fixes +++ PyAsterisk-200411180217/helpers.i @@ -55,7 +55,7 @@ } char *ast_channel_getname(struct ast_channel *c) { - if(!c) return; + if(!c) return NULL; return c->name; } @@ -75,7 +75,7 @@ Py_BEGIN_ALLOW_THREADS ret = ast_pbx_outgoing_exten("Local", AST_FORMAT_SLINEAR, src, timeout, outctx, outext, outprio, - &reason, 1, cid, vars, account); + &reason, 1, 0, cid, vars, account, NULL); Py_END_ALLOW_THREADS return ret; } --- PyAsterisk-200411180217/helpers_cdr.i~fixes +++ PyAsterisk-200411180217/helpers_cdr.i @@ -45,8 +45,8 @@ %inline %{ - char *ast_cdr_get_accountcode(struct ast_cdr *cdr) { - return cdr->accountcode; + char *ast_cdr_get_clid(struct ast_cdr *cdr) { + return cdr->clid; } char *ast_cdr_get_src(struct ast_cdr *cdr) { return cdr->src; @@ -57,9 +57,6 @@ char *ast_cdr_get_dcontext(struct ast_cdr *cdr) { return cdr->dcontext; } - char *ast_cdr_get_clid(struct ast_cdr *cdr) { - return cdr->clid; - } char *ast_cdr_get_channel(struct ast_cdr *cdr) { return cdr->channel; } @@ -93,13 +90,16 @@ char *ast_cdr_get_amaflags(struct ast_cdr *cdr) { return ast_cdr_flags2str(cdr->amaflags); } + char *ast_cdr_get_accountcode(struct ast_cdr *cdr) { + return cdr->accountcode; + } + int ast_cdr_get_flags(struct ast_cdr *cdr) { + return cdr->flags; + } char *ast_cdr_get_uniqueid(struct ast_cdr *cdr) { return cdr->uniqueid; } char *ast_cdr_get_userfield(struct ast_cdr *cdr) { return cdr->userfield; } - struct ast_channel *ast_cdr_get_channelp(struct ast_cdr *cdr) { - return cdr->channelp; - } %} --- PyAsterisk-200411180217/asterisk.i~fixes +++ PyAsterisk-200411180217/asterisk.i @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include --- PyAsterisk-200411180217/cdr_python.c~fixes +++ PyAsterisk-200411180217/cdr_python.c @@ -26,7 +26,7 @@ #include "py_asterisk.h" -#define PyASTERISK_CDR_VERSION "$Id: cdr_python.c,v 1.1 2004/11/18 07:17:10 ww Exp $" +#define PyASTERISK_CDR_VERSION "2004-04-28" static char *desc = "Python CDR Backend"; static char *name = "cdr_python"; --- PyAsterisk-200411180217/app_python.c~fixes +++ PyAsterisk-200411180217/app_python.c @@ -25,7 +25,7 @@ #include "py_asterisk.h" -#define PyASTERISK_VERSION "$Id: app_python.c,v 1.2 2004/11/18 07:17:10 ww Exp $" +#define PyASTERISK_VERSION "2004-04-28" #ifdef ASTERISK_1_0 #define ast_pthread_create pthread_create