/*
 *  Function:    sub_hndlr_controlBLFButtons
 *
 *  Description: hides/unhides BLF states.
 *
 *  Parameters: none.
 *
 *  Returns:    void
 */
void sub_hndlr_controlBLFButtons(boolean state)
{
    static const char fname[] = "sub_hndlr_controlBLFButtons";

    if (state == TRUE) {
        CCAPP_DEBUG(DEB_F_PREFIX"going to hide\n",
                    DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
        hideBLFButtonsDisplay();
    } else {
        CCAPP_DEBUG(DEB_F_PREFIX"going to unhide\n",
                    DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
        unhideBLFButtonsDisplay();
    }
}
Beispiel #2
0
/**
 * gets the service cause
 * @param [in] handle - reference to device info
 * @returns cc_service_cause_t - reason for service state
 */
cc_service_cause_t CCAPI_DeviceInfo_getServiceCause (cc_deviceinfo_ref_t handle)
{
  static const char *fname="CCAPI_DeviceInfo_getServiceCause";
  cc_device_info_t *device = handle;
  CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));

  if ( device != NULL ) {
     CCAPP_DEBUG(DEB_F_PREFIX"returned %02X\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), device->ins_cause);
     return device->ins_cause;
  }

  return CC_CAUSE_NONE;

}
Beispiel #3
0
/**
 * gets handles of call agent servers
 * @param handles - array of handles to call agent servers
 * @param count[in/out] number allocated in array/elements returned
 * @returns
 */
void CCAPI_DeviceInfo_getCallServers (cc_deviceinfo_ref_t handle, cc_callserver_ref_t handles[], cc_uint16_t *count)
{
    static const char *fname="CCAPI_DeviceInfo_getCallServers";
    int i, j=0;
    CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));

    for (i=0;i<CCAPI_MAX_SERVERS && i< *count; i++) {
        if (g_deviceInfo.ucm[i].name != 0 && strlen(g_deviceInfo.ucm[i].name)) {
	    handles[j++] = &g_deviceInfo.ucm[i];
	}
    }
    *count = j;
    CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
}
/**
 *
 * Tell platform to adjust the time to the gmt_time received from outside
 * For sip the "outside" is from the "Date" header coming from a CCM or
 * any other Server
 *
 * @param       gmt_time   - GMT time in seconds
 *
 * @return      none
 */
