| 1 | #ifndef __PHAPIPP_H__ |
|---|
| 2 | #define __PHAPIPP_H__ 1 |
|---|
| 3 | |
|---|
| 4 | /* |
|---|
| 5 | The phapipp module implements thin C++ wrapper around phapi |
|---|
| 6 | Copyright (C) 2007 Vadim Lebedev <vadim@mbdsys.com> |
|---|
| 7 | |
|---|
| 8 | This library is free software; you can redistribute it and/or |
|---|
| 9 | modify it under the terms of the GNU Lesser General Public |
|---|
| 10 | License as published by the Free Software Foundation; either |
|---|
| 11 | version 2.1 of the License, or (at your option) any later version. |
|---|
| 12 | |
|---|
| 13 | This library is distributed in the hope that it will be useful, |
|---|
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 | Lesser General Public License for more details. |
|---|
| 17 | |
|---|
| 18 | You should have received a copy of the GNU Lesser General Public |
|---|
| 19 | License along with this library; if not, write to the Free Software |
|---|
| 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| 23 | #include <phapi.h> |
|---|
| 24 | #include <string> |
|---|
| 25 | #include <map> |
|---|
| 26 | #include <vector> |
|---|
| 27 | |
|---|
| 28 | /* |
|---|
| 29 | |
|---|
| 30 | This module declares: |
|---|
| 31 | 1/ phapi class which can be derived from or |
|---|
| 32 | used directly by the application. |
|---|
| 33 | |
|---|
| 34 | 2/ phapitp template class which can be used to simplify interface |
|---|
| 35 | with the code using C++ strings. |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | example using std::string is provided as a typedef stdphapi |
|---|
| 39 | |
|---|
| 40 | to use with QString one should do something like: |
|---|
| 41 | |
|---|
| 42 | struct qtenv { |
|---|
| 43 | typedef QString string; |
|---|
| 44 | static const char *cstr(const QString& str) { return str.toLatin(); } |
|---|
| 45 | }; |
|---|
| 46 | |
|---|
| 47 | typedef verona::phapitp<qtenv> QtPhapi; |
|---|
| 48 | |
|---|
| 49 | */ |
|---|
| 50 | |
|---|
| 51 | struct phMsgStateInfo2 { |
|---|
| 52 | enum phMsgEvent event; |
|---|
| 53 | int status; |
|---|
| 54 | const char *from; |
|---|
| 55 | const char *to; |
|---|
| 56 | const char *ctype; |
|---|
| 57 | const char *subtype; |
|---|
| 58 | const char *content; |
|---|
| 59 | const char *rawctt; |
|---|
| 60 | int tid; /*!< Trasnaction id of corresponding MESSAGE request */ |
|---|
| 61 | int cid; /*!< when non-zero this is message inside a dialog corresponding to call 'cid' */ |
|---|
| 62 | std::vector<std::pair<const char*, const char*> > hlist; |
|---|
| 63 | }; |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | namespace verona { |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | class phapi |
|---|
| 70 | { |
|---|
| 71 | |
|---|
| 72 | public: |
|---|
| 73 | |
|---|
| 74 | phapi(); |
|---|
| 75 | virtual ~phapi(); |
|---|
| 76 | |
|---|
| 77 | virtual int init(bool asyncMode = true); |
|---|
| 78 | virtual void terminate(); |
|---|
| 79 | |
|---|
| 80 | virtual int addAuthInfo(const char* username, const char* userid, const char* passwd, |
|---|
| 81 | const char *realm, const char* ha1 = 0); |
|---|
| 82 | |
|---|
| 83 | virtual int listenAddr(int local_sip_port); |
|---|
| 84 | |
|---|
| 85 | virtual int addVline(const char* displayname, const char* username, const char* host, |
|---|
| 86 | const char* proxy, int regTimeout, int mobility = PH_LINE_MOBILITY_DEFAULT); |
|---|
| 87 | |
|---|
| 88 | virtual int delVline(int vlid); |
|---|
| 89 | |
|---|
| 90 | virtual int vlRegister(int vlid); |
|---|
| 91 | |
|---|
| 92 | virtual int sendOptions(int vlid, const char *to); |
|---|
| 93 | |
|---|
| 94 | virtual int placeCall(int vlid, const char* uri, void* userdata =0 , int rcid = 0, int streams = PH_STREAM_AUDIO, |
|---|
| 95 | const char* adev = 0, const char* audio_addr = 0, const char* video_addr = 0); |
|---|
| 96 | |
|---|
| 97 | virtual int acceptCall(int cid, void* userData = 0, int streams = PH_STREAM_AUDIO, |
|---|
| 98 | const char* audio_addr = 0, const char* video_addr = 0); |
|---|
| 99 | |
|---|
| 100 | virtual int rejectCall(int cid, int reason, const char *uri = 0); |
|---|
| 101 | virtual int ringingCall(int cid); |
|---|
| 102 | virtual int closeCall(int cid); |
|---|
| 103 | virtual int holdCall(int cid); |
|---|
| 104 | virtual int resumeCall(int cid); |
|---|
| 105 | virtual int blindTransferCall(int cid, const char *uri); |
|---|
| 106 | |
|---|
| 107 | virtual int messageInCall(int cid, const char *buff, const char *mime); |
|---|
| 108 | virtual int getSipCallID(int cid, char *idbuf, int bufsize); |
|---|
| 109 | virtual int sendDtmf(int cid, int dtmfChar, int mode); |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | virtual int setFollowMe(int vlid, const char *uri); |
|---|
| 113 | virtual int setBusy(int vlid, bool busy); |
|---|
| 114 | virtual int sendMessage(int vlid, const char* to, const char* buff, const char* mime, |
|---|
| 115 | const char* target = 0, const char* sipcid = 0); |
|---|
| 116 | virtual int sendMessage3(int vlid, const char* to, const char* buff, const char* mime, |
|---|
| 117 | const std::vector<std::pair<const char*, const char* > >& hdrs, const char* target = 0); |
|---|
| 118 | |
|---|
| 119 | virtual int subscribe(int vlid, const char* to, int winfo, int use_proxy = 1, int expire = 600, |
|---|
| 120 | const std::vector<std::pair<const char*, const char* > >* hdrs = 0); |
|---|
| 121 | virtual int unsubscribe(int sid, int winfo); |
|---|
| 122 | virtual int publish(int vlid, const char* to, const char* evt, const char* ctt, const char* content, |
|---|
| 123 | int expires = -1); |
|---|
| 124 | int unpublish(int vlid, const char* to, const char* evt) |
|---|
| 125 | { |
|---|
| 126 | return publish(vlid, to, evt, 0, 0, 0); |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | virtual int getLineSipAddress(int vlid, char *buf, int size); |
|---|
| 130 | virtual int mobility(int vlid); |
|---|
| 131 | virtual int setUsername2(int vlid, const char* username); |
|---|
| 132 | |
|---|
| 133 | int getVersion() { return phGetVersion(); } |
|---|
| 134 | const char * getRevision() { return phGetRevision(); } |
|---|
| 135 | struct ph_config_s* getConfig() { return ph_get_config(); } |
|---|
| 136 | |
|---|
| 137 | void changeAudioCodecList(const char *audio_codecs); |
|---|
| 138 | void changeVideoCodecList(const char *video_codecs); |
|---|
| 139 | void changeLocalIP(const char *local_ip); |
|---|
| 140 | |
|---|
| 141 | int addCustomHeader(const char *reqnames, const char *hdrname, const char *hdrval) |
|---|
| 142 | { |
|---|
| 143 | return phAddCustomization(reqnames, hdrname, hdrval); |
|---|
| 144 | } |
|---|
| 145 | |
|---|
| 146 | int enableCustomization(int ruleId, int enable) |
|---|
| 147 | { |
|---|
| 148 | return phEnableCustomization(ruleId, enable); |
|---|
| 149 | } |
|---|
| 150 | |
|---|
| 151 | int monitorHeader(const char *reqnames, const char *hdrname) |
|---|
| 152 | { |
|---|
| 153 | return phMonitorHeader(reqnames, hdrname); |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | int enableMonitor(int ruleID, int enable) { return phEnableMonitor(ruleID, enable); } |
|---|
| 158 | |
|---|
| 159 | void resetMonitoring() { phResetMonitoring(); } |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | #if defined(_WIN32_WCE) |
|---|
| 163 | #ifdef SWIG |
|---|
| 164 | %newobject getLocalIpFromDescription; |
|---|
| 165 | #endif |
|---|
| 166 | char * getLocalIpFromDescription(const char *description); |
|---|
| 167 | #endif |
|---|
| 168 | virtual void setUaString(const char *uastr); |
|---|
| 169 | |
|---|
| 170 | #ifdef SWIG |
|---|
| 171 | %newobject getAudioCaptureDevices; |
|---|
| 172 | %newobject getAudioPlaybackDevices; |
|---|
| 173 | %newobject getVideoWebcamDevices; |
|---|
| 174 | #endif |
|---|
| 175 | |
|---|
| 176 | virtual std::map<char*, char*> getAudioCaptureDevices(); |
|---|
| 177 | virtual std::map<char*, char*> getAudioPlaybackDevices(); |
|---|
| 178 | virtual std::map<char*, char*> getVideoWebcamDevices(); |
|---|
| 179 | |
|---|
| 180 | virtual void changeAudioDeviceIn(const char *devstr); |
|---|
| 181 | virtual void changeAudioDeviceOut(const char *devstr); |
|---|
| 182 | virtual void changeVideoDevices(const char *devstr); |
|---|
| 183 | |
|---|
| 184 | virtual int setSoftRecvVolumeGain(int cid, float gain); |
|---|
| 185 | virtual int setSoftSendVolumeGain(int cid, float gain); |
|---|
| 186 | virtual int setRecvVolumeLevel(int cid, int level); |
|---|
| 187 | virtual int setSendVolumeLevel(int cid, int level); |
|---|
| 188 | virtual int mutePlayback(int cid, int val); |
|---|
| 189 | virtual int muteCapture(int cid, int val); |
|---|
| 190 | |
|---|
| 191 | virtual int setSoundFileGain(phStream* phstream,float gain); |
|---|
| 192 | virtual phStream * playSoundFile(const char * filename, int interval, const char* deviceid); |
|---|
| 193 | virtual int stopSoundFile(phStream * phstream); |
|---|
| 194 | virtual phStream * videoStartPreview(const char* deviceid); |
|---|
| 195 | virtual int videoStopPreview(phStream * phstream); |
|---|
| 196 | virtual int videoSetDefaultImage(const char* path); |
|---|
| 197 | |
|---|
| 198 | virtual int poll(); |
|---|
| 199 | virtual void refresh(); |
|---|
| 200 | |
|---|
| 201 | int getDebugLevel() { return phGetDebugLevel(); } |
|---|
| 202 | void setDebugLevel(int lvl) { phSetDebugLevel(lvl); } |
|---|
| 203 | |
|---|
| 204 | virtual void setLogFile(const char* logFile); |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | protected: |
|---|
| 208 | |
|---|
| 209 | // user overridable callbacks |
|---|
| 210 | virtual void onCallProgress(int cid, const phCallStateInfo_t *info); |
|---|
| 211 | virtual void onTransferProgress(int cid, const phTransferStateInfo_t *info); |
|---|
| 212 | virtual void onConfProgress(int cfid, const phConfStateInfo_t *info); |
|---|
| 213 | virtual void onRegProgress(int regid, int status); |
|---|
| 214 | virtual void onMsgProgress(int mid, const phMsgStateInfo *info); |
|---|
| 215 | virtual void onMsgProgress2(int mid, char * type, char * content); |
|---|
| 216 | virtual void onConnectionLost(const char* host, int port); |
|---|
| 217 | #if defined(_WIN32_WCE) |
|---|
| 218 | virtual void onNotifyProgress (const char* ev, const char* from, const char *ctt, wchar_t* content); |
|---|
| 219 | #else |
|---|
| 220 | virtual void onNotifyProgress (const char* ev, const char* from, const char *ctt, const char* content); |
|---|
| 221 | #endif |
|---|
| 222 | virtual void onSubscriptionProgress(int sid, const phSubscriptionStateInfo_t *info); |
|---|
| 223 | virtual void onFrameReady(int cid, phVideoFrameReceivedEvent_t *ev); |
|---|
| 224 | |
|---|
| 225 | #if defined(_WIN32_WCE) |
|---|
| 226 | virtual void onCallProgress2(int cid, phCallStateEvent status, wchar_t * uri, int error); |
|---|
| 227 | #else |
|---|
| 228 | virtual void onCallProgress2(int cid, phCallStateEvent status, char * uri, int error); |
|---|
| 229 | #endif |
|---|
| 230 | virtual void onDtmfProgress(int cid, int dtmf); |
|---|
| 231 | virtual void onPhLogCsl(const char *msg); |
|---|
| 232 | virtual void onSoundFileStopped(void *userdata , unsigned int _id, void *arg); |
|---|
| 233 | virtual void onQosEvent(int cid, const phQosInfo_t * info); |
|---|
| 234 | |
|---|
| 235 | |
|---|
| 236 | private: |
|---|
| 237 | |
|---|
| 238 | #ifndef SWIG |
|---|
| 239 | static phCallbacks_t callbacks; |
|---|
| 240 | |
|---|
| 241 | static void callProgress(int cid, const phCallStateInfo_t *info); |
|---|
| 242 | static void transferProgress(int cid, const phTransferStateInfo_t *info); |
|---|
| 243 | static void confProgress(int cfid, const phConfStateInfo_t *info); |
|---|
| 244 | static void regProgress(int regid, int status); |
|---|
| 245 | static void msgProgress(int mid, const phMsgStateInfo_t *info); |
|---|
| 246 | static void connectionLost(const char* host, int port); |
|---|
| 247 | static void notifyProgress(const char* ev, const char* from, const char *ctt, const char* content); |
|---|
| 248 | static void subscriptionProgress(int sid, const phSubscriptionStateInfo_t *info); |
|---|
| 249 | static void frameReady(int cid, phVideoFrameReceivedEvent_t *ev); |
|---|
| 250 | static void phLogCsl(const char *msg); |
|---|
| 251 | static void soundFileStopped(void *userdata , unsigned int _id, void *arg); |
|---|
| 252 | static void qosEvent(int cid, const phQosInfo_t * info); |
|---|
| 253 | #endif |
|---|
| 254 | |
|---|
| 255 | }; |
|---|
| 256 | |
|---|
| 257 | #ifndef SWIG |
|---|
| 258 | //#define phthis ((phapi *) this) |
|---|
| 259 | template<class Env> |
|---|
| 260 | class phapitp: public phapi |
|---|
| 261 | { |
|---|
| 262 | public: |
|---|
| 263 | |
|---|
| 264 | typedef typename Env::string string; |
|---|
| 265 | |
|---|
| 266 | static inline const char *cstr(const string& s) { return Env::cstr(s); } |
|---|
| 267 | |
|---|
| 268 | virtual ~phapitp(){}; |
|---|
| 269 | |
|---|
| 270 | int addAuthInfo(const string &username, const string& userid, const string& passwd, const char* realm) |
|---|
| 271 | { |
|---|
| 272 | return phapi::addAuthInfo(cstr(username), cstr(userid), cstr(passwd), realm); |
|---|
| 273 | } |
|---|
| 274 | |
|---|
| 275 | int addAuthInfo(const string &username, const string& userid, const string&passwd, const char* realm, |
|---|
| 276 | const string& ha1) |
|---|
| 277 | { |
|---|
| 278 | return phapi::addAuthInfo(cstr(username), cstr(userid), cstr(passwd), realm, cstr(ha1)); |
|---|
| 279 | } |
|---|
| 280 | int listenAddr(int local_sip_port) |
|---|
| 281 | { |
|---|
| 282 | return phapi::listenAddr(local_sip_port); |
|---|
| 283 | } |
|---|
| 284 | |
|---|
| 285 | int addVline(const string& displayname, const string& username, const string& host, |
|---|
| 286 | const string& proxy, int regTimeout, int mobility = PH_LINE_MOBILITY_DEFAULT) |
|---|
| 287 | { |
|---|
| 288 | return phapi::addVline(cstr(displayname), cstr(username), cstr(host), cstr(proxy), regTimeout, mobility); |
|---|
| 289 | } |
|---|
| 290 | |
|---|
| 291 | int vlRegister(int vlid) |
|---|
| 292 | { |
|---|
| 293 | return phvlRegister(vlid); |
|---|
| 294 | } |
|---|
| 295 | |
|---|
| 296 | int sendOptions(int vlid, const string& to) |
|---|
| 297 | { |
|---|
| 298 | return phapi::sendOptions(vlid, cstr(to)); |
|---|
| 299 | } |
|---|
| 300 | |
|---|
| 301 | |
|---|
| 302 | int placeCall(int vlid, const string& uri, void* userdata = 0, int rcid =0 , int streams = PH_STREAM_AUDIO, |
|---|
| 303 | const char* adev = 0, const char* audio_addr = 0, const char* video_addr = 0) |
|---|
| 304 | { |
|---|
| 305 | return phapi::placeCall(vlid, cstr(uri), userdata, rcid, streams, adev, audio_addr, video_addr); |
|---|
| 306 | } |
|---|
| 307 | |
|---|
| 308 | |
|---|
| 309 | |
|---|
| 310 | int rejectCall(int cid, int reason, const string& uri) |
|---|
| 311 | { |
|---|
| 312 | return phapi::rejectCall(cid, reason, cstr(uri)); |
|---|
| 313 | } |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | |
|---|
| 317 | int messageInCall(int cid, const string& mime, const string& buf) |
|---|
| 318 | { |
|---|
| 319 | return phapi::messageInCall(cid, cstr(mime), cstr(buf)); |
|---|
| 320 | } |
|---|
| 321 | |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | |
|---|
| 325 | int setFollowMe(int vlid, const string& uri) |
|---|
| 326 | { |
|---|
| 327 | return phapi::setFollowMe(vlid, cstr(uri)); |
|---|
| 328 | } |
|---|
| 329 | |
|---|
| 330 | |
|---|
| 331 | |
|---|
| 332 | string getSipCallID(int cid) |
|---|
| 333 | { |
|---|
| 334 | char buf[256]; |
|---|
| 335 | |
|---|
| 336 | phapi::getSipCallID(cid, buf, sizeof(buf)); |
|---|
| 337 | |
|---|
| 338 | return buf; |
|---|
| 339 | } |
|---|
| 340 | |
|---|
| 341 | |
|---|
| 342 | string getSipAddress(int vlid) |
|---|
| 343 | { |
|---|
| 344 | char buf[256]; |
|---|
| 345 | |
|---|
| 346 | phapi::getLineSipAddress(vlid, buf, sizeof(buf)); |
|---|
| 347 | |
|---|
| 348 | return buf; |
|---|
| 349 | } |
|---|
| 350 | |
|---|
| 351 | |
|---|
| 352 | |
|---|
| 353 | int sendMessage(int vlid, const string& to, const string& buff, |
|---|
| 354 | const string& mime, |
|---|
| 355 | const string& target, const string& sipcid) |
|---|
| 356 | { |
|---|
| 357 | return phapi::sendMessage(vlid, cstr(to), cstr(buff), cstr(mime), cstr(target), cstr(sipcid)); |
|---|
| 358 | } |
|---|
| 359 | |
|---|
| 360 | |
|---|
| 361 | int sendMessage(int vlid, const string& to, const string& buff, |
|---|
| 362 | const string& mime, const string& target) |
|---|
| 363 | { |
|---|
| 364 | return phapi::sendMessage(vlid, cstr(to), cstr(buff), cstr(mime), cstr(target), 0); |
|---|
| 365 | } |
|---|
| 366 | |
|---|
| 367 | |
|---|
| 368 | |
|---|
| 369 | int sendMessage(int vlid, const string& to, const string& buff, const string& mime) |
|---|
| 370 | { |
|---|
| 371 | return phapi::sendMessage(vlid, cstr(to), cstr(buff), cstr(mime), 0, 0); |
|---|
| 372 | } |
|---|
| 373 | |
|---|
| 374 | |
|---|
| 375 | |
|---|
| 376 | int subscribe(int vlid, const string& to, int winfo, int use_proxy = 1, int expire = 600) |
|---|
| 377 | { |
|---|
| 378 | return phapi::subscribe(vlid, cstr(to), winfo, data, use_proxy, expire); |
|---|
| 379 | } |
|---|
| 380 | |
|---|
| 381 | int unsubscribe(int sid, int winfo) |
|---|
| 382 | { |
|---|
| 383 | return phapi::unsubscribe(sid, winfo); |
|---|
| 384 | } |
|---|
| 385 | |
|---|
| 386 | int publish(int vlid, const string& to, const string& evt, const string& ctt, |
|---|
| 387 | const string& content, int expires = -1) |
|---|
| 388 | { |
|---|
| 389 | return phapi::publish(vlid, cstr(to), cstr(evt), cstr(ctt), cstr(content), expires); |
|---|
| 390 | } |
|---|
| 391 | |
|---|
| 392 | int unpublish(int vlid, const string& to, const string& evt) |
|---|
| 393 | { |
|---|
| 394 | return phapi::unpublish(vlid, cstr(to), cstr(evt)); |
|---|
| 395 | } |
|---|
| 396 | |
|---|
| 397 | std::map<char*, char*> getAudioCaptureDevices() |
|---|
| 398 | { |
|---|
| 399 | return phapi::getAudioCaptureDevices(); |
|---|
| 400 | } |
|---|
| 401 | |
|---|
| 402 | std::map<char*, char*> getAudioPlaybackDevices() |
|---|
| 403 | { |
|---|
| 404 | return phapi::getAudioPlaybackDevices(); |
|---|
| 405 | } |
|---|
| 406 | |
|---|
| 407 | int setSoftRecvVolumeGain(int cid, float gain) |
|---|
| 408 | { |
|---|
| 409 | return phapi::setSoftRecvVolumeGain(cid, gain); |
|---|
| 410 | } |
|---|
| 411 | |
|---|
| 412 | int setSoftSendVolumeGain(int cid, float gain) |
|---|
| 413 | { |
|---|
| 414 | return phapi::setSoftSendVolumeGain(cid, gain); |
|---|
| 415 | } |
|---|
| 416 | |
|---|
| 417 | int setRecvVolumeLevel(int cid, int level) |
|---|
| 418 | { |
|---|
| 419 | return phapi::setRecvVolumeLevel(cid, level); |
|---|
| 420 | } |
|---|
| 421 | |
|---|
| 422 | int setSendVolumeLevel(int cid, int level) |
|---|
| 423 | { |
|---|
| 424 | return phapi::setSendVolumeLevel(cid, level); |
|---|
| 425 | } |
|---|
| 426 | |
|---|
| 427 | int mutePlayback(int cid, int val) |
|---|
| 428 | { |
|---|
| 429 | return phapi::mutePlayback(cid, val); |
|---|
| 430 | } |
|---|
| 431 | |
|---|
| 432 | int muteCapture(int cid, int val) |
|---|
| 433 | { |
|---|
| 434 | return phapi::muteCapture(cid, val); |
|---|
| 435 | } |
|---|
| 436 | |
|---|
| 437 | int addCustomHeader(const string& reqnames, const string& hdrname, const string& hdrval) |
|---|
| 438 | { |
|---|
| 439 | return phapi::addCustomHeader(cstr(reqnames), cstr(hdrname), cstr(hdrval)); |
|---|
| 440 | } |
|---|
| 441 | |
|---|
| 442 | int monitorHeader(const string& reqnames, const string& hdrname) |
|---|
| 443 | { |
|---|
| 444 | return phapi::monitorHeader(cstr(reqnames), cstr(hdrname)); |
|---|
| 445 | } |
|---|
| 446 | |
|---|
| 447 | |
|---|
| 448 | |
|---|
| 449 | void setUaString(const string& ua) { phapi::setUaString(cstr(ua)); } |
|---|
| 450 | void changeAudioDeviceIn(const string& devstr) { phapi::changeAudioDeviceIn(cstr(devstr)); } |
|---|
| 451 | void changeAudioDeviceOut(const string& devstr) { phapi::changeAudioDeviceOut(cstr(devstr)); } |
|---|
| 452 | void changeAudioCodecList(const string& audio_codecs) |
|---|
| 453 | { |
|---|
| 454 | phapi::changeAudioCodecList(cstr(audio_codecs)); |
|---|
| 455 | } |
|---|
| 456 | void changeLocalIP(const string& local_ip) |
|---|
| 457 | { |
|---|
| 458 | phapi::changeLocalIP(cstr(local_ip)); |
|---|
| 459 | } |
|---|
| 460 | |
|---|
| 461 | void setLogFile(const string& logfile) { phapi::setLogFile(cstr(logfile)); } |
|---|
| 462 | |
|---|
| 463 | |
|---|
| 464 | protected: |
|---|
| 465 | |
|---|
| 466 | }; |
|---|
| 467 | |
|---|
| 468 | //#undef phthis |
|---|
| 469 | |
|---|
| 470 | class stdenv |
|---|
| 471 | { |
|---|
| 472 | public: |
|---|
| 473 | typedef std::string string; |
|---|
| 474 | static const char *cstr(const string& s) { if (&s != NULL) return s.c_str(); else return NULL; } |
|---|
| 475 | |
|---|
| 476 | |
|---|
| 477 | }; |
|---|
| 478 | |
|---|
| 479 | |
|---|
| 480 | // decalare a wrapper using std::string |
|---|
| 481 | typedef phapitp<stdenv> stdphapi; |
|---|
| 482 | #endif |
|---|
| 483 | |
|---|
| 484 | } |
|---|
| 485 | |
|---|
| 486 | #endif /* __PHAPIPP_H__ */ |
|---|