Esempio n. 1
0
/**
 * gets the device idle status
 * @param [in] handle - reference to device info 
 * @returns boolean - idle status
 */
cc_boolean CCAPI_DeviceInfo_isPhoneIdle(cc_deviceinfo_ref_t handle) 
{
    static const char *fname="CCAPI_DeviceInfo_isPhoneIdle";
    boolean ret = TRUE;
    hashItr_t itr;
    session_data_t * session_data;
    cc_call_state_t call_state;

    hashItrInit(&itr);

    while ((session_data = hashItrNext(&itr)) != NULL) {
        call_state = session_data->state;
        if (call_state != ONHOOK &&
            call_state != REMINUSE) {
            ret = FALSE;
            break;
        }
    }
    CCAPP_DEBUG(DEB_F_PREFIX"idle state=%d session_id=0x%x call-state=%d handle=%x\n",
        DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), ret,
        (session_data != NULL)? session_data->sess_id: 0,
        (session_data != NULL)? session_data->state: 0, 
        (handle)? handle:0);
    return ret;

}
Esempio n. 2
0
int main()
{
  static const char *fname="main";
  hashItr_t itr;
  void * data;

  addhash(0x01010001,0x1234);
  addhash(0x01060001,0x4567);
  addhash(0x01060002,0x9324);
  addhash(0x01070002,0x4321);
  addhash(0x01070004,0x2134);
  addhash(0x01080005,0x1324);
  addhash(0x01030001,0x1243);
  hashstats(7);

  hashItrInit(&itr);
  while ( data = hashItrNext(&itr) ) {
    CCAPPDEBUG(DEB_F_PREFIX"Itr found %lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), data);
  }

  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01010001));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060001));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060002));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070002));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070004));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01080005));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01030001));

  delhash(0x01030001);
  delhash(0x01060001);
  hashstats(7);

  hashItrInit(&itr);
  while ( data = hashItrNext(&itr) ) {
    CCAPPDEBUG(DEB_F_PREFIX"Itr found %lx", DEB_F_PREFIX_ARGS(SIP_SES_HAS, fname), data);
  }

  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01010001));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060001));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060002));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070002));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070004));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01080005));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01030001));
}
Esempio n. 3
0
/**
 * gets list of handles to calls on the device
 * @param handle - device handle
 * @param handles - array of call handle to be returned
 * @param count[in/out] number allocated in array/elements returned
 * @returns 
 */
void CCAPI_DeviceInfo_getCalls (cc_deviceinfo_ref_t handle, cc_call_handle_t handles[], cc_uint16_t *count) 
{
    static const char *fname="CCAPI_DeviceInfo_getCalls";
    hashItr_t itr;
    session_data_t *data;
    int i=0;
    CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
     
    hashItrInit(&itr);
    while ( (data = (session_data_t*)hashItrNext(&itr)) != NULL &&
              i<*count ) {
        handles[i++] = CREATE_CALL_HANDLE_FROM_SESSION_ID(data->sess_id);
    }
    *count=i;
    CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
}
Esempio n. 4
0
/**
 * Get calls on line
 * @param [in] line - lineID
 * @param [out] callref[] - Array of callinfo references
 * @param [in/out] count - count of call references populated
 * @return void
 */
void CCAPI_LineInfo_getCallsByState(cc_lineid_t line, cc_call_state_t state,
                 cc_call_handle_t handles[], int *count)
{
    static const char *fname="CCAPI_Line_getCallsByState";
    hashItr_t itr;
    session_data_t *data;
    int i=0;

    CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));

    hashItrInit(&itr);
    while ( (data = (session_data_t*)hashItrNext(&itr)) != NULL &&
              i<*count ) {
         if ( GET_LINE_ID(data->sess_id) == line && data->state ==state ){
            handles[i++] = CREATE_CALL_HANDLE_FROM_SESSION_ID(data->sess_id);
         }
    }
    *count=i;
    CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
}