Example #1
0
/*
 * sip_minimum_config_check()
 *
 * Return indication if the SIP minimum configuration
 * requirements have been met.
 * Returns 0 if minimum config is met
 * Returns non-zero if minimum config has not been met
 *   (eg. missing at least 1 required parameter)
 */
int
sip_minimum_config_check (void)
{
    char str_val[MAX_IPADDR_STR_LEN];
    char line_name[MAX_LINE_NAME_SIZE];
    int value;

    /*
     * Make sure that line 1 is configured
     */
    config_get_line_string(CFGID_LINE_NAME, line_name, 1, sizeof(line_name));
    if ((strcmp(line_name, UNPROVISIONED) == 0) || (line_name[0] == '\0')) {
        return -1;
    }

    config_get_line_string(CFGID_PROXY_ADDRESS, str_val, 1, MAX_IPADDR_STR_LEN);
    if ((strcmp(str_val, UNPROVISIONED) == 0) || (str_val[0] == '\0')) {
        return -1;
    }

    config_get_line_value(CFGID_PROXY_PORT, &value, sizeof(value), 1);
    if (value == 0) {
        return -1;
    }

    return 0;
}
Example #2
0
/*
 * sip_config_get_display_name()
 *
 * Get the display name
 */
void
sip_config_get_display_name (line_t line, char *buffer, int buffer_len)
{

    config_get_line_string(CFGID_LINE_DISPLAYNAME, buffer, line, buffer_len);

    if ((strcmp(buffer, UNPROVISIONED) == 0) || (buffer[0] == '\0')) {
        config_get_line_string(CFGID_LINE_NAME, buffer, line, buffer_len);
    }
}
Example #3
0
/*
 * sip_config_get_proxy_addr()
 *
 * Get table entry from the table string and option number
 */
void
sip_config_get_proxy_addr (line_t line, char *buffer, int buffer_len)
{
    config_get_line_string(CFGID_PROXY_ADDRESS, buffer, line, buffer_len);

    if ((strcmp(buffer, UNPROVISIONED) == 0) || (buffer[0] == '\0')) {
        config_get_line_string(CFGID_PROXY_ADDRESS, buffer, DEFAULT_LINE,
                               buffer_len);
    }
}
Example #4
0
/*
 *  sip_config_get_line_by_called_number
 *
 *  Return the line by the given called_number
 */
line_t sip_config_get_line_by_called_number (line_t start_line, const char *called_number)
{
    int             i;
    line_t          max_lines;
    line_t          line = 0;
    char            line_name[MAX_LINE_NAME_SIZE];
    char            contact[MAX_LINE_CONTACT_SIZE];
    char           *name;

    max_lines = sip_config_local_line_get();

    /*
     * Check the called number for the E.164 "+"
     * and ignore it if present.
     */
    if (called_number[0] == '+') {
        called_number++;
    }

    for (i = start_line; i <= max_lines; i++) {
        if (sip_config_check_line((line_t)i)) {
            config_get_line_string(CFGID_LINE_NAME, line_name, i,
                                   sizeof(line_name));
            /*
             * Check the configured line name for the E.164 "+"
             * and ignore it if present.
             */
            name = &line_name[0];
            if (line_name[0] == '+') {
                name++;
            }

            if (cpr_strcasecmp(called_number, name) == 0) {
                line = (line_t)i;
                break;
            }
        }
    }

    // If line not found - check with contact list
    if (line == 0) {
        for (i = start_line; i <= max_lines; i++) {
            if (sip_config_check_line((line_t)i)) {
                config_get_line_string(CFGID_LINE_CONTACT, contact, i,
                                       sizeof(contact));
                if (cpr_strcasecmp(called_number, contact) == 0) {
                    line = (line_t)i;
                    break;
                }
            }
        }
    }

    return (line);
}
/*
 *  Function:    sub_hndlr_start
 *
 *  Description: does blf subscriptions upon registration.
 *
 *  Parameters: none.
 *
 *  Returns:   void
 */
void sub_hndlr_start()
{
    static const char fname[] = "sub_hndlr_start";
    int i;
    cc_uint32_t lineFeature = 0;
    cc_uint32_t featureOptionMask = 0;
    char speedDialNumber[MAX_LINE_NAME_SIZE] = {0};
    char primaryLine[MAX_LINE_NAME_SIZE] = {0};
    int transId;

    CCAPP_DEBUG(DEB_F_PREFIX"entering\n",
                DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
    /* let the system know that subscription handler is available. */
    isAvailable = TRUE;

    /* get primary DN */
    config_get_line_string(CFGID_LINE_NAME, primaryLine, 1, sizeof(primaryLine));

    /*
     * for speeddial/BLF buttons, make presence subscriptions.
     */
    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);


        CCAPP_DEBUG(DEB_F_PREFIX"inst=%d, lineFeature=%d\n",
                    DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
                    i, lineFeature);
        switch (lineFeature) {
        case cfgLineFeatureSpeedDialBLF:
            config_get_line_string(CFGID_LINE_SPEEDDIAL_NUMBER, speedDialNumber, i, sizeof(speedDialNumber));
            if (speedDialNumber[0] == 0) {
                break;
            }
            config_get_line_value(CFGID_LINE_FEATURE, &featureOptionMask, sizeof(featureOptionMask), i);

            transId = get_new_trans_id();
            transactionIds[i - 1] = transId;
            CC_BLF_subscribe(transId,
                             INT_MAX,
                             primaryLine,
                             speedDialNumber,
                             i,
                             featureOptionMask );
            break;
        default:
            break;
        }

        //Initializes native BLF handler
        ccBLFHandlerInitialized();
    }
}
Example #6
0
/*
 * sip_config_check_line()
 *
 * Check to see if the indicated line is configured as a DN line
 *
 * Parameters: line - the line instance
 *
 * Returns: TRUE if the indicated line is Valid
 *          FALSE if the indicated line is Invalid
 *
 */
boolean
sip_config_check_line (line_t line)
{
    const char fname[] = "sip_config_check_line";
    char     temp[MAX_LINE_NAME_SIZE];
    uint32_t line_feature;
    line_t   max_lines_allowed;

    if (Is794x) {
        max_lines_allowed = MAX_REG_LINES_794X;
    } else {
        max_lines_allowed = MAX_REG_LINES;
    }

    if ((line < 1) || (line > max_lines_allowed)) {
        if (line != 0) {
            PLAT_ERROR(PLAT_COMMON_F_PREFIX"Invalid Line: %d", fname, line);
        }
        return FALSE;
    }

    config_get_line_string(CFGID_LINE_NAME, temp, line, sizeof(temp));
    if (temp[0] == '\0') {
        return FALSE;
    }

    config_get_line_value(CFGID_LINE_FEATURE, &line_feature,
                          sizeof(line_feature), line);

    if (line_feature != cfgLineFeatureDN) {
        return FALSE;
    }

    return TRUE;
}
/*
 *  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);
        }
    }
}
/*
 *  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;
        }
    }
}