blob: 2cc41d4a6aff0b5ceafc243a1c8a71467af86b6e [file] [log] [blame]
Alexandre Lision0e143012014-01-22 11:02:46 -05001%module(directors="1") pjsua2
2
3//
4// Suppress few warnings
5//
6#pragma SWIG nowarn=312 // 312: nested struct (in types.h, sip_auth.h)
7
8//
9// Header section
10//
11%{
12#include "pjsua2.hpp"
13using namespace std;
14using namespace pj;
15%}
16
17#ifdef SWIGPYTHON
18 %feature("director:except") {
19 if( $error != NULL ) {
20 PyObject *ptype, *pvalue, *ptraceback;
21 PyErr_Fetch( &ptype, &pvalue, &ptraceback );
22 PyErr_Restore( ptype, pvalue, ptraceback );
23 PyErr_Print();
24 //Py_Exit(1);
25 }
26 }
27#endif
28
29// Allow C++ exceptions to be handled in Java
30#ifdef SWIGJAVA
31 %typemap(throws, throws="java.lang.Exception") pj::Error {
32 jclass excep = jenv->FindClass("java/lang/Exception");
33 if (excep)
34 jenv->ThrowNew(excep, $1.info(true).c_str());
35 return $null;
36}
37
38 // Force the Error Java class to extend java.lang.Exception
39 %typemap(javabase) pj::Error "java.lang.Exception";
40
41 // Override getMessage()
42 %typemap(javacode) pj::Error %{
43 public String getMessage() {
44 return getTitle();
45 }
46%}
47#endif
48
49
50// Constants from PJSIP libraries
51%include "symbols.i"
52
53
54//
55// Classes that can be extended in the target language
56//
57%feature("director") LogWriter;
58%feature("director") Endpoint;
59%feature("director") Account;
60%feature("director") Call;
61%feature("director") Buddy;
62%feature("director") FindBuddyMatch;
63
64//
65// STL stuff.
66//
67%include "std_string.i"
68%include "std_vector.i"
69
70%template(StringVector) std::vector<std::string>;
71%template(IntVector) std::vector<int>;
72
73//
74// Ignore stuffs in pjsua2
75//
76%ignore fromPj;
77%ignore toPj;
78
79//
80// Now include the API itself.
81//
82%include "pjsua2/types.hpp"
83
84%ignore pj::ContainerNode::op;
85%ignore pj::ContainerNode::data;
86%ignore container_node_op;
87%ignore container_node_internal_data;
88%include "pjsua2/persistent.hpp"
89
90%include "pjsua2/siptypes.hpp"
91
92%template(SipHeaderVector) std::vector<pj::SipHeader>;
93%template(AuthCredInfoVector) std::vector<pj::AuthCredInfo>;
94%template(SipMultipartPartVector) std::vector<pj::SipMultipartPart>;
95%template(BuddyVector) std::vector<pj::Buddy*>;
96%template(AudioMediaVector) std::vector<pj::AudioMedia*>;
97%template(MediaFormatVector) std::vector<pj::MediaFormat*>;
98%template(AudioDevInfoVector) std::vector<pj::AudioDevInfo*>;
99%template(CodecInfoVector) std::vector<pj::CodecInfo*>;
100
101%include "pjsua2/media.hpp"
102%include "pjsua2/endpoint.hpp"
103%include "pjsua2/presence.hpp"
104%include "pjsua2/account.hpp"
105%include "pjsua2/call.hpp"
106
107%template(CallMediaInfoVector) std::vector<pj::CallMediaInfo>;
108
109%ignore pj::JsonDocument::allocElement;
110%ignore pj::JsonDocument::getPool;
111%include "pjsua2/json.hpp"