Esempio n. 1
0
void MyPhoneListener::onCallEvent   ( ccapi_call_event_e callEvent, CC_CallPtr call, CC_CallInfoPtr info )
{
	CSFLogDebugS(logTag, "MyPhoneListener::onCallEvent");

	_callCapsMayHaveChanged.Signal();

    if (callEvent == CCAPI_CALL_EV_STATE)
    {
        if (info->getCallState() == RINGIN)
        {
            addUserOperationAndSignal(UserOperationRequestDataPtr(new UserOperationRequestData(eIncomingCallReceived, NULL)));
        }
        else if (info->getCallState() == ONHOOK)
        {
        	CSFLogDebugS(logTag, "MyPhoneListener::onCallEvent -- ONHOOK");
        }
    }

	else if(callEvent == CCAPI_CALL_EV_VIDEO_AVAIL)
	{
        addUserOperationAndSignal(UserOperationRequestDataPtr(new UserOperationRequestData(eVideoAvailableChange, NULL)));
	}
	else if(callEvent == CCAPI_CALL_EV_VIDEO_OFFERED)
	{
        addUserOperationAndSignal(UserOperationRequestDataPtr(new UserOperationRequestData(eVideoOffered, NULL)));
	}
}
Esempio n. 2
0
/**
  This function gets a snapshot of all calls and examines each one in turn. If it find a call whose
  state is one of the specified states then it returns that call.

  @param [in] ccmPtr -

  @param [in] callStates - A vector of the call states being checked for. All existing calls are examined and the
                          first (in no particular order) call that is in one of those states is returned,
                          if there is one.

  @return Returns a NULL_PTR if there are no calls in the given states. If a call is found in the given states
          then that CC_CallPtr is returned.
*/
static CC_CallPtr getFirstCallInGivenStates (CallControlManagerPtr ccmPtr, const vector<cc_call_state_t>& callStates)
{
	CSFLogDebugS(logTag, "getFirstCallInGivenStates()");

	if (ccmPtr == NULL)
    {
        return NULL_PTR(CC_Call);
    }

    CC_DevicePtr devicePtr = ccmPtr->getActiveDevice();

    if (devicePtr == NULL)
    {
    	CSFLogDebugS(logTag, "devicePtr was NULL, returning");
        return NULL_PTR(CC_Call);
    }

    CC_DeviceInfoPtr deviceInfoPtr = devicePtr->getDeviceInfo();

    if (deviceInfoPtr == NULL)
    {
    	CSFLogDebugS(logTag, "deviceInfoPtr was NULL, returning");
        return NULL_PTR(CC_Call);
    }

    vector<CC_CallPtr> calls = deviceInfoPtr->getCalls();

    for (vector<CC_CallPtr>::iterator it = calls.begin(); it != calls.end(); it++)
    {
        CC_CallPtr call = *it;

        if (call == NULL)
        {
            continue;
        }

        CC_CallInfoPtr callInfoPtr = call->getCallInfo();

        if (callInfoPtr == NULL)
        {
            continue;
        }

        CSFLogDebugS(logTag, "about to check call for states");

        for (vector<cc_call_state_t>::const_iterator it = callStates.begin(); it != callStates.end(); it++)
        {
          	cc_call_state_t callState = *it;
            if (callInfoPtr->getCallState() == callState)
            {
                return call;
            }
        }
    }//end for (calls)

    return NULL_PTR(CC_Call);
}
Esempio n. 3
0
/**
  This function gets a snapshot of all calls and examines each one in turn. If it find a call that is in
  the specified state then it returns this call.

  @param [in] ccmPtr - 

  @param [in] callState - This is the call state being checked for. All existing calls are examined and the
                          first (in no particular order) call that is in this state is returned, if there is one.
                    
  @return Returns a NULL_PTR if there are no calls in the given state. If a call is found in the given state
          then that CC_CallPtr is returned.
*/
static CC_CallPtr getFirstCallInGivenState (CallControlManagerPtr ccmPtr, cc_call_state_t callState)
{
    if (ccmPtr == NULL)
    {
        return NULL_PTR(CC_Call);
    }

    CC_DevicePtr devicePtr = ccmPtr->getActiveDevice();

    if (devicePtr == NULL)
    {
        return NULL_PTR(CC_Call);
    }

    CC_DeviceInfoPtr deviceInfoPtr = devicePtr->getDeviceInfo();

    if (deviceInfoPtr == NULL)
    {
        return NULL_PTR(CC_Call);
    }

    vector<CC_CallPtr> calls = deviceInfoPtr->getCalls();

    for (vector<CC_CallPtr>::iterator it = calls.begin(); it != calls.end(); it++)
    {
        CC_CallPtr call = *it;

        if (call == NULL)
        {
            continue;
        }

        CC_CallInfoPtr callInfoPtr = call->getCallInfo();

        if (callInfoPtr == NULL)
        {
            continue;
        }

        if (callInfoPtr->getCallState() == callState)
        {
            return call;
        }
    }//end for (calls)

    return NULL_PTR(CC_Call);
}
Esempio n. 4
0
void CC_CapsPrinter::onCallEvent (ccapi_call_event_e callEvent, CC_CallPtr call, CC_CallInfoPtr info, char* sdp )
{
	base::AutoLock lock(eventPrinterMutex);
    printHeaderBlockIfNotAlreadyPrinted();

    CSFLogDebugS(logTag, "C:");
    printCurrentThreadID();

    std::string eventNameStr = truncateLeft(call_event_getname(callEvent), EVENT_NAME_FIELD_WIDTH);

    CSFLogDebug(logTag, "%*s %s ", EVENT_NAME_FIELD_WIDTH, eventNameStr.c_str(), call->toString().c_str());

    switch (callEvent)
    {
    case CCAPI_CALL_EV_CALLINFO:
        printCallPartiesInfo(info);
        break;
    case CCAPI_CALL_EV_STATE:
        /*
         Whenever we get a CCAPI_CALL_EV_STATE the expectation is that we call getCapabilitySet() to
         get the current list of caps, or we call hasCapability(ccapi_call_capability_e) to determine
         if a given capability is available or not.
         */
        PRINT_EVENT_INFO_NICELY_USING_GETNAME("CallState", info, getCallState, call_state_getname);
        PRINT_OFFSET_1;
        if (info->getCallState() == RINGIN)
        {
            printCallPartiesInfo(info);
        }
        PRINT_OFFSET_1;
        PRINT_EVENT_INFO_NICELY_USING_GETNAME("CallType", info, getCallType, call_type_getname);
        PRINT_OFFSET_1;
		PRINT_EVENT_INFO_NICELY_USING_GETNAME("VideoDirection", info, getVideoDirection, sdp_direction_getname);
	    PRINT_OFFSET_1;
        CSFLogDebugS(logTag, "(CallCaps ");
        CSFLogDebugS(logTag, "----------");

        printCallCapabilities(info, WRAPPED_LINE_ALIGNMENT_OFFSET_2);
        break;
    case CCAPI_CALL_EV_STATUS:
        PRINT_EVENT_INFO_NICELY_FOR_STRING   ("CallStatus", info, getStatus);
        break;
    case CCAPI_CALL_EV_ATTR:
        PRINT_EVENT_INFO_NICELY_USING_GETNAME("CallAttr", info, getCallAttr, call_attr_getname);
        break;
    case CCAPI_CALL_EV_SECURITY:
        PRINT_EVENT_INFO_NICELY_USING_GETNAME("CallSecurity", info, getSecurity, call_security_getname);
        break;
    case CCAPI_CALL_EV_CAPABILITY:
        //
        printCallCapabilities(info, WRAPPED_LINE_ALIGNMENT_OFFSET_1);
        break;
    case CCAPI_CALL_EV_VIDEO_AVAIL:
		PRINT_EVENT_INFO_NICELY_USING_GETNAME("VideoDirection", info, getVideoDirection, sdp_direction_getname);
	    PRINT_OFFSET_1;
	    break;
    case CCAPI_CALL_EV_VIDEO_OFFERED:
		PRINT_EVENT_INFO_NICELY_USING_GETNAME("VideoDirection", info, getVideoDirection, sdp_direction_getname);
	    PRINT_OFFSET_1;
	    break;
    default:
    	break;
    }//end switch
}