summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjsip-apps/build/pjsip_apps.dsw36
-rw-r--r--pjsip-apps/build/py_pjsua.dsp112
-rw-r--r--pjsip-apps/src/py_pjsua/pjsua.py17
-rw-r--r--pjsip-apps/src/py_pjsua/py_pjsua.c88
-rw-r--r--pjsip-apps/src/py_pjsua/py_pjsua.def2
-rw-r--r--pjsip-apps/src/py_pjsua/setup.py7
6 files changed, 262 insertions, 0 deletions
diff --git a/pjsip-apps/build/pjsip_apps.dsw b/pjsip-apps/build/pjsip_apps.dsw
index 62e04870..32091c6a 100644
--- a/pjsip-apps/build/pjsip_apps.dsw
+++ b/pjsip-apps/build/pjsip_apps.dsw
@@ -135,6 +135,42 @@ Package=<4>
###############################################################################
+Project: "py_pjsua"=".\py_pjsua.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name pjlib
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjlib_util
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjmedia
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjmedia_codec
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjsip_core
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjsip_simple
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjsip_ua
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name pjsua_lib
+ End Project Dependency
+}}}
+
+###############################################################################
+
Project: "sample_debug"=".\sample_debug.dsp" - Package Owner=<4>
Package=<5>
diff --git a/pjsip-apps/build/py_pjsua.dsp b/pjsip-apps/build/py_pjsua.dsp
new file mode 100644
index 00000000..3ceb03c2
--- /dev/null
+++ b/pjsip-apps/build/py_pjsua.dsp
@@ -0,0 +1,112 @@
+# Microsoft Developer Studio Project File - Name="py_pjsua" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=py_pjsua - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "py_pjsua.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "py_pjsua.mak" CFG="py_pjsua - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "py_pjsua - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "py_pjsua - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "py_pjsua - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\output\py_pjsua-i386-win32-vc6-release"
+# PROP Intermediate_Dir ".\output\py_pjsua-i386-win32-vc6-release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\pjlib\include" /I "..\..\pjlib-util\include" /I "..\..\pjmedia\include" /I "..\..\pjsip\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x421 /d "NDEBUG"
+# ADD RSC /l 0x421 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 python24.lib pjlib-i386-win32-vc6-release.lib pjlib-util-i386-win32-vc6-release.lib pjmedia-codec-i386-win32-vc6-release.lib pjmedia-i386-win32-vc6-release.lib pjsip-core-i386-win32-vc6-release.lib pjsip-simple-i386-win32-vc6-release.lib pjsip-ua-i386-win32-vc6-release.lib pjsua-lib-i386-win32-vc6-release.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib /nologo /dll /map /machine:I386 /nodefaultlib:"libcmt.lib" /out:"..\lib\py_pjsua.pyd" /libpath:"../../pjlib/lib" /libpath:"../../pjlib-util/lib" /libpath:"../../pjmedia/lib" /libpath:"../../pjsip/lib"
+# SUBTRACT LINK32 /nodefaultlib
+
+!ELSEIF "$(CFG)" == "py_pjsua - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\output\py_pjsua-i386-win32-vc6-debug"
+# PROP Intermediate_Dir ".\output\py_pjsua-i386-win32-vc6-debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\pjlib\include" /I "..\..\pjlib-util\include" /I "..\..\pjmedia\include" /I "..\..\pjsip\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x421 /d "_DEBUG"
+# ADD RSC /l 0x421 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 python24_d.lib pjlib-i386-win32-vc6-debug.lib pjlib-util-i386-win32-vc6-debug.lib pjmedia-codec-i386-win32-vc6-debug.lib pjmedia-i386-win32-vc6-debug.lib pjsip-core-i386-win32-vc6-debug.lib pjsip-simple-i386-win32-vc6-debug.lib pjsip-ua-i386-win32-vc6-debug.lib pjsua-lib-i386-win32-vc6-debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"..\lib\py_pjsua_d.pyd" /pdbtype:sept /libpath:"../../pjlib/lib" /libpath:"../../pjlib-util/lib" /libpath:"../../pjmedia/lib" /libpath:"../../pjsip/lib" /libpath:"F:\incoming\projects\divusi\Python-2.4\Python-2.4\PCbuild" /libpath:"F:\incoming\projects\divusi\Python-2.4\Python-2.4\PC\VC6"
+
+!ENDIF
+
+# Begin Target
+
+# Name "py_pjsua - Win32 Release"
+# Name "py_pjsua - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\py_pjsua\py_pjsua.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\py_pjsua\py_pjsua.def
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/pjsip-apps/src/py_pjsua/pjsua.py b/pjsip-apps/src/py_pjsua/pjsua.py
new file mode 100644
index 00000000..cae3480f
--- /dev/null
+++ b/pjsip-apps/src/py_pjsua/pjsua.py
@@ -0,0 +1,17 @@
+# import module py_pjsua
+import py_pjsua
+
+print '''Testing py_pjsua.create : '''
+status = py_pjsua.create()
+print "py status " + `status`
+
+# perror
+print '''Testing error code 70006 : '''
+py_pjsua.perror("py_pjsua","hello",70006)
+
+# test py_pjsua.destroy
+print '''Testing py_pjsua.destroy : '''
+status = py_pjsua.destroy()
+print "py status " + `status`
+
+print '''End Of py_pjsua'''
diff --git a/pjsip-apps/src/py_pjsua/py_pjsua.c b/pjsip-apps/src/py_pjsua/py_pjsua.c
new file mode 100644
index 00000000..4ca49b82
--- /dev/null
+++ b/pjsip-apps/src/py_pjsua/py_pjsua.c
@@ -0,0 +1,88 @@
+#include <Python.h>
+#include <pjsua-lib/pjsua.h>
+
+
+static PyObject *py_pjsua_perror(PyObject *pSelf, PyObject *pArgs) {
+ const char *sender;
+ const char *title;
+ pj_status_t status;
+ if (!PyArg_ParseTuple(pArgs, "ssi", &sender, &title, &status)) {
+ return NULL;
+ }
+ pjsua_perror(sender, title, status);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+static PyObject *py_pjsua_create(PyObject *pSelf, PyObject *pArgs) {
+ pj_status_t status;
+ if (!PyArg_ParseTuple(pArgs, "")) {
+ return NULL;
+ }
+ status = pjsua_create();
+ printf("status %d\n",status);
+ return Py_BuildValue("i",status);
+}
+static PyObject *py_pjsua_start(PyObject *pSelf, PyObject *pArgs) {
+ pj_status_t status;
+ if (!PyArg_ParseTuple(pArgs, "")) {
+ return NULL;
+ }
+ status = pjsua_start();
+ printf("status %d\n",status);
+ return Py_BuildValue("i",status);
+}
+
+static PyObject *py_pjsua_destroy(PyObject *pSelf, PyObject *pArgs) {
+ pj_status_t status;
+ if (!PyArg_ParseTuple(pArgs, "")) {
+ return NULL;
+ }
+ status = pjsua_destroy();
+ printf("status %d\n",status);
+ return Py_BuildValue("i",status);
+}
+static PyObject *py_pjsua_handle_events(PyObject *pSelf, PyObject *pArgs) {
+ int ret;
+ unsigned msec;
+ if (!PyArg_ParseTuple(pArgs, "i", &msec)) {
+ return NULL;
+ }
+ ret = pjsua_handle_events(msec);
+ printf("return %d\n",ret);
+ return Py_BuildValue("i",ret);
+}
+static PyObject *py_pjsua_verify_sip_url(PyObject *pSelf, PyObject *pArgs) {
+ pj_status_t status;
+ const char *url;
+ if (!PyArg_ParseTuple(pArgs, "s", &url)) {
+ return NULL;
+ }
+ status = pjsua_verify_sip_url(url);
+ printf("status %d\n",status);
+ return Py_BuildValue("i",status);
+}
+/* doc string */
+static char pjsua_perror_doc[] = "Display error message for the specified error code";
+static char pjsua_create_doc[] = "Instantiate pjsua application";
+static char pjsua_start_doc[] = "Application is recommended to call this function after all initialization is done, so that the library can do additional checking set up additional";
+static char pjsua_destroy_doc[] = "Destroy pjsua";
+static char pjsua_handle_events_doc[] = "Poll pjsua for events, and if necessary block the caller thread for the specified maximum interval (in miliseconds)";
+static char pjsua_verify_sip_url_doc[] = "Verify that valid SIP url is given";
+
+/* Map of function names to functions */
+static PyMethodDef py_pjsua_methods[] = {
+ {"perror", py_pjsua_perror, METH_VARARGS, pjsua_perror_doc},
+ {"create", py_pjsua_create, METH_VARARGS, pjsua_create_doc},
+ {"start", py_pjsua_start, METH_VARARGS, pjsua_start_doc},
+ {"destroy", py_pjsua_destroy, METH_VARARGS, pjsua_destroy_doc},
+ {"handle_events", py_pjsua_handle_events, METH_VARARGS, pjsua_handle_events_doc},
+ {"verify_sip_url", py_pjsua_verify_sip_url, METH_VARARGS, pjsua_verify_sip_url_doc},
+ {NULL, NULL} /* End of functions */
+};
+
+
+PyMODINIT_FUNC
+initpy_pjsua(void)
+{
+ Py_InitModule("py_pjsua", py_pjsua_methods);
+}
diff --git a/pjsip-apps/src/py_pjsua/py_pjsua.def b/pjsip-apps/src/py_pjsua/py_pjsua.def
new file mode 100644
index 00000000..a8dd2f30
--- /dev/null
+++ b/pjsip-apps/src/py_pjsua/py_pjsua.def
@@ -0,0 +1,2 @@
+EXPORTS
+ initpy_pjsua
diff --git a/pjsip-apps/src/py_pjsua/setup.py b/pjsip-apps/src/py_pjsua/setup.py
new file mode 100644
index 00000000..2ad07d64
--- /dev/null
+++ b/pjsip-apps/src/py_pjsua/setup.py
@@ -0,0 +1,7 @@
+from distutils.core import setup, Extension
+pjproject = "../../../"
+setup(name="py_pjsua", version="0.1",
+ ext_modules = [
+ Extension("py_pjsua", ["py_pjsua.c"], include_dirs=[pjproject + "pjsip/include", pjproject + "pjlib/include", pjproject + "pjlib-util/include", pjproject + "pjmedia/include"], library_dirs=[pjproject + "pjsip/lib", pjproject + "pjlib/lib", pjproject + "pjmedia/lib", pjproject + "pjlib-util/lib"], libraries=["pjsua-i686-pc-linux-gnu", "pjsip-ua-i686-pc-linux-gnu", "pjsip-simple-i686-pc-linux-gnu", "pjsip-i686-pc-linux-gnu", "pjmedia-codec-i686-pc-linux-gnu", "pjmedia-i686-pc-linux-gnu", "pjmedia-codec-i686-pc-linux-gnu", "pjlib-util-i686-pc-linux-gnu", "pj-i686-pc-linux-gnu"]),
+
+ ])