void
platform_set_time (long gmt_time)
{
    static const char fname[] = "platform_set_time";
    session_mgmt_t msg;

    CCAPP_DEBUG(DEB_F_PREFIX"setting time to=%ld", DEB_F_PREFIX_ARGS(PLAT_API, fname), gmt_time);

    msg.func_id = SESSION_MGMT_SET_TIME;
    msg.data.time.gmt_time = gmt_time;

    if ( ccappTaskPostMsg(CCAPP_SESSION_MGMT, &msg, sizeof(session_mgmt_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
        CCAPP_DEBUG(DEB_F_PREFIX"failed to send platform_set_time msg\n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
    }
}
/*
 *  Function:    sub_hndlr_isInUseBLFState
 *
 *  Description: returns if the BLF state is "in use"
 *
 *  Parameters:
 *    inst - line button number.
 *
 *  Returns:    TRUE/FALSE
 */
boolean sub_hndlr_isInUseBLFState(int inst)
{
    static const char fname[] = "sub_hndlr_isInUseBLFState";

    if ((displayBLFState == TRUE) && (blfStates[inst - 1] == CC_SIP_BLF_INUSE)) {
    CCAPP_DEBUG(DEB_F_PREFIX"inst=%d, isInUse=TRUE\n",
                DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
                inst);
        return TRUE;
    }
    CCAPP_DEBUG(DEB_F_PREFIX"inst=%d, isInUse=FALSE\n",
                DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
                inst);
    return FALSE;
}
Beispiel #6
0
/*
 * capset_get_idleset - get the set of features associated with idle state
 *
 */
void capset_get_idleset ( cc_cucm_mode_t mode, cc_boolean features[])
{
  static const char fname[] = "capset_get_idleset";
  int i;

  CCAPP_DEBUG(DEB_F_PREFIX"updating idleset",
            DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));

     for (i=0;i < CCAPI_CALL_CAP_MAX; i++) {
  CCAPP_DEBUG(DEB_F_PREFIX"updating line features %d=%d",
            DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), i, capability_idleset[i]);
       features[i] = capability_idleset[i];
     }

}
/*called from configapp.c.  This routine will set the kpml
  value on the java side and trigger it down to c-side.
  Also, it will reinitialize the dialplan. */
void
update_kpmlconfig(int kpmlVal)
{
    static const char fname[] = "update_kpmlconfig";
    session_mgmt_t msg;

    CCAPP_DEBUG(DEB_F_PREFIX "kpml=%d\n", DEB_F_PREFIX_ARGS(PLAT_API, fname), kpmlVal);

    msg.func_id = SESSION_MGMT_UPDATE_KPMLCONFIG;
    msg.data.kpmlconfig.kpml_val = kpmlVal;

    if ( ccappTaskPostMsg(CCAPP_SESSION_MGMT, &msg, sizeof(session_mgmt_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
        CCAPP_DEBUG(DEB_F_PREFIX"failed to send update_kpmlconfig msg\n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
    }
}
Beispiel #8
0
static void
dp_do_redial (line_t line, callid_t call_id)
{
    const char fname[] = "dp_do_redial";

    DPINT_DEBUG(DEB_F_PREFIX"line=%d call_id=%d\n", DEB_F_PREFIX_ARGS(DIALPLAN, fname), line, call_id);

    if (line == 0) {
        line = dp_get_redial_line();
    }
    //CSCsz63263, use prime line instead if last redialed line is unregistered
    if(ccsip_is_line_registered(line) == FALSE) {
         DPINT_DEBUG(DEB_F_PREFIX"line %d unregistered, use line %d instead \n", DEB_F_PREFIX_ARGS(DIALPLAN, fname), line,
        		 PRIME_LINE_ID);
         line = PRIME_LINE_ID;
         if( ccsip_is_line_registered(line) == FALSE) {
            DPINT_DEBUG(DEB_F_PREFIX" prime line %d unregistered\n", DEB_F_PREFIX_ARGS(DIALPLAN, fname), line);
            return;
       }
     }
    if (g_dp_int.gReDialed[0] == NUL) {
        DPINT_DEBUG(DEB_F_PREFIX"NO DIAL STRING line=%d call_id=%d\n", DEB_F_PREFIX_ARGS(DIALPLAN, fname), line,
                    call_id);

        return;
    }

    sstrncpy(g_dp_int.gDialed, g_dp_int.gReDialed, MAX_DIALSTRING);

    g_dp_int.line = line;

    g_dp_int.call_id = call_id;

    g_dp_int.allow_proceed = TRUE;
    
    /*
     * If we are doing redial, then we won't be entering any more digits
     */
    g_dp_int.gDialplanDone = TRUE;   

    (void) cprCancelTimer(g_dp_int.dial_timer);

    kpml_set_subscription_reject(line, call_id);

    kpml_flush_quarantine_buffer(line, call_id);

    cc_dialstring(CC_SRC_GSM, call_id, line, &g_dp_int.gReDialed[0]);
}
Beispiel #9
0
/**
 * This function calls the JNI function to sends the information received
 * in apply-config NOTIFY message to Java side.
 *
 * @param   configVersionStamp - version stamp for config file
 * @param   dialplanVersionStamp - version stamp for the dialplan file
 * @param   fcpVersionStamp - version stamp for the softkey file (?)
 * @param   cucmResult  - CUCM result after applying config by CUCM
 * @param   loadId  - loadId to upgrade as requested by CUCM
 * @param   inactiveLoadId  - inactive loadId for inactive partition as requested by CUCM
 * @param   loadServer  - load server form where to pick loadId
 * @param   logServer  - log server for logging output of peer to peer upgrade.
 * @param   ppid  - specify whether peer to peer upgrade is enabled/disabled.
 *
 * @return  none
 */
void
platform_apply_config (char * configVersionStamp,
                       char * dialplanVersionStamp,
                       char * fcpVersionStamp,
                       char * cucmResult,
                       char * loadId,
                       char * inactiveLoadId, 
                       char * loadServer,
                       char * logServer,
                       boolean ppid)
{
    static const char fname[] = "platform_apply_config";
    session_mgmt_t msg;

    fcpVersionStamp = (fcpVersionStamp != NULL) ? fcpVersionStamp : "";

    /// Print the arguments
    CCAPP_DEBUG(DEB_F_PREFIX"   configVersionStamp=%s \ndialplanVersionStamp=%s"
           "\nfcpVersionStamp=%s \ncucmResult=%s "
           "\nloadId=%s \ninactiveLoadId=%s \nloadServer=%s \nlogServer=%s "
           "\nppid=%s\n", DEB_F_PREFIX_ARGS(PLAT_API, fname),
           (configVersionStamp != NULL) ? configVersionStamp : "",
           (dialplanVersionStamp != NULL) ? dialplanVersionStamp:"",
           fcpVersionStamp,
           cucmResult != NULL ? cucmResult: "",
           (loadId != NULL) ? loadId : "",
           (inactiveLoadId != NULL) ? inactiveLoadId : "",
           (loadServer != NULL) ? loadServer : "",
           (logServer != NULL) ? logServer : "",
           ppid == TRUE? "True": "False");


    // following data is freed in function freeSessionMgmtData()
    msg.func_id = SESSION_MGMT_APPLY_CONFIG;
    msg.data.config.config_version_stamp = STRLIB_CREATE(configVersionStamp);
    msg.data.config.dialplan_version_stamp = STRLIB_CREATE(dialplanVersionStamp);
    msg.data.config.fcp_version_stamp = STRLIB_CREATE(fcpVersionStamp);
    msg.data.config.cucm_result = STRLIB_CREATE(cucmResult);
    msg.data.config.load_id = STRLIB_CREATE(loadId);
    msg.data.config.inactive_load_id = STRLIB_CREATE(inactiveLoadId);
    msg.data.config.load_server = STRLIB_CREATE(loadServer);
    msg.data.config.log_server = STRLIB_CREATE(logServer);
    msg.data.config.ppid = ppid;

    if ( ccappTaskPostMsg(CCAPP_SESSION_MGMT, &msg, sizeof(session_mgmt_t), CCAPP_CCPROVIER) != CPR_SUCCESS ) {
        CCAPP_DEBUG(DEB_F_PREFIX"failed to send platform_apply_config msg\n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
    }
}
Beispiel #10
0
void conf_roster_free_call_conference (cc_call_conference_Info_t *confInfo)
{
    cc_call_conferenceParticipant_Info_t *participant;

    CCAPP_DEBUG(DEB_F_PREFIX"in free_call_confrerence \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI-CONFPARSE"));

    while((participant=(cc_call_conferenceParticipant_Info_t *)
                sll_lite_unlink_head(&confInfo->currentParticipantsList)) != NULL) 
    {
        strlib_free(participant->participantName);
        strlib_free(participant->endpointUri);
        strlib_free(participant->callid);
        strlib_free(participant->participantNumber);
        
        participant->participantSecurity        = CC_SECURITY_NONE; 
        participant->participantStatus          = CCAPI_CONFPARTICIPANT_UNKNOWN;
        participant->canRemoveOtherParticipants = FALSE;
        
        cpr_free(participant);
        participant = NULL;
    }

    strlib_free(confInfo->myParticipantId);
    conf_roster_init_call_conference(confInfo);
}
Beispiel #11
0
/**
 * This function will check if wee need to send refresh PUBLISH. 
 * If so, it will send refresh PUBLISH
 *
 * @param[in] none
 *
 * @return none
 */
void publish_handle_periodic_timer_expire (void)
{
    static const char fname[] = "publish_handle_periodic_timer_expire";
    int                 delta = 0;
    ccsip_publish_cb_t *pcb_p;
    pub_req_t           msg;

    config_get_value(CFGID_TIMER_SUBSCRIBE_DELTA, &delta,
                     sizeof(delta));
    pcb_p = (ccsip_publish_cb_t *)sll_next(s_PCB_list, NULL);
    while (pcb_p != NULL) {
        if (pcb_p->outstanding_trxn == FALSE) {
            if (pcb_p->hb.expires >= TMR_PERIODIC_PUBLISH_INTERVAL) {
                pcb_p->hb.expires -= TMR_PERIODIC_PUBLISH_INTERVAL;
            }
            if (pcb_p->hb.expires <= (delta + TMR_PERIODIC_PUBLISH_INTERVAL)) {
                CCSIP_DEBUG_TASK(DEB_F_PREFIX"sending REFRESH PUBLISH", DEB_F_PREFIX_ARGS(SIP_PUB, fname));
                memset (&msg, 0, sizeof(msg));
                /* refresh is triggered by NULL event data and non-zero expires value */
                msg.pub_handle = pcb_p->pub_handle;
                msg.expires = pcb_p->hb.orig_expiration;
                (void)publish_handle_ev_app_publish(&msg);               
            }
        }
        pcb_p = (ccsip_publish_cb_t *)sll_next(s_PCB_list, pcb_p);
    }
}
Beispiel #12
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;

}
Beispiel #13
0
/**
 * gets provisioing for received call logging
 * @param [in] handle - reference to device info
 * @returns boolean - false => disabled true => enabled
 */
cc_boolean CCAPI_DeviceInfo_isReceivedCallLoggingEnabled (cc_deviceinfo_ref_t handle)
{
    static const char *fname="CCAPI_DeviceInfo_isReceivedCallLoggingEnabled";

    CCAPP_DEBUG(DEB_F_PREFIX" return val %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), ccsnap_isReceivedCallLoggingEnabled());
    return ccsnap_isReceivedCallLoggingEnabled();
}
Beispiel #14
0
/**
 * gets list of handles to features on the device
 * @param handles[in,out] - array of feature handle to be returned
 * @param count[in/out] number allocated in array/elements returned
 * @returns
 */
void CCAPI_DeviceInfo_getFeatures (cc_deviceinfo_ref_t handle, cc_featureinfo_ref_t handles[], cc_uint16_t *count)
{
    static const char *fname="CCAPI_DeviceInfo_getFeatures";
    cc_featureinfo_ref_t feature;
    int i=0, j=0;
    CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));

    for (i=1;i<=MAX_CONFIG_LINES && j<*count;i++) {
    	feature = (cc_featureinfo_ref_t) ccsnap_getFeatureInfo(i);
    	if(feature != NULL){
			handles[j++] = feature;
    	}
    }
    *count=j;
    CCAPP_DEBUG(DEB_F_PREFIX"Finished (no return) \n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
}
Beispiel #15
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));
}
Beispiel #16
0
/**
 *
 * CCApp Provider main routine.
 *
 * @param   arg - CCApp msg queue
 *
 * @return  void
 *
 * @pre     None
 */
