Пример #1
0
void printCallSummary(CC_DevicePtr devicePtr)
{
    if (devicePtr == NULL)
    {
        return;
    }

    CC_DeviceInfoPtr deviceInfoPtr = devicePtr->getDeviceInfo();

    if (deviceInfoPtr == NULL)
    {
        return;
    }

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

    CSFLogDebugS(logTag, " List of all calls ");
    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;
		}
        bool audioMute = callInfoPtr->isAudioMuted();
        bool videoMute = callInfoPtr->isVideoMuted();
        
        PRINT_OFFSET_1;
        PRINT_EVENT_INFO_NICELY_USING_GETNAME("CallState", callInfoPtr, getCallState, call_state_getname);
        PRINT_OFFSET_1;
        PRINT_EVENT_INFO_NICELY_USING_GETNAME("CallType", callInfoPtr, getCallType, call_type_getname);
        PRINT_OFFSET_1;
        PRINT_EVENT_INFO_NICELY_USING_GETNAME("VideoDirection", callInfoPtr, getVideoDirection, sdp_direction_getname);
        PRINT_OFFSET_1;
        CSFLogDebugS(logTag, "(AudioMute ");
        CSFLogDebugS(logTag, "----------");
        CSFLogDebug(logTag, " %s )", (audioMute) ? "true" : "false");
        PRINT_OFFSET_1;
        CSFLogDebugS(logTag, "(VideoMute ");
        CSFLogDebugS(logTag, "----------");
        CSFLogDebug(logTag, " %s )", (videoMute) ? "true" : "false");
        PRINT_OFFSET_1;
        printCallPartiesInfo(callInfoPtr);
        PRINT_OFFSET_1;
        CSFLogDebugS(logTag, "(CallCaps ");
        CSFLogDebugS(logTag, "----------");
        printCallCapabilities(callInfoPtr, WRAPPED_LINE_ALIGNMENT_OFFSET_2);

    }//end for (calls)
    CSFLogDebugS(logTag, "End of List");
}
Пример #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);
}
Пример #3
0
void CC_CapsPrinter::onDeviceEvent (ccapi_device_event_e deviceEvent, CC_DevicePtr device, CC_DeviceInfoPtr info )
{
	base::AutoLock lock(eventPrinterMutex);
    printHeaderBlockIfNotAlreadyPrinted();

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

    std::string eventNameStr = truncateLeft(device_event_getname(deviceEvent), EVENT_NAME_FIELD_WIDTH);

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

    switch (deviceEvent)
    {
    case CCAPI_DEVICE_EV_STATE:
        PRINT_EVENT_INFO_NICELY_USING_GETNAME("ServiceState", info, getServiceState, service_state_getname);
        break;
    case CCAPI_DEVICE_EV_SERVER_STATUS:
    {
        vector<CC_CallServerInfoPtr> callServers = info->getCallServers();
        for (size_t i=0; i<callServers.size(); i++)
        {
            CSFLogDebug(logTag, "%*s(CallServer %lu: ", WRAPPED_LINE_ALIGNMENT_OFFSET_1, "", (unsigned long) i);
            CSFLogDebugS(logTag, "----------");
            CC_CallServerInfoPtr callServerInfoPtr = callServers[i];
            PRINT_EVENT_INFO_NICELY_USING_GETNAME("CallServerMode", callServerInfoPtr, getCallServerMode, cucm_mode_getname);
            PRINT_OFFSET_2;
            PRINT_EVENT_INFO_NICELY_USING_GETNAME("CallServerStatus", callServerInfoPtr, getCallServerStatus, ccm_status_getname);
        }
        break;
    }
    default:
    	break;
    }//end switch
}
Пример #4
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);
}
Пример #5
0
/**
  This function gets a snapshot of all calls and examines each one in turn. If it find a call that has the
  specified capability then it returns this call.

  @param [in] ccmPtr - 

  @param [in] cap - This is the capability being examined. All existing calls are examined and the first (in
                    no particular order) call that has this capability is returned, if there is one.
                    
  @return Returns a NULL_PTR if there are no calls with the given capability. If a call is found with the given
          capability then that CC_CallPtr is returned.
*/
static CC_CallPtr getFirstCallWithCapability (CallControlManagerPtr ccmPtr, CC_CallCapabilityEnum::CC_CallCapability cap)
{
    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->hasCapability(cap))
        {
            return call;
        }
    }//end for (calls)

    return NULL_PTR(CC_Call);
}