diff options
author | Liong Sauw Ming <ming@teluu.com> | 2014-01-16 05:30:46 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2014-01-16 05:30:46 +0000 |
commit | e56ea14ab8531ee3cec375460577d1b89bf62e26 (patch) | |
tree | df77c3acb961514b2022ee9e030071b691145920 /pjsip-apps/src/swig/pjsua2.i | |
parent | bd1c47e995a3a844868f1d4dcc8f77f163ae721b (diff) |
Closed #1723: Merging pjsua2 branch into trunk
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4704 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src/swig/pjsua2.i')
-rw-r--r-- | pjsip-apps/src/swig/pjsua2.i | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/pjsip-apps/src/swig/pjsua2.i b/pjsip-apps/src/swig/pjsua2.i new file mode 100644 index 00000000..2cc41d4a --- /dev/null +++ b/pjsip-apps/src/swig/pjsua2.i @@ -0,0 +1,111 @@ +%module(directors="1") pjsua2 + +// +// Suppress few warnings +// +#pragma SWIG nowarn=312 // 312: nested struct (in types.h, sip_auth.h) + +// +// Header section +// +%{ +#include "pjsua2.hpp" +using namespace std; +using namespace pj; +%} + +#ifdef SWIGPYTHON + %feature("director:except") { + if( $error != NULL ) { + PyObject *ptype, *pvalue, *ptraceback; + PyErr_Fetch( &ptype, &pvalue, &ptraceback ); + PyErr_Restore( ptype, pvalue, ptraceback ); + PyErr_Print(); + //Py_Exit(1); + } + } +#endif + +// Allow C++ exceptions to be handled in Java +#ifdef SWIGJAVA + %typemap(throws, throws="java.lang.Exception") pj::Error { + jclass excep = jenv->FindClass("java/lang/Exception"); + if (excep) + jenv->ThrowNew(excep, $1.info(true).c_str()); + return $null; +} + + // Force the Error Java class to extend java.lang.Exception + %typemap(javabase) pj::Error "java.lang.Exception"; + + // Override getMessage() + %typemap(javacode) pj::Error %{ + public String getMessage() { + return getTitle(); + } +%} +#endif + + +// Constants from PJSIP libraries +%include "symbols.i" + + +// +// Classes that can be extended in the target language +// +%feature("director") LogWriter; +%feature("director") Endpoint; +%feature("director") Account; +%feature("director") Call; +%feature("director") Buddy; +%feature("director") FindBuddyMatch; + +// +// STL stuff. +// +%include "std_string.i" +%include "std_vector.i" + +%template(StringVector) std::vector<std::string>; +%template(IntVector) std::vector<int>; + +// +// Ignore stuffs in pjsua2 +// +%ignore fromPj; +%ignore toPj; + +// +// Now include the API itself. +// +%include "pjsua2/types.hpp" + +%ignore pj::ContainerNode::op; +%ignore pj::ContainerNode::data; +%ignore container_node_op; +%ignore container_node_internal_data; +%include "pjsua2/persistent.hpp" + +%include "pjsua2/siptypes.hpp" + +%template(SipHeaderVector) std::vector<pj::SipHeader>; +%template(AuthCredInfoVector) std::vector<pj::AuthCredInfo>; +%template(SipMultipartPartVector) std::vector<pj::SipMultipartPart>; +%template(BuddyVector) std::vector<pj::Buddy*>; +%template(AudioMediaVector) std::vector<pj::AudioMedia*>; +%template(MediaFormatVector) std::vector<pj::MediaFormat*>; +%template(AudioDevInfoVector) std::vector<pj::AudioDevInfo*>; +%template(CodecInfoVector) std::vector<pj::CodecInfo*>; + +%include "pjsua2/media.hpp" +%include "pjsua2/endpoint.hpp" +%include "pjsua2/presence.hpp" +%include "pjsua2/account.hpp" +%include "pjsua2/call.hpp" + +%template(CallMediaInfoVector) std::vector<pj::CallMediaInfo>; + +%ignore pj::JsonDocument::allocElement; +%ignore pj::JsonDocument::getPool; +%include "pjsua2/json.hpp" |