void CCApp_task(void * arg)
{
    static const char fname[] = "CCApp_task";
    phn_syshdr_t   *syshdr = NULL;
    appListener *listener = NULL;
    void * msg;

    //initialize the listener list
    sll_lite_init(&sll_list);

    CCAppInit();

    while (1) {
        msg = cprGetMessage(ccapp_msgq, TRUE, (void **) &syshdr);
        if ( msg) {
#if DEBUG
            dump_msg("CCAPPTASKDUMPMSG", (unsigned int *)msg, syshdr->Len, syshdr->Cmd);
#else
            CCAPP_DEBUG(DEB_F_PREFIX"Received Cmd[%d] for app[%d]\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
                    syshdr->Cmd, syshdr->Usr.UsrInfo);
#endif

            listener = getCcappListener(syshdr->Usr.UsrInfo);
            if (listener != NULL) {
                (* ((appListener)(listener)))(msg, syshdr->Cmd);
            } else {
                CCAPP_DEBUG(DEB_F_PREFIX"Event[%d] doesn't have a dedicated listener.\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
                        syshdr->Usr.UsrInfo);
            }
            cprReleaseSysHeader(syshdr);
            cprReleaseBuffer(msg);
        }
    }
}
/*
 *  Function: config_get_string()
 *
 *  Description: Get any arbitrary config entry as a string
 *
 *  Parameters: id - The id of the config string to get
 *              buffer - Empty buffer where string will be copied
 *              buffer_len -  length of the buffer where string will be copied
 *
 *  Returns: None
 */
