| 1 | |
|---|
| 2 | |
|---|
| 3 | #ifdef SWIGCSHARP |
|---|
| 4 | %module (directors=1) csharp_verona |
|---|
| 5 | #endif |
|---|
| 6 | #ifdef SWIGPYTHON |
|---|
| 7 | %module (directors=1) py_verona |
|---|
| 8 | #endif |
|---|
| 9 | #ifdef SWIGJAVA |
|---|
| 10 | %module (directors=1) jni_verona |
|---|
| 11 | #endif |
|---|
| 12 | #ifdef SWIGRUBY |
|---|
| 13 | %module (directors=1) rb_verona |
|---|
| 14 | #endif |
|---|
| 15 | #ifdef SWIGPERL |
|---|
| 16 | %module (directors=1) perl_verona |
|---|
| 17 | #endif |
|---|
| 18 | |
|---|
| 19 | %{ |
|---|
| 20 | #include "phapipp.h" |
|---|
| 21 | %} |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | #if defined(_WIN32_WCE) |
|---|
| 25 | #define SWIG_CSHARP_NO_STRING_HELPER |
|---|
| 26 | #define COMPACT_FRAMEWORK_COMPATIBLE |
|---|
| 27 | #endif |
|---|
| 28 | |
|---|
| 29 | #ifdef SWIGCSHARP |
|---|
| 30 | %{ |
|---|
| 31 | #if defined(_WIN32_WCE) |
|---|
| 32 | #define SWIG_CSHARP_NO_STRING_HELPER |
|---|
| 33 | #define COMPACT_FRAMEWORK_COMPATIBLE |
|---|
| 34 | #endif |
|---|
| 35 | #include <stdint.h> |
|---|
| 36 | %} |
|---|
| 37 | #endif |
|---|
| 38 | |
|---|
| 39 | #ifdef SWIGJAVA |
|---|
| 40 | %insert("runtime") %{ |
|---|
| 41 | #define SWIG_JAVA_NO_DETACH_CURRENT_THREAD |
|---|
| 42 | #define SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON |
|---|
| 43 | %} |
|---|
| 44 | %include "enumtypeunsafe.swg" |
|---|
| 45 | %javaconst(1); |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | %module(directors="1") jni_verona |
|---|
| 49 | %{ |
|---|
| 50 | #include <jni.h> |
|---|
| 51 | #ifdef ANDROID |
|---|
| 52 | #include <android/log.h> |
|---|
| 53 | #endif |
|---|
| 54 | struct TmpJOBJ { |
|---|
| 55 | JNIEnv* env; |
|---|
| 56 | jobject jo; |
|---|
| 57 | TmpJOBJ(JNIEnv* e, jobject o) : env(e), jo(o) { } |
|---|
| 58 | ~TmpJOBJ() { env->DeleteLocalRef(jo); } |
|---|
| 59 | }; |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | extern "C" void osip_set_jvm(JavaVM *ajvm); |
|---|
| 66 | extern "C" void ms_set_jvm(JavaVM *vm); |
|---|
| 67 | |
|---|
| 68 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *ajvm, void *reserved) |
|---|
| 69 | { |
|---|
| 70 | ms_set_jvm(ajvm); |
|---|
| 71 | osip_set_jvm(ajvm); |
|---|
| 72 | return JNI_VERSION_1_6; |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | %} |
|---|
| 77 | |
|---|
| 78 | %typemap(directorin, descriptor="Ljava/lang/String;", noblock=1) char * { |
|---|
| 79 | $input = 0; |
|---|
| 80 | if ($1) { |
|---|
| 81 | $input = JCALL1(NewStringUTF, jenv, (const char *)$1); |
|---|
| 82 | if (!$input) return $null; |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | TmpJOBJ $1_tmpobj(jenv, (jobject) $input); |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | #endif |
|---|
| 90 | |
|---|
| 91 | #ifdef SWIGRUBY |
|---|
| 92 | %include "std/std_map.i" |
|---|
| 93 | %include "std/std_string.i" |
|---|
| 94 | #else |
|---|
| 95 | %include "std_map.i" |
|---|
| 96 | %include "std_string.i" |
|---|
| 97 | %include "std_vector.i" |
|---|
| 98 | %include "std_pair.i" |
|---|
| 99 | #endif |
|---|
| 100 | //%traits_ptypen(char) |
|---|
| 101 | |
|---|
| 102 | #ifdef SWIGPYTHON |
|---|
| 103 | %{ |
|---|
| 104 | PyObject* |
|---|
| 105 | make_hdrlist(const ph_hdr_list *hl) { |
|---|
| 106 | PyObject* result; |
|---|
| 107 | |
|---|
| 108 | result = PyList_New(hl->count); |
|---|
| 109 | for(int i = 0; i < hl->count; i++) |
|---|
| 110 | PyList_SET_ITEM(result, i, Py_BuildValue("ss", hl->elems[i].hdr, hl->elems[i].val)); |
|---|
| 111 | |
|---|
| 112 | return result; |
|---|
| 113 | } |
|---|
| 114 | %} |
|---|
| 115 | |
|---|
| 116 | %typemap(out) std::map<char*, char*> { |
|---|
| 117 | typedef std::map<char*, char*> ccmap; |
|---|
| 118 | ccmap& m = $1; |
|---|
| 119 | PyObject *list = PyList_New(m.size()); |
|---|
| 120 | int i = 0; |
|---|
| 121 | for(ccmap::const_iterator it = m.begin(); it != m.end(); it++) { |
|---|
| 122 | PyList_SET_ITEM(list, i++, Py_BuildValue("(ss)", it->first, it->second)); |
|---|
| 123 | } |
|---|
| 124 | $result = list; |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | |
|---|
| 128 | %typemap(argout) struct ph_hdr_list *{ |
|---|
| 129 | $result = make_hdrlist($1); |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | %typemap(directorin) const phSubscriptionStateInfo_t * { |
|---|
| 134 | |
|---|
| 135 | $input = Py_BuildValue("iisso", $1_name->event, $1_name->status, $1_name->from, $1_name->to, make_hdrlist(&$1_name->hlist)); |
|---|
| 136 | |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | %typemap(directorin) const phMsgStateInfo_t * { |
|---|
| 141 | |
|---|
| 142 | $input = Py_BuildValue("iissssssio", $1_name->event, $1_name->status, $1_name->from, $1_name->to, |
|---|
| 143 | $1_name->ctype, $1_name->subtype, $1_name->content, $1_name->rawctt, $1_name->cid, |
|---|
| 144 | make_hdrlist(&$1_name->hlist)); |
|---|
| 145 | |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | %typemap(directorin) const pCallStateInfo_t * { |
|---|
| 150 | |
|---|
| 151 | $input = Py_BuildValue("isiiiissiiso", $1_name->event, $1_name->localUri, $1_name->newcid, $1_name->oldcid, |
|---|
| 152 | $1_name->vlid, $1_name->streams, $1_name->callinfo, $1_name->remoteUri, $1_name->errorCode, |
|---|
| 153 | $1_name->dtmfDigit, $1_name->remoteSdp, |
|---|
| 154 | make_hdrlist(&$1_name->hlist)); |
|---|
| 155 | |
|---|
| 156 | } |
|---|
| 157 | |
|---|
| 158 | #endif |
|---|
| 159 | |
|---|
| 160 | #ifndef SWIGPYTHON |
|---|
| 161 | namespace std { |
|---|
| 162 | %template(pStrMap) map<char*, char *>; |
|---|
| 163 | %template(pcStrPair) pair<const char*, const char*>; |
|---|
| 164 | %template(pcStrVec) vector<pair<const char*, const char *> >; |
|---|
| 165 | } |
|---|
| 166 | #endif |
|---|
| 167 | |
|---|
| 168 | #if 0 |
|---|
| 169 | enum ph_subs_type |
|---|
| 170 | { |
|---|
| 171 | PH_SUBS_PRESENCE, /* regular presence events */ |
|---|
| 172 | PH_SUBS_WINFO, /* presence+watcher info */ |
|---|
| 173 | PH_SUBS_PRESENCE_LIST, /* batched presence notifications */ |
|---|
| 174 | PH_SUBS_CONFLIST, /* server based conference list */ |
|---|
| 175 | PH_SUBS_SIPPROFILE, /* server based contact list */ |
|---|
| 176 | PH_SUBS_ADDRBOOK_QRY /* query the addressbook for a contact list */ |
|---|
| 177 | }; |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | /** |
|---|
| 181 | * @enum phCallStateEvent |
|---|
| 182 | * @brief call progress events. |
|---|
| 183 | * |
|---|
| 184 | */ |
|---|
| 185 | enum phCallStateEvent { |
|---|
| 186 | phDIALING, phRINGING, phNOANSWER, phCALLBUSY, |
|---|
| 187 | phCALLREDIRECTED, phCALLOK, phCALLHELD, phINCALLREADY, |
|---|
| 188 | phCALLRESUMED, phHOLDOK, phRESUMEOK, phINCALL, |
|---|
| 189 | phCALLCLOSED, phCALLERROR, phDTMF, phXFERPROGRESS, |
|---|
| 190 | phXFEROK, phXFERFAIL, phXFERREQ, phCALLREPLACED, |
|---|
| 191 | phRINGandSTART, phRINGandSTOP, phCALLCLOSEDandSTOPRING |
|---|
| 192 | }; |
|---|
| 193 | /** |
|---|
| 194 | * @struct phCallStateInfo |
|---|
| 195 | */ |
|---|
| 196 | struct phCallStateInfo_t { |
|---|
| 197 | enum phCallStateEvent event; |
|---|
| 198 | void *userData; /*!< used to match placeCall with callbacks */ |
|---|
| 199 | const char *localUri; /*!< valid for all events execpt CALLCLOSED and DTMF */ |
|---|
| 200 | int newcid; /*!< valid for CALLREPLACED and XFERREQ */ |
|---|
| 201 | int oldcid; /*!< in case of CALL OK specifies the old CALL which was target of XFRERREQ */ |
|---|
| 202 | int vlid; /*!< virtual line id */ |
|---|
| 203 | int streams; /*!< proposed (for phINCALL) and active (for other events) streams for the call */ |
|---|
| 204 | char *callinfo; /*! pointer to Call-Info header value if available */ |
|---|
| 205 | const char *remoteUri; /*!< valid for all events execpt CALLCLOSED, DTMF and CALLERROR */ |
|---|
| 206 | int errorCode; /*!< valid for CALLERROR */ |
|---|
| 207 | int dtmfDigit; /*!< valid for DTMF */ |
|---|
| 208 | const char *remoteSdp; |
|---|
| 209 | }; |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | /** |
|---|
| 213 | * @enum phMsgEvent |
|---|
| 214 | */ |
|---|
| 215 | enum phMsgEvent { |
|---|
| 216 | phMsgNew, phMsgOk, phMsgError |
|---|
| 217 | }; |
|---|
| 218 | /** |
|---|
| 219 | * @struct phMsgStateInfo |
|---|
| 220 | */ |
|---|
| 221 | struct phMsgStateInfo_t { |
|---|
| 222 | enum phMsgEvent event; |
|---|
| 223 | int status; |
|---|
| 224 | const char *from; |
|---|
| 225 | const char *to; |
|---|
| 226 | const char *ctype; |
|---|
| 227 | const char *subtype; |
|---|
| 228 | const char *content; |
|---|
| 229 | const char *rawctt; |
|---|
| 230 | int cid; /*!< when non-zero this is message inside a dialog corresponding to call 'cid' */ |
|---|
| 231 | }; |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | /** |
|---|
| 235 | * @enum phSubscriptionEvent |
|---|
| 236 | */ |
|---|
| 237 | enum phSubscriptionEvent { |
|---|
| 238 | phSubscriptionOk, phSubscriptionErrNotFound, phSubscriptionError |
|---|
| 239 | }; |
|---|
| 240 | /** |
|---|
| 241 | * @struct phSubscriptionStateInfo |
|---|
| 242 | */ |
|---|
| 243 | struct phSubscriptionStateInfo_t { |
|---|
| 244 | enum phSubscriptionEvent event; |
|---|
| 245 | int status; |
|---|
| 246 | char *from; |
|---|
| 247 | char *to; |
|---|
| 248 | }; |
|---|
| 249 | |
|---|
| 250 | struct phPicture |
|---|
| 251 | { |
|---|
| 252 | int width,height; |
|---|
| 253 | void *planes[4]; |
|---|
| 254 | int strides[4]; |
|---|
| 255 | }; |
|---|
| 256 | |
|---|
| 257 | |
|---|
| 258 | /** |
|---|
| 259 | * @struct phVideoFrameReceivedEvent |
|---|
| 260 | */ |
|---|
| 261 | struct phVideoFrameReceivedEvent_t { |
|---|
| 262 | struct phPicture *frame_remote; |
|---|
| 263 | struct phPicture *frame_local; |
|---|
| 264 | }; |
|---|
| 265 | |
|---|
| 266 | |
|---|
| 267 | /** |
|---|
| 268 | * @enum phConfEvent |
|---|
| 269 | */ |
|---|
| 270 | enum phConfEvent { |
|---|
| 271 | phCONFCREATED, /* conference is created */ |
|---|
| 272 | phCONFJOINED, /* memeber joined a the conferences */ |
|---|
| 273 | phCONFLEFT, /* member left a conference */ |
|---|
| 274 | phCONFCLOSED, /* coneference closed */ |
|---|
| 275 | phCONFJOINERROR, /* error joining a member to a conference */ |
|---|
| 276 | phCONFERROR /* generic error */ |
|---|
| 277 | }; |
|---|
| 278 | /** |
|---|
| 279 | * @enum phConfStateInfo |
|---|
| 280 | */ |
|---|
| 281 | struct phConfStateInfo_t { |
|---|
| 282 | int confEvent; |
|---|
| 283 | int memberCid; /* call id's for the calls participating in the conference */ |
|---|
| 284 | /* valid for CONFJOINED,CONFLEFT,CONFJOINERROR events */ |
|---|
| 285 | int errorCode; |
|---|
| 286 | }; |
|---|
| 287 | |
|---|
| 288 | /** |
|---|
| 289 | * @struct phVideoConfig |
|---|
| 290 | */ |
|---|
| 291 | |
|---|
| 292 | |
|---|
| 293 | /** |
|---|
| 294 | * @struct ph_videoconfig_s |
|---|
| 295 | * @brief temporary structure that holds codec config, to be set from GUI |
|---|
| 296 | */ |
|---|
| 297 | struct ph_videoconfig_s { |
|---|
| 298 | #define PHAPI_VIDEO_LINE_50KBPS 0 |
|---|
| 299 | #define PHAPI_VIDEO_LINE_64KBPS 1 |
|---|
| 300 | #define PHAPI_VIDEO_LINE_128KBPS 2 |
|---|
| 301 | #define PHAPI_VIDEO_LINE_256KBPS 3 |
|---|
| 302 | #define PHAPI_VIDEO_LINE_512KBPS 4 |
|---|
| 303 | #define PHAPI_VIDEO_LINE_1024KBPS 5 |
|---|
| 304 | #define PHAPI_VIDEO_LINE_2048KBPS 6 |
|---|
| 305 | #define PHAPI_VIDEO_LINE_AUTOMATIC 5 |
|---|
| 306 | int video_fps; |
|---|
| 307 | int video_camera_flip_frame; |
|---|
| 308 | int video_max_frame_size; |
|---|
| 309 | int video_webcam_capture_width; /** width x height for capture must be given. 320x240 is a good guess */ |
|---|
| 310 | int video_webcam_capture_height; |
|---|
| 311 | int video_line_configuration; |
|---|
| 312 | int video_codec_max_bitrate; |
|---|
| 313 | int video_codec_min_bitrate; |
|---|
| 314 | char video_device[256]; |
|---|
| 315 | }; |
|---|
| 316 | |
|---|
| 317 | struct ph_config_s { |
|---|
| 318 | char local_ip_addr[16]; /*!< ip address to use in case of muti-homed setup */ |
|---|
| 319 | char local_audio_rtp_port[16]; /*!< port number used for RTP data */ |
|---|
| 320 | char local_audio_rtcp_port[16]; /*!< port number used for RTCP data */ |
|---|
| 321 | char local_audio_rtp_port_max[16]; /*!< maximal port number used for RTP data */ |
|---|
| 322 | char local_audio_rtcp_port_max[16]; /*!< maximal port number used for RTCP data */ |
|---|
| 323 | char local_video_rtp_port[16]; /*!< port number used for video RTP data */ |
|---|
| 324 | char local_video_rtcp_port[16]; /*!< port number used for video RTCP data */ |
|---|
| 325 | |
|---|
| 326 | char sipport[16]; /*!< sip port number */ |
|---|
| 327 | int transport; /*!< sip transport */ |
|---|
| 328 | char nattype[16]; /*!< nat type (auto,none,fcone,rcone,prcone,sym) */ |
|---|
| 329 | char audio_codecs[128]; /*!< comma separate list of codecs in order of priority */ |
|---|
| 330 | char video_codecs[128]; /*!< comma separate list of codecs in order of priority */ |
|---|
| 331 | /* example: PCMU,PCMA,GSM,ILBC,SPEEX */ |
|---|
| 332 | |
|---|
| 333 | int asyncmode; /*!< when true phApi creates a separate eXosip polling thread... in client/server mode MUST be TRUE */ |
|---|
| 334 | char audio_dev[64]; /*!< audio device identifier */ |
|---|
| 335 | /* example: IN=2 OUT=1 ; 2 is input device and 1 is ouput device */ |
|---|
| 336 | int softboost; /* to be removed */ |
|---|
| 337 | int nomedia; |
|---|
| 338 | int noaec; /* when non-zero - disable aec */ |
|---|
| 339 | unsigned int vad; /* if bit31=1 DTX/VAD features activated and bits0-30 contains the power threshold */ |
|---|
| 340 | int cng; /* if 1, CNG feature will be negotiated */ |
|---|
| 341 | |
|---|
| 342 | // SPIKE_HDX: setting of hdxmode in phconfig |
|---|
| 343 | int hdxmode; /* if 0, half duplex mode is desactivated. otherwise check enum PH_HDX_MODES */ |
|---|
| 344 | |
|---|
| 345 | int nat_refresh_udp_time; /* timeout for udp sip address/port refresh (when 0 no-refresh) */ |
|---|
| 346 | int nat_refresh_tcp_time; /* timeout for tcp sip address/port refresh (when 0 no-refresh) */ |
|---|
| 347 | int nat_refresh_time_adjust;/* timeout adjustment (must be at most nat_refresh_time/2) nat_refresh_time */ |
|---|
| 348 | int ptime; /* default global ptime */ |
|---|
| 349 | int jitterdepth; /* jitter buffer depth in miliseconds (if 0 default of 60 msecs is used) */ |
|---|
| 350 | int stream_timeout; /* max allowed latency before timeout in second, 0 or -1 to disable */ |
|---|
| 351 | int nodefaultline; /* temporary hack for implementing backward compatibility... Don't touch it */ |
|---|
| 352 | int autoredir; /*!< when NONZERO the redirect requests will be automatically executed by phApi |
|---|
| 353 | the new CID will be deliverd in newcid field in the CALLREDIRECTED event */ |
|---|
| 354 | char stunserver[128]; /*!< stun server address:port or name:port */ |
|---|
| 355 | |
|---|
| 356 | #define PH_TUNNEL_SSL 4 |
|---|
| 357 | #define PH_TUNNEL_AUTOCONF 2 |
|---|
| 358 | #define PH_TUNNEL_USE 1 |
|---|
| 359 | int use_tunnel; |
|---|
| 360 | |
|---|
| 361 | char httpt_server[128]; |
|---|
| 362 | int httpt_server_port; |
|---|
| 363 | char http_proxy[128]; |
|---|
| 364 | int http_proxy_port; |
|---|
| 365 | char http_proxy_user[128]; |
|---|
| 366 | char http_proxy_passwd[128]; |
|---|
| 367 | #ifdef WIN32 |
|---|
| 368 | void* videoHandle; |
|---|
| 369 | #endif |
|---|
| 370 | |
|---|
| 371 | struct ph_videoconfig_s video_config; |
|---|
| 372 | char plugin_path[256]; /*!< where to look for plugin modules */ |
|---|
| 373 | int qos; /* QoS bits to add to TOS to : 0x2 min cost, 0x4 max reliability, 0x8 max throughput, 0x10 min delay */ |
|---|
| 374 | unsigned int hdxlevel; /* if bit31=1 HDX level is valid and bits0-30 contains the power threshold */ |
|---|
| 375 | |
|---|
| 376 | }; |
|---|
| 377 | #endif |
|---|
| 378 | |
|---|
| 379 | %feature("director") phapi; |
|---|
| 380 | |
|---|
| 381 | %include "phapi.h" |
|---|
| 382 | %include "phapipp.h" |
|---|