media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCallInfo.cpp

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "CSFLog.h"
michael@0 6
michael@0 7 #include "CC_Common.h"
michael@0 8
michael@0 9 #include "CC_SIPCCCallInfo.h"
michael@0 10 #include "CC_SIPCCLine.h"
michael@0 11
michael@0 12 extern "C"
michael@0 13 {
michael@0 14 #include "ccapi_call.h"
michael@0 15 #include "ccapi_call_info.h"
michael@0 16 #include "fsmdef_states.h"
michael@0 17 }
michael@0 18
michael@0 19 static const char* logTag = "CC_SIPCCCallInfo";
michael@0 20
michael@0 21 using namespace std;
michael@0 22 using namespace CSF;
michael@0 23
michael@0 24 CC_SIPCCCallInfo::CC_SIPCCCallInfo (cc_callinfo_ref_t callinfo) : callinfo_ref(callinfo)
michael@0 25 {
michael@0 26 CCAPI_Call_retainCallInfo(callinfo);
michael@0 27 }
michael@0 28
michael@0 29 CSF_IMPLEMENT_WRAP(CC_SIPCCCallInfo, cc_callinfo_ref_t);
michael@0 30
michael@0 31 CC_SIPCCCallInfo::~CC_SIPCCCallInfo()
michael@0 32 {
michael@0 33 CCAPI_Call_releaseCallInfo(callinfo_ref);
michael@0 34 }
michael@0 35
michael@0 36 bool CC_SIPCCCallInfo::hasCapability (CC_CallCapabilityEnum::CC_CallCapability capability)
michael@0 37 {
michael@0 38 generateCapabilities();
michael@0 39 return (caps.find(capability) != caps.end());
michael@0 40 }
michael@0 41
michael@0 42 set<CC_CallCapabilityEnum::CC_CallCapability> CC_SIPCCCallInfo::getCapabilitySet()
michael@0 43 {
michael@0 44 generateCapabilities();
michael@0 45 set<CC_CallCapabilityEnum::CC_CallCapability> callCaps(caps);
michael@0 46 return callCaps;
michael@0 47 }
michael@0 48
michael@0 49 /*
michael@0 50 CC_LinePtr CC_SIPCCCallInfo::getLine ()
michael@0 51 {
michael@0 52 }
michael@0 53 */
michael@0 54
michael@0 55 cc_call_state_t CC_SIPCCCallInfo::getCallState()
michael@0 56 {
michael@0 57 return CCAPI_CallInfo_getCallState(callinfo_ref);
michael@0 58 }
michael@0 59
michael@0 60 fsmdef_states_t CC_SIPCCCallInfo::getFsmState() const
michael@0 61 {
michael@0 62 return CCAPI_CallInfo_getFsmState(callinfo_ref);
michael@0 63 }
michael@0 64
michael@0 65 std::string CC_SIPCCCallInfo::fsmStateToString (fsmdef_states_t state) const
michael@0 66 {
michael@0 67 return fsmdef_state_name(state);
michael@0 68 }
michael@0 69
michael@0 70 std::string CC_SIPCCCallInfo::callStateToString (cc_call_state_t state)
michael@0 71 {
michael@0 72 std::string statestr = "";
michael@0 73
michael@0 74 switch(state) {
michael@0 75 case OFFHOOK:
michael@0 76 statestr = "OFFHOOK";
michael@0 77 break;
michael@0 78 case ONHOOK:
michael@0 79 statestr = "ONHOOK";
michael@0 80 break;
michael@0 81 case RINGOUT:
michael@0 82 statestr = "RINGOUT";
michael@0 83 break;
michael@0 84 case RINGIN:
michael@0 85 statestr = "RINGIN";
michael@0 86 break;
michael@0 87 case PROCEED:
michael@0 88 statestr = "PROCEED";
michael@0 89 break;
michael@0 90 case CONNECTED:
michael@0 91 statestr = "CONNECTED";
michael@0 92 break;
michael@0 93 case HOLD:
michael@0 94 statestr = "ONHOOK";
michael@0 95 break;
michael@0 96 case REMHOLD:
michael@0 97 statestr = "REMHOLD";
michael@0 98 break;
michael@0 99 case RESUME:
michael@0 100 statestr = "RESUME";
michael@0 101 break;
michael@0 102 case BUSY:
michael@0 103 statestr = "BUSY";
michael@0 104 break;
michael@0 105 case REORDER:
michael@0 106 statestr = "REORDER";
michael@0 107 break;
michael@0 108 case CONFERENCE:
michael@0 109 statestr = "CONFERENCE";
michael@0 110 break;
michael@0 111 case DIALING:
michael@0 112 statestr = "DIALING";
michael@0 113 break;
michael@0 114 case REMINUSE:
michael@0 115 statestr = "REMINUSE";
michael@0 116 break;
michael@0 117 case HOLDREVERT:
michael@0 118 statestr = "HOLDREVERT";
michael@0 119 break;
michael@0 120 case WHISPER:
michael@0 121 statestr = "WHISPER";
michael@0 122 break;
michael@0 123 case PRESERVATION:
michael@0 124 statestr = "PRESERVATION";
michael@0 125 break;
michael@0 126 case WAITINGFORDIGITS:
michael@0 127 statestr = "WAITINGFORDIGITS";
michael@0 128 break;
michael@0 129 case CREATEOFFERSUCCESS:
michael@0 130 statestr = "CREATEOFFERSUCCESS";
michael@0 131 break;
michael@0 132 case CREATEANSWERSUCCESS:
michael@0 133 statestr = "CREATEANSWERSUCCESS";
michael@0 134 break;
michael@0 135 case CREATEOFFERERROR:
michael@0 136 statestr = "CREATEOFFERERROR";
michael@0 137 break;
michael@0 138 case CREATEANSWERERROR:
michael@0 139 statestr = "CREATEANSWERERROR";
michael@0 140 break;
michael@0 141 case SETLOCALDESCSUCCESS:
michael@0 142 statestr = "SETLOCALDESCSUCCESS";
michael@0 143 break;
michael@0 144 case SETREMOTEDESCSUCCESS:
michael@0 145 statestr = "SETREMOTEDESCSUCCESS";
michael@0 146 break;
michael@0 147 case UPDATELOCALDESC:
michael@0 148 statestr = "UPDATELOCALDESC";
michael@0 149 break;
michael@0 150 case SETLOCALDESCERROR:
michael@0 151 statestr = "SETLOCALDESCERROR";
michael@0 152 break;
michael@0 153 case SETREMOTEDESCERROR:
michael@0 154 statestr = "SETREMOTEDESCERROR";
michael@0 155 break;
michael@0 156 case REMOTESTREAMADD:
michael@0 157 statestr = "REMOTESTREAMADD";
michael@0 158 break;
michael@0 159 case ADDICECANDIDATE:
michael@0 160 statestr = "ADDICECANDIDATE";
michael@0 161 break;
michael@0 162 case ADDICECANDIDATEERROR:
michael@0 163 statestr = "ADDICECANDIDATEERROR";
michael@0 164 break;
michael@0 165 default:
michael@0 166 break;
michael@0 167 }
michael@0 168
michael@0 169 return statestr;
michael@0 170 }
michael@0 171
michael@0 172 std::string CC_SIPCCCallInfo::callEventToString (ccapi_call_event_e callEvent)
michael@0 173 {
michael@0 174 std::string statestr = "";
michael@0 175
michael@0 176 switch(callEvent) {
michael@0 177 case CCAPI_CALL_EV_CREATED:
michael@0 178 statestr = "CCAPI_CALL_EV_CREATED";
michael@0 179 break;
michael@0 180 case CCAPI_CALL_EV_STATE:
michael@0 181 statestr = "CCAPI_CALL_EV_STATE";
michael@0 182 break;
michael@0 183 case CCAPI_CALL_EV_CALLINFO:
michael@0 184 statestr = "CCAPI_CALL_EV_CALLINFO";
michael@0 185 break;
michael@0 186 case CCAPI_CALL_EV_ATTR:
michael@0 187 statestr = "CCAPI_CALL_EV_ATTR";
michael@0 188 break;
michael@0 189 case CCAPI_CALL_EV_SECURITY:
michael@0 190 statestr = "CCAPI_CALL_EV_SECURITY";
michael@0 191 break;
michael@0 192 case CCAPI_CALL_EV_LOG_DISP:
michael@0 193 statestr = "CCAPI_CALL_EV_LOG_DISP";
michael@0 194 break;
michael@0 195 case CCAPI_CALL_EV_PLACED_CALLINFO:
michael@0 196 statestr = "CCAPI_CALL_EV_PLACED_CALLINFO";
michael@0 197 break;
michael@0 198 case CCAPI_CALL_EV_STATUS:
michael@0 199 statestr = "CCAPI_CALL_EV_STATUS";
michael@0 200 break;
michael@0 201 case CCAPI_CALL_EV_SELECT:
michael@0 202 statestr = "CCAPI_CALL_EV_SELECT";
michael@0 203 break;
michael@0 204 case CCAPI_CALL_EV_LAST_DIGIT_DELETED:
michael@0 205 statestr = "CCAPI_CALL_EV_LAST_DIGIT_DELETED";
michael@0 206 break;
michael@0 207 case CCAPI_CALL_EV_GCID:
michael@0 208 statestr = "CCAPI_CALL_EV_GCID";
michael@0 209 break;
michael@0 210 case CCAPI_CALL_EV_XFR_OR_CNF_CANCELLED:
michael@0 211 statestr = "CCAPI_CALL_EV_XFR_OR_CNF_CANCELLED";
michael@0 212 break;
michael@0 213 case CCAPI_CALL_EV_PRESERVATION:
michael@0 214 statestr = "CCAPI_CALL_EV_PRESERVATION";
michael@0 215 break;
michael@0 216 case CCAPI_CALL_EV_CAPABILITY:
michael@0 217 statestr = "CCAPI_CALL_EV_CAPABILITY";
michael@0 218 break;
michael@0 219 case CCAPI_CALL_EV_VIDEO_AVAIL:
michael@0 220 statestr = "CCAPI_CALL_EV_VIDEO_AVAIL";
michael@0 221 break;
michael@0 222 case CCAPI_CALL_EV_VIDEO_OFFERED:
michael@0 223 statestr = "CCAPI_CALL_EV_VIDEO_OFFERED";
michael@0 224 break;
michael@0 225 case CCAPI_CALL_EV_RECEIVED_INFO:
michael@0 226 statestr = "CCAPI_CALL_EV_RECEIVED_INFO";
michael@0 227 break;
michael@0 228 case CCAPI_CALL_EV_RINGER_STATE:
michael@0 229 statestr = "CCAPI_CALL_EV_RINGER_STATE";
michael@0 230 break;
michael@0 231 case CCAPI_CALL_EV_CONF_PARTICIPANT_INFO:
michael@0 232 statestr = "CCAPI_CALL_EV_CONF_PARTICIPANT_INFO";
michael@0 233 break;
michael@0 234 case CCAPI_CALL_EV_MEDIA_INTERFACE_UPDATE_BEGIN:
michael@0 235 statestr = "CCAPI_CALL_EV_MEDIA_INTERFACE_UPDATE_BEGIN";
michael@0 236 break;
michael@0 237 case CCAPI_CALL_EV_MEDIA_INTERFACE_UPDATE_SUCCESSFUL:
michael@0 238 statestr = "CCAPI_CALL_EV_MEDIA_INTERFACE_UPDATE_SUCCESSFUL";
michael@0 239 break;
michael@0 240 case CCAPI_CALL_EV_MEDIA_INTERFACE_UPDATE_FAIL:
michael@0 241 statestr = "CCAPI_CALL_EV_MEDIA_INTERFACE_UPDATE_FAIL";
michael@0 242 break;
michael@0 243 default:
michael@0 244 break;
michael@0 245 }
michael@0 246
michael@0 247 return statestr;
michael@0 248 }
michael@0 249
michael@0 250 bool CC_SIPCCCallInfo::getRingerState()
michael@0 251 {
michael@0 252 if (CCAPI_CallInfo_getRingerState(callinfo_ref))
michael@0 253 {
michael@0 254 return true;
michael@0 255 }
michael@0 256 else
michael@0 257 {
michael@0 258 return false;
michael@0 259 }
michael@0 260 }
michael@0 261
michael@0 262 cc_call_attr_t CC_SIPCCCallInfo::getCallAttr()
michael@0 263 {
michael@0 264 return CCAPI_CallInfo_getCallAttr(callinfo_ref);
michael@0 265 }
michael@0 266
michael@0 267 cc_call_type_t CC_SIPCCCallInfo::getCallType()
michael@0 268 {
michael@0 269 return CCAPI_CallInfo_getCallType(callinfo_ref);
michael@0 270 }
michael@0 271
michael@0 272 string CC_SIPCCCallInfo::getCalledPartyName()
michael@0 273 {
michael@0 274 return CCAPI_CallInfo_getCalledPartyName(callinfo_ref);
michael@0 275 }
michael@0 276
michael@0 277 string CC_SIPCCCallInfo::getCalledPartyNumber()
michael@0 278 {
michael@0 279 return CCAPI_CallInfo_getCalledPartyNumber(callinfo_ref);
michael@0 280 }
michael@0 281
michael@0 282 string CC_SIPCCCallInfo::getCallingPartyName()
michael@0 283 {
michael@0 284 return CCAPI_CallInfo_getCallingPartyName(callinfo_ref);
michael@0 285 }
michael@0 286
michael@0 287 string CC_SIPCCCallInfo::getCallingPartyNumber()
michael@0 288 {
michael@0 289 return CCAPI_CallInfo_getCallingPartyNumber(callinfo_ref);
michael@0 290 }
michael@0 291
michael@0 292 string CC_SIPCCCallInfo::getAlternateNumber()
michael@0 293 {
michael@0 294 return CCAPI_CallInfo_getAlternateNumber(callinfo_ref);
michael@0 295 }
michael@0 296
michael@0 297 CC_LinePtr CC_SIPCCCallInfo::getline ()
michael@0 298 {
michael@0 299 cc_lineid_t lineId = CCAPI_CallInfo_getLine(callinfo_ref);
michael@0 300 return CC_SIPCCLine::wrap(lineId).get();
michael@0 301 }
michael@0 302
michael@0 303 string CC_SIPCCCallInfo::getOriginalCalledPartyName()
michael@0 304 {
michael@0 305 return CCAPI_CallInfo_getOriginalCalledPartyName(callinfo_ref);
michael@0 306 }
michael@0 307
michael@0 308 string CC_SIPCCCallInfo::getOriginalCalledPartyNumber()
michael@0 309 {
michael@0 310 return CCAPI_CallInfo_getOriginalCalledPartyNumber(callinfo_ref);
michael@0 311 }
michael@0 312
michael@0 313 string CC_SIPCCCallInfo::getLastRedirectingPartyName()
michael@0 314 {
michael@0 315 return CCAPI_CallInfo_getLastRedirectingPartyName(callinfo_ref);
michael@0 316 }
michael@0 317
michael@0 318 string CC_SIPCCCallInfo::getLastRedirectingPartyNumber()
michael@0 319 {
michael@0 320 return CCAPI_CallInfo_getLastRedirectingPartyNumber(callinfo_ref);
michael@0 321 }
michael@0 322
michael@0 323 string CC_SIPCCCallInfo::getPlacedCallPartyName()
michael@0 324 {
michael@0 325 return CCAPI_CallInfo_getPlacedCallPartyName(callinfo_ref);
michael@0 326 }
michael@0 327
michael@0 328 string CC_SIPCCCallInfo::getPlacedCallPartyNumber()
michael@0 329 {
michael@0 330 return CCAPI_CallInfo_getPlacedCallPartyNumber(callinfo_ref);
michael@0 331 }
michael@0 332
michael@0 333 cc_int32_t CC_SIPCCCallInfo::getCallInstance()
michael@0 334 {
michael@0 335 return CCAPI_CallInfo_getCallInstance(callinfo_ref);
michael@0 336 }
michael@0 337
michael@0 338 string CC_SIPCCCallInfo::getStatus()
michael@0 339 {
michael@0 340 return CCAPI_CallInfo_getStatus(callinfo_ref);
michael@0 341 }
michael@0 342
michael@0 343 cc_call_security_t CC_SIPCCCallInfo::getSecurity()
michael@0 344 {
michael@0 345 return CCAPI_CallInfo_getSecurity(callinfo_ref);
michael@0 346 }
michael@0 347
michael@0 348 cc_int32_t CC_SIPCCCallInfo::getSelectionStatus()
michael@0 349 {
michael@0 350 return CCAPI_CallInfo_getSelectionStatus(callinfo_ref);
michael@0 351 }
michael@0 352
michael@0 353 string CC_SIPCCCallInfo::getGCID()
michael@0 354 {
michael@0 355 return CCAPI_CallInfo_getGCID(callinfo_ref);
michael@0 356 }
michael@0 357
michael@0 358 bool CC_SIPCCCallInfo::getIsRingOnce()
michael@0 359 {
michael@0 360 return (CCAPI_CallInfo_getIsRingOnce(callinfo_ref) != 0);
michael@0 361 }
michael@0 362
michael@0 363 int CC_SIPCCCallInfo::getRingerMode()
michael@0 364 {
michael@0 365 return CCAPI_CallInfo_getRingerMode(callinfo_ref);
michael@0 366 }
michael@0 367
michael@0 368 cc_int32_t CC_SIPCCCallInfo::getOnhookReason()
michael@0 369 {
michael@0 370 return CCAPI_CallInfo_getOnhookReason(callinfo_ref);
michael@0 371 }
michael@0 372
michael@0 373 bool CC_SIPCCCallInfo::getIsConference()
michael@0 374 {
michael@0 375 return (CCAPI_CallInfo_getIsConference(callinfo_ref) != 0);
michael@0 376 }
michael@0 377
michael@0 378 set<cc_int32_t> CC_SIPCCCallInfo::getStreamStatistics()
michael@0 379 {
michael@0 380 CSFLogError(logTag, "CCAPI_CallInfo_getCapabilitySet() NOT IMPLEMENTED IN PSIPCC.");
michael@0 381 set<cc_int32_t> stats;
michael@0 382 return stats;
michael@0 383 }
michael@0 384
michael@0 385 bool CC_SIPCCCallInfo::isCallSelected()
michael@0 386 {
michael@0 387 return (CCAPI_CallInfo_isCallSelected(callinfo_ref) != 0);
michael@0 388 }
michael@0 389
michael@0 390 string CC_SIPCCCallInfo::getINFOPack()
michael@0 391 {
michael@0 392 return CCAPI_CallInfo_getINFOPack(callinfo_ref);
michael@0 393 }
michael@0 394
michael@0 395 string CC_SIPCCCallInfo::getINFOType()
michael@0 396 {
michael@0 397 return CCAPI_CallInfo_getINFOType(callinfo_ref);
michael@0 398 }
michael@0 399
michael@0 400 string CC_SIPCCCallInfo::getINFOBody()
michael@0 401 {
michael@0 402 return CCAPI_CallInfo_getINFOBody(callinfo_ref);
michael@0 403 }
michael@0 404
michael@0 405 cc_calllog_ref_t CC_SIPCCCallInfo::getCallLogRef()
michael@0 406 {
michael@0 407 return CCAPI_CallInfo_getCallLogRef(callinfo_ref);
michael@0 408 }
michael@0 409
michael@0 410 cc_sdp_direction_t CC_SIPCCCallInfo::getVideoDirection()
michael@0 411 {
michael@0 412 return CCAPI_CallInfo_getVideoDirection(callinfo_ref);
michael@0 413 }
michael@0 414
michael@0 415 int CC_SIPCCCallInfo::getVolume()
michael@0 416 {
michael@0 417 if( pMediaData != nullptr)
michael@0 418 {
michael@0 419 return pMediaData->volume;
michael@0 420 }
michael@0 421 else
michael@0 422 {
michael@0 423 return -1;
michael@0 424 }
michael@0 425 }
michael@0 426
michael@0 427 bool CC_SIPCCCallInfo::isAudioMuted()
michael@0 428 {
michael@0 429 return (CCAPI_CallInfo_isAudioMuted(callinfo_ref) != 0);
michael@0 430 }
michael@0 431
michael@0 432 bool CC_SIPCCCallInfo::isVideoMuted()
michael@0 433 {
michael@0 434 return (CCAPI_CallInfo_isVideoMuted(callinfo_ref) != 0);
michael@0 435 }
michael@0 436
michael@0 437 string CC_SIPCCCallInfo::getSDP()
michael@0 438 {
michael@0 439 return CCAPI_CallInfo_getSDP(callinfo_ref);
michael@0 440 }
michael@0 441
michael@0 442 cc_int32_t CC_SIPCCCallInfo::getStatusCode()
michael@0 443 {
michael@0 444 return CCAPI_CallInfo_getStatusCode(callinfo_ref);
michael@0 445 }
michael@0 446
michael@0 447 MediaStreamTable* CC_SIPCCCallInfo::getMediaStreams() const
michael@0 448 {
michael@0 449 return CCAPI_CallInfo_getMediaStreams(callinfo_ref);
michael@0 450 }
michael@0 451
michael@0 452 Timecard *CC_SIPCCCallInfo::takeTimecard()
michael@0 453 {
michael@0 454 return CCAPI_CallInfo_takeTimecard(callinfo_ref);
michael@0 455 }
michael@0 456
michael@0 457 std::string CC_SIPCCCallInfo::getCandidate()
michael@0 458 {
michael@0 459 return CCAPI_CallInfo_getCandidate(callinfo_ref);
michael@0 460 }
michael@0 461
michael@0 462 bool CC_SIPCCCallInfo::isMediaStateAvailable()
michael@0 463 {
michael@0 464 // for softphone it will always be possible to query the mute state and video direction
michael@0 465 return true;
michael@0 466 }
michael@0 467
michael@0 468
michael@0 469 #define PRINT_IF_CC_CAP_TRUE(cap) ((hasFeature(cap)) ? string(#cap) + ",": "")
michael@0 470 void CC_SIPCCCallInfo::generateCapabilities()
michael@0 471 {
michael@0 472 // If caps are already generated, no need to repeat the exercise.
michael@0 473 if(!caps.empty())
michael@0 474 return;
michael@0 475 /*
michael@0 476 CSFLogDebugS( logTag, "generateCapabilities() state=" << getCallState() <<
michael@0 477 " underlyingCaps=" <<
michael@0 478 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_NEWCALL) <<
michael@0 479 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_ANSWER) <<
michael@0 480 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_ENDCALL) <<
michael@0 481 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_HOLD) <<
michael@0 482 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_RESUME) <<
michael@0 483 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_CALLFWD) <<
michael@0 484 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_DIAL) <<
michael@0 485 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_BACKSPACE) <<
michael@0 486 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_SENDDIGIT) <<
michael@0 487 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_TRANSFER) <<
michael@0 488 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_CONFERENCE) <<
michael@0 489 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_SWAP) <<
michael@0 490 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_REDIAL) <<
michael@0 491 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_JOIN) <<
michael@0 492 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_SELECT) <<
michael@0 493 PRINT_IF_CC_CAP_TRUE(CCAPI_CALL_CAP_RMVLASTPARTICIPANT) );
michael@0 494 */
michael@0 495 switch(getCallState())
michael@0 496 {
michael@0 497 case OFFHOOK:
michael@0 498 if(hasFeature(CCAPI_CALL_CAP_NEWCALL)) {
michael@0 499 caps.insert(CC_CallCapabilityEnum::canOriginateCall);
michael@0 500 }
michael@0 501 if(hasFeature(CCAPI_CALL_CAP_ENDCALL)) {
michael@0 502 caps.insert(CC_CallCapabilityEnum::canEndCall);
michael@0 503 }
michael@0 504 break;
michael@0 505 case ONHOOK:
michael@0 506 break;
michael@0 507 case DIALING:
michael@0 508 case PROCEED:
michael@0 509 case RINGOUT:
michael@0 510 if(hasFeature(CCAPI_CALL_CAP_ENDCALL)) {
michael@0 511 caps.insert(CC_CallCapabilityEnum::canEndCall);
michael@0 512 }
michael@0 513 if(hasFeature(CCAPI_CALL_CAP_SENDDIGIT)) caps.insert(CC_CallCapabilityEnum::canSendDigit);
michael@0 514 break;
michael@0 515 case RINGIN:
michael@0 516 if(hasFeature(CCAPI_CALL_CAP_ANSWER)) caps.insert(CC_CallCapabilityEnum::canAnswerCall);
michael@0 517 break;
michael@0 518 case CONNECTED:
michael@0 519 if(hasFeature(CCAPI_CALL_CAP_ENDCALL)) {
michael@0 520 caps.insert(CC_CallCapabilityEnum::canEndCall);
michael@0 521 }
michael@0 522 caps.insert(CC_CallCapabilityEnum::canSendDigit);
michael@0 523 if(hasFeature(CCAPI_CALL_CAP_HOLD)) caps.insert(CC_CallCapabilityEnum::canHold);
michael@0 524
michael@0 525 caps.insert(CC_CallCapabilityEnum::canSetVolume);
michael@0 526 if(isAudioMuted())
michael@0 527 {
michael@0 528 caps.insert(CC_CallCapabilityEnum::canUnmuteAudio);
michael@0 529 }
michael@0 530 else
michael@0 531 {
michael@0 532 caps.insert(CC_CallCapabilityEnum::canMuteAudio);
michael@0 533 }
michael@0 534
michael@0 535 if ((CCAPI_CallInfo_getVideoDirection(callinfo_ref) == CC_SDP_DIRECTION_SENDRECV) ||
michael@0 536 (CCAPI_CallInfo_getVideoDirection(callinfo_ref) == CC_SDP_DIRECTION_SENDONLY))
michael@0 537 {
michael@0 538 // sending video so video mute is possible
michael@0 539 if (isVideoMuted())
michael@0 540 {
michael@0 541 caps.insert(CC_CallCapabilityEnum::canUnmuteVideo);
michael@0 542 }
michael@0 543 else
michael@0 544 {
michael@0 545 caps.insert(CC_CallCapabilityEnum::canMuteVideo);
michael@0 546 }
michael@0 547 }
michael@0 548 caps.insert(CC_CallCapabilityEnum::canUpdateVideoMediaCap);
michael@0 549 break;
michael@0 550 case HOLD:
michael@0 551 case REMHOLD:
michael@0 552 caps.insert(CC_CallCapabilityEnum::canResume);
michael@0 553 break;
michael@0 554
michael@0 555 case BUSY:
michael@0 556 case REORDER:
michael@0 557 if(hasFeature(CCAPI_CALL_CAP_ENDCALL)) {
michael@0 558 caps.insert(CC_CallCapabilityEnum::canEndCall);
michael@0 559 }
michael@0 560 break;
michael@0 561 case PRESERVATION:
michael@0 562 if(hasFeature(CCAPI_CALL_CAP_ENDCALL)) {
michael@0 563 caps.insert(CC_CallCapabilityEnum::canEndCall);
michael@0 564 }
michael@0 565 break;
michael@0 566
michael@0 567 // Not worrying about these states yet.
michael@0 568 case RESUME:
michael@0 569 case CONFERENCE:
michael@0 570 case REMINUSE:
michael@0 571 case HOLDREVERT:
michael@0 572 case WHISPER:
michael@0 573 case WAITINGFORDIGITS:
michael@0 574 default:
michael@0 575 CSFLogError( logTag, "State %d not handled in generateCapabilities()",
michael@0 576 getCallState());
michael@0 577 break;
michael@0 578 }
michael@0 579 }
michael@0 580
michael@0 581 bool CC_SIPCCCallInfo::hasFeature(ccapi_call_capability_e cap)
michael@0 582 {
michael@0 583 return (CCAPI_CallInfo_hasCapability(callinfo_ref, (cc_int32_t) cap) != 0);
michael@0 584 }
michael@0 585
michael@0 586 void CC_SIPCCCallInfo::setMediaData(CC_SIPCCCallMediaDataPtr pMediaData)
michael@0 587 {
michael@0 588 this-> pMediaData = pMediaData;
michael@0 589 }
michael@0 590

mercurial