void
config_get_string (int id, char *buffer, int buffer_len)
{
    const var_t *entry;
    char *buf_start;

    /*
     * Set the result to be empty in case we can't find anything
     */
    buffer[0] = 0;
    if ((id >= 0) && (id < CFGID_PROTOCOL_MAX)) {
        entry = &prot_cfg_table[id];
        if (entry->length > buffer_len) {
            CONFIG_ERROR(CFG_F_PREFIX"insufficient buffer: %d\n", "config_get_string",
                    id);
        } else {
            buf_start = buffer;
            entry->print_func(entry, buffer, buffer_len);
            CONFIG_DEBUG(DEB_F_PREFIX"CFGID %d: get str: %s = %s\n", DEB_F_PREFIX_ARGS(CONFIG_API, "config_get_string"), id, entry->name,
                         buf_start);
        }
    } else {
        CONFIG_ERROR(CFG_F_PREFIX"Invalid ID: %d\n", "config_get_string", id);
    }
}
/*
 *  Function:    unhideBLFButtonsDisplay
 *
 *  Description: unhides BLF states.
 *
 *  Parameters: none.
 *
 *  Returns:    void
 */
static void unhideBLFButtonsDisplay()
{
    static const char fname[] = "unhideBLFButtonsDisplay";
    int i;
    cc_uint32_t lineFeature = 0;
    char speedDialNumber[MAX_LINE_NAME_SIZE] = {0};

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

    displayBLFState = TRUE;

    for (i = SPEEDDIAL_START_BUTTON_NUMBER; i <= MAX_REG_LINES; i++) {
        // first line must always be a calling line.
        config_get_line_value(CFGID_LINE_FEATURE, &lineFeature, sizeof(lineFeature), i);
        config_get_line_string(CFGID_LINE_SPEEDDIAL_NUMBER, speedDialNumber, i, sizeof(speedDialNumber));

        switch (lineFeature) {
        case cfgLineFeatureSpeedDialBLF:
            ccsnap_gen_blfFeatureEvent(blfStates[i - 1], i);
            break;
        default:
            break;
        }
    }
}
/*
 *  Function:    sub_hndlr_NotifyBLFStatus
 *
 *  Description: notifies the app of BLF state.
 *
 *  Parameters:
 *      requestId - requestId of the subscription
 *      status - BLF status
 *      appId -  button number of the BLF feature key.
 *
 *  Returns:    void
 */
void sub_hndlr_NotifyBLFStatus(int requestId, cc_blf_state_t status, int appId)
{
    static const char fname[] = "sub_hndlr_NotifyBLFStatus";
    cc_uint32_t lineFeature = 0;
    char speedDialNumber[MAX_LINE_NAME_SIZE] = {0};


    CCAPP_DEBUG(DEB_F_PREFIX"requestId=%d, status=%d, appId=%d\n",
                DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
                requestId, status, appId);
    if (appId == 0) {
        // call list BLF.
    } else {
        config_get_line_value(CFGID_LINE_FEATURE, &lineFeature, sizeof(lineFeature), appId);
        config_get_line_string(CFGID_LINE_SPEEDDIAL_NUMBER, speedDialNumber, appId, sizeof(speedDialNumber));

        blfStates[appId - 1] = status;
        if (displayBLFState == FALSE) {
            return; // ignore the notify
        }
        if (lineFeature == cfgLineFeatureSpeedDialBLF) {
            ccsnap_gen_blfFeatureEvent(status, appId);
        }
    }
}
Beispiel #20
0
void ccsnap_set_phone_services_provisioning(boolean misd, boolean plcd, boolean rcvd) {
   CCAPP_ERROR(DEB_F_PREFIX"missed=%d placed=%d received=%d\n",
    		DEB_F_PREFIX_ARGS(SIP_CC_PROV, "ccsnap_set_phone_services_provisioning"), misd, plcd, rcvd);
   missed = misd;
   placed = plcd;
   received = rcvd;
}
Beispiel #21
0
void
dp_store_digits (line_t line, callid_t call_id, unsigned char digit)
{
    const char fname[] = "dp_store_digits";
    short len;

    if (g_dp_int.line != line && g_dp_int.call_id != call_id) {
        return;
    }

    if (digit == BKSPACE_KEY) {
        return;
    }

    g_dp_int.line = line;
    g_dp_int.call_id = call_id;

    len = (short) strlen(g_dp_int.gDialed);
    if (len >= MAX_DIALSTRING-1)
    {   // safety check to prevent going out of bounds
        CCAPP_ERROR(DEB_F_PREFIX"Unexpected dialstring [%s] (length [%d] > max [%d]) received", DEB_F_PREFIX_ARGS(DIALPLAN, fname), g_dp_int.gDialed,
            len, MAX_DIALSTRING);
        return;    
    }

    g_dp_int.gDialed[len] = digit;
    g_dp_int.gDialed[len + 1] = 0;

    DPINT_DEBUG(DEB_F_PREFIX"digit = %c, dig_str = %s", DEB_F_PREFIX_ARGS(DIALPLAN, fname), digit,
                &g_dp_int.gDialed[0]);
}
Beispiel #22
0
/*
 *  Function: dp_reset()
 *
 *  Parameters: none
 *
 *  Description: Called during soft reset
 *
 *  Returns: none
 */
void
dp_reset (void)
{
    DPINT_DEBUG(DEB_F_PREFIX"Reset dp_int module\n", DEB_F_PREFIX_ARGS(DIALPLAN, "dp_reset"));
    /* cleanup redial buffer */
    memset(g_dp_int.gReDialed, 0, sizeof(g_dp_int.gReDialed));
}
Beispiel #23
0
/*
 * This function finds month (0 to 11) from month name
 * listed above in month_ar[]. This is used to convert the
 * date header from CCM to derive time/date.
 */
static boolean
set_month_from_str (char *month_str)
{
    boolean ret_val = FALSE;
    const char * fname = "set_month_from_str";
    int i;

    if (month_str) {
        if (strncmp(month_str, last_month_str, 3) != 0) {
            for (i = 0; i < 12; i++) {
                if (strncmp(month_str, month_ar[i], 3) == 0) {
                    sstrncpy(last_month_str, month_str, sizeof(last_month_str));
                    last_month = i;
                    ret_val = TRUE;
                    break;
                }
            }
        } else {
            ret_val = TRUE;
        }
    } else {
        TNP_DEBUG(DEB_F_PREFIX "Input month_str is NULL!!!! \n", DEB_F_PREFIX_ARGS(PLAT_API, fname));
    }
    return (ret_val);
}
Beispiel #24
0
/**
 * Returns the Video  mute state for this call
 * @return boolean true=muted false=not muted
 */
cc_boolean CCAPI_CallInfo_isVideoMuted (cc_callinfo_ref_t handle){
  static const char *fname="CCAPI_CallInfo_isVideoMuted";
  session_data_t *data = (session_data_t *)handle;
  session_data_t * sess_data_p;

  CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
  if ( data != NULL){
      sess_data_p = (session_data_t *)findhash(data->sess_id);
      if ( sess_data_p != NULL ) {
          CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), sess_data_p->video_mute);
          return sess_data_p->video_mute;
      }
  }

  return FALSE;
}
/*
 * sipsdp_write_to_buf()
 *
 * This function builds the specified SDP in a text buffer and returns
 * a pointer to this buffer.
 *
 * Returns: pointer to buffer - no errors
 *          NULL              - errors were encountered while building
 *                              the SDP. The details of the build failure
 *                              can be determined by enabling SDP debugs
 *                              and by examining SDP library error counters.
 */
char *
sipsdp_write_to_buf (cc_sdp_t *sdp_info, uint32_t *retbytes)
{
    flex_string fs;
	//    uint32_t sdp_len;
    sdp_result_e rc;

    flex_string_init(&fs);

    if (!sdp_info || !sdp_info->src_sdp) {
        CCSIP_DEBUG_ERROR(SIP_F_PREFIX"NULL sdp_info or src_sdp\n", __FUNCTION__);
        return (NULL);
    }

    if ((rc = sdp_build(sdp_info->src_sdp, &fs))
        != SDP_SUCCESS) {
        CCSIP_DEBUG_TASK(DEB_F_PREFIX"sdp_build rc=%s\n", DEB_F_PREFIX_ARGS(SIP_SDP, __FUNCTION__),
                         sdp_get_result_name(rc));

        flex_string_free(&fs);
        *retbytes = 0;
        return (NULL);
    }

    *retbytes = fs.string_length;

    /* We are not calling flex_string_free on this, instead returning the buffer
     * caller's responsibility to free
     */
    return fs.buffer;
}
/**
 * get media stream table
 * @param handle - call handle
 * @return status MediaStreamTable
 */
MediaStreamTable*  CCAPI_CallInfo_getMediaStreams(cc_callinfo_ref_t handle) {
  static const char *fname="CCAPI_CallInfo_getMediaStreams";
  session_data_t *data = (session_data_t *)handle;
  MediaTrack track;
  MediaStreamTable* table = cpr_malloc(sizeof(MediaStreamTable));
  if (!table)
    return NULL;

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

  if (data != NULL) {
    table->media_stream_id = data->media_stream_id;
	table->num_tracks = 1;   /* this will change when we have multiple tracks per stream */
	track.media_stream_track_id = data->media_stream_track_id;
	track.video = FALSE;
	table->track[0] = track;

	/*
	 * Partly implemented multi-track handling
	   cc_table = data->media_tracks;
	   table->stream_id = (unsigned int)cc_table->stream_id;
	   table->num_tracks = (unsigned int)cc_table->num_tracks;
	   track.track_id = cc_table->track[0].ref_id;
	   table->track[0] = track;
	*/
    return table;
  }

  return table;
}
Beispiel #27
0
/*
 *  Function: dp_start_dialing()
 *
 *  Parameters: line - line number
 *                                call_id - call indentification
 *
 *  Description: Start dialing and initilize dialing data.
 *
 *  Returns: none
 */
static void
dp_init_dialing_data (line_t line, callid_t call_id)
{
    const char fname[] = "dp_init_dialing_data";

    DPINT_DEBUG(DEB_F_PREFIX"line=%d call_id=%d\n", DEB_F_PREFIX_ARGS(DIALPLAN, fname), line, call_id);

    g_dp_int.call_id = call_id;
    g_dp_int.line = line;
    g_dp_int.gDialplanDone = FALSE;
    g_dp_int.url_dialing = FALSE;
    g_dp_int.gTimerType = DP_NONE_TIMER;

    memset(g_dp_int.gDialed, 0, sizeof(g_dp_int.gDialed));

    /* get offhook timeout */
    g_dp_int.offhook_timeout = DIAL_TIMEOUT;

    config_get_value(CFGID_OFFHOOK_TO_FIRST_DIGIT_TIMER,
                     &g_dp_int.offhook_timeout,
                     sizeof(g_dp_int.offhook_timeout));

    /* Flush any collected KPML digits on this line */
    kpml_flush_quarantine_buffer(line, call_id);
}
Beispiel #28
0
/*
 *  Function: dp_check_plar_line
 *
 *  Parameters: line
 *
 *  Description: Function returns true if the call and line is plar.
 *
 *  Returns: TRUE - if plar configured and dialing completed.
 */
boolean
dp_check_for_plar_line (line_t line)
{
    static char fname[] = "dp_check_for_plar_line";
    DialMatchAction action;
    char empty_rewrite[MAX_DIALSTRING];
    char empty[1];
    int timeout = 0;

    empty[0] = '\0';            // This empty (i.e. "") pattern.
    //Check dialplan to generate empty invite
    action = MatchDialTemplate(empty, line, (int *) &timeout,
                               empty_rewrite, sizeof(empty_rewrite),
                               NULL, NULL);

    if (action == DIAL_FULLMATCH) {

        /* Plar line is only when timeout == 0 or else it is warm line
         */
        if (timeout <= 0) {

            DPINT_DEBUG(DEB_F_PREFIX"line=%d PLAR line\n", DEB_F_PREFIX_ARGS(DIALPLAN, fname), line);
            return (TRUE);

        }
    }
    return (FALSE);
}
Beispiel #29
0
/*
 * capset_set_fcp_forwardall - sets the fcp-controlled call forward all feature
 *
 */
static void capset_set_fcp_forwardall (cc_boolean state)
{
   CONFIG_DEBUG(DEB_F_PREFIX"FCP Setting CALLFWD Capability to [%d]", DEB_F_PREFIX_ARGS(JNI, "capset_set_fcp_forwardall"), (unsigned int)state);

   capability_idleset[CCAPI_CALL_CAP_CALLFWD]       = state;
   capability_set[OFFHOOK][CCAPI_CALL_CAP_CALLFWD]  = state;
}
Beispiel #30
0
static void fsm_cac_notify_failure (cac_data_t *cac_data)
{
    const char fname[] = "fsm_cac_notify_failure";
    cc_setup_t     *msg = (cc_setup_t *) cac_data->msg_ptr;
    cc_msgs_t       msg_id   = msg->msg_id;
    callid_t        call_id  = msg->call_id;
    line_t          line     = msg->line;
    int             event_id = msg_id;
    cc_srcs_t       src_id  = msg->src_id;

    /* Notify UI about the failure */
    lsm_ui_display_notify_str_index(STR_INDEX_NO_BAND_WIDTH);

    /* Send response from network side regarding the failure */
    if (event_id == CC_MSG_SETUP &&
            src_id == CC_SRC_SIP) {
        DEF_DEBUG(DEB_F_PREFIX"Send CAC failure to SIP %d.",
                    DEB_F_PREFIX_ARGS("CAC", fname), cac_data->call_id);
        cc_int_release(CC_SRC_GSM, CC_SRC_SIP, call_id, line,
                       CC_CAUSE_CONGESTION, NULL, NULL);
    } else {
        /* If the cac failed, GSM is not spinning yet, so just send the
         * information to UI in this case. Other case, where GSM receives event
         * will send the information from GSM.
         * If the UI is not cleaned up, session infomation is not cleared.
         */
        ui_call_state(evOnHook, line, call_id, CC_CAUSE_CONGESTION);
    }

}