Ejemplo n.º 1
0
/**
 * This function will print the stats (invoked by show command)
 *
 * @param[in] none
 *
 * @return 0 always
 */
cc_int32_t show_publish_stats (cc_int32_t argc, const char *argv[])
{
    debugif_printf("------ Current PUBLISH Statistics ------\n");
    if (s_PCB_list != NULL) {
        debugif_printf("Number of PCBs allocated: %d\n", sll_count(s_PCB_list));
    } else {
        debugif_printf("Number of PCBs allocated: 0\n");
    }
    debugif_printf("Total outgoing PUBLISH requests: %d\n", outgoingPublishes);
    return 0;
}
Ejemplo n.º 2
0
cc_int32_t
fsm_show_cmd (cc_int32_t argc, const char *argv[])
{
    fsm_fcb_t      *fcb;
    int             i = 0;
    void           *cb = NULL;

    /*
     * check if need help
     */
    if ((argc == 2) && (argv[1][0] == '?')) {
        debugif_printf("show fsm\n");
        return 0;
    }

    /*
     * Print the fcbs
     */
    debugif_printf("\n----------------------------- FSM fcbs -------------------------------");
    debugif_printf("\ni    call_id  fcb         type       state      dcb         cb        ");
    debugif_printf("\n----------------------------------------------------------------------\n");

    FSM_FOR_ALL_CBS(fcb, fsm_fcbs, FSM_MAX_FCBS) {
        switch (fcb->fsm_type) {
        case FSM_TYPE_CNF:
            cb = fcb->ccb;
            break;

        case FSM_TYPE_B2BCNF:
            cb = fcb->ccb;
            break;

        case FSM_TYPE_XFR:
            cb = fcb->xcb;
            break;

        case FSM_TYPE_DEF:
            cb = fcb->dcb;
            break;

        default:
            cb = NULL;
        }

        debugif_printf("%-3d  %-7d  0x%8p  %-9s  %-9s  0x%8p  0x%8p\n",
                       i++, fcb->call_id, fcb, fsm_type_name(fcb->fsm_type),
                       fsm_state_name(fcb->fsm_type, fcb->state),
                       fcb->dcb, cb);
    }

    return (0);
}
Ejemplo n.º 3
0
/*
 *  Function: show_dialplan_cmd
 *
 *  Parameters:   standard args
 *
 *  Description:  Display the current dialplan (if any)
 *
 *  Returns:
 *
 */
int32_t
show_dialplan_cmd (int32_t argc, const char *argv[])
{
    struct DialTemplate *pTemp;
    char umode[32], rmode[32];
    char line_str[32];
    uint32_t idx = 1;
    int32_t counter = 0;

    debugif_printf("Dialplan is....\n");
    debugif_printf("Dialplan version: %s\n", g_dp_version_stamp);

    pTemp = basetemplate;
    if (basetemplate == NULL) {
        debugif_printf("EMPTY\n");
        return 0;
    }
    while (pTemp != NULL) {
        switch (pTemp->routeMode) {
        case RouteEmergency:
            sstrncpy(rmode, "Emergency", sizeof(rmode));
            break;
        case RouteFQDN:
            sstrncpy(rmode, "FQDN", sizeof(rmode));
            break;
        default:
            sstrncpy(rmode, "Default", sizeof(rmode));
            break;
        }

        switch (pTemp->userMode) {
        case UserPhone:
            sstrncpy(umode, "Phone", sizeof(umode));
            break;
        case UserIP:
            sstrncpy(umode, "IP", sizeof(umode));
            break;
        default:
            sstrncpy(umode, "Unspecified", sizeof(umode));
            break;
        }

        if (pTemp->line == 0) {
            sprintf(line_str, "All");
        } else {
            sprintf(line_str, "%d", pTemp->line);
        }
        debugif_printf("%02d. Pattern: %s  Rewrite: %s Line: %s\n"
                       "    Timeout: %04d   UserMode: %s  RouteMode: %s\n",
                       idx, pTemp->pattern, pTemp->rewrite, line_str,
                       pTemp->timeout, umode, rmode);
        for (counter = 0; counter < pTemp->tones_defined; counter++) {
            debugif_printf("    Tone %d: %s\n", counter + 1,
                           tone_names[(int) (pTemp->tone[counter])]);
        }
        pTemp = pTemp->next;
        idx++;

    }
    return (0);
}
Ejemplo n.º 4
0
/*
 *  Function: ParseDialTemplate()
 *
 *  Parameters: parseptr - pointer to bytes to be parsed
 *
 *  Description: Parse the contents of a dial template XML file
 *      All Start and end tags are ignored
 *      The empty element <TEMPLATE is parsed by ParseDialEntry
 *
 *  Returns: false if parse fails else true
 */
boolean
ParseDialTemplate (char *parseptr)
{
    char buffer[MAX_TEMPLATE_LENGTH];
    XMLToken tok;
    int LookKey;
    int LookEndKey;
    int errors = 0;
    int insideDialPlan = 0;

    LookKey = 0;
    LookEndKey = 0;
    FreeDialTemplates();
    /*
     * reset the version stamp so that dialplans that do not contain versionStamp
     * tag will not keep the previous versionstamp.
     */
    g_dp_version_stamp[0] = 0;


    if (parseptr == NULL) {
        debugif_printf("ParseDialTempate(): parseptr=NULL Returning.\n");
        return (FALSE);
    }

    while ((tok =
            parse_xml_tokens(&parseptr, buffer, sizeof(buffer))) != TOK_EOF) {
        if (LookEndKey) {
            if (tok == TOK_RBRACKET) {
                LookEndKey = 0;
            } else if ((tok == TOK_KEYWORD)
                       && !cpr_strcasecmp(buffer, "DIALTEMPLATE")) {
                insideDialPlan = 0;
            }
        } else if (tok == TOK_LBRACKET) {
            LookKey = 1;
        } else if ((LookKey != 0) && (tok == TOK_KEYWORD)
                   && !cpr_strcasecmp(buffer, "DIALTEMPLATE")) {
            insideDialPlan = 1;
        } else if ((LookKey != 0) && (tok == TOK_KEYWORD)
                   && !strcmp(buffer, "TEMPLATE")) {
            if (insideDialPlan) {
                errors += ParseDialEntry(&parseptr);
            } else {
                errors++;
            }
        } else if ((LookKey != 0) && (tok == TOK_KEYWORD)
                   && !cpr_strcasecmp(buffer, "versionStamp")) {
            if (insideDialPlan) {
                /* <versionStamp> tag found. parse it */
                errors += ParseDialVersion(&parseptr);
            } else {
                errors++;
            }
        } else if (tok == TOK_ENDLBRACKET) {
            LookEndKey = 1;
        } else {
            LookKey = 0;
        }
    }
    /*
     * If we had any parse errors, put them into the log
     */
    log_clear(LOG_CFG_PARSE_DIAL);
    if (errors != 0) {
        log_msg(LOG_CFG_PARSE_DIAL, errors, DialTemplateFile);
        return (FALSE);
    }

    return (TRUE);
}
Ejemplo n.º 5
0
cc_int32_t
show_config_cmd (cc_int32_t argc, const char *argv[])
{
    const var_t *table;
    char buf[MAX_CONFIG_VAL_PRINT_LEN];
    int i, feat;

    debugif_printf("\n%s\n", "------ Current *Cache* Configuration ------");
    table = prot_cfg_table;

    for ( i=0; i < CFGID_LINE_FEATURE; i++ ) {
        if (table->print_func) {
            table->print_func(table, buf, sizeof(buf));

            // If this field has a password, print the param name, but NOT the
            // real password
            if (strstr(table->name, "Password") != 0) {
                // and add an invisible one
                sstrncpy(buf, "**********", sizeof(buf));
            }
            debugif_printf("%s : %s\n", table->name, buf);
        }
        table++;
    }

    debugif_printf("%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
        prot_cfg_table[CFGID_LINE_INDEX].name,
        prot_cfg_table[CFGID_LINE_FEATURE].name,
        prot_cfg_table[CFGID_LINE_MAXNUMCALLS].name,
        prot_cfg_table[CFGID_LINE_BUSY_TRIGGER].name,
        prot_cfg_table[CFGID_PROXY_ADDRESS].name,
        prot_cfg_table[CFGID_PROXY_PORT].name,
        prot_cfg_table[CFGID_LINE_CALL_WAITING].name,
        prot_cfg_table[CFGID_LINE_MSG_WAITING_LAMP].name,
        prot_cfg_table[CFGID_LINE_MESSAGE_WAITING_AMWI].name,
        prot_cfg_table[CFGID_LINE_RING_SETTING_IDLE].name,
        prot_cfg_table[CFGID_LINE_RING_SETTING_ACTIVE].name,
        prot_cfg_table[CFGID_LINE_NAME].name,
        prot_cfg_table[CFGID_LINE_AUTOANSWER_ENABLED].name,
        prot_cfg_table[CFGID_LINE_AUTOANSWER_MODE].name,
        prot_cfg_table[CFGID_LINE_AUTHNAME].name,
        prot_cfg_table[CFGID_LINE_PASSWORD].name,
        prot_cfg_table[CFGID_LINE_DISPLAYNAME].name,
        prot_cfg_table[CFGID_LINE_CONTACT].name);

    for (i=0; i< MAX_CONFIG_LINES; i++) {
      config_get_value(CFGID_LINE_FEATURE+i, &feat, sizeof(feat));
      if ( feat != CC_FEATURE_NONE ){
        debugif_printf("%3s ", get_printable_cfg(CFGID_LINE_INDEX+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%4s ", get_printable_cfg(CFGID_LINE_FEATURE+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%3s ", get_printable_cfg(CFGID_LINE_MAXNUMCALLS+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%3s ", get_printable_cfg(CFGID_LINE_BUSY_TRIGGER+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%12s ", get_printable_cfg(CFGID_PROXY_ADDRESS+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%s ", get_printable_cfg(CFGID_PROXY_PORT+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%3s ", get_printable_cfg(CFGID_LINE_CALL_WAITING+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%6s ", get_printable_cfg(CFGID_LINE_MSG_WAITING_LAMP+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%6s ", get_printable_cfg(CFGID_LINE_MESSAGE_WAITING_AMWI+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%6s ", get_printable_cfg(CFGID_LINE_RING_SETTING_IDLE+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%6s ", get_printable_cfg(CFGID_LINE_RING_SETTING_ACTIVE+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("     %s ", get_printable_cfg(CFGID_LINE_NAME+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%s ", get_printable_cfg(CFGID_LINE_AUTOANSWER_ENABLED+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%s ", get_printable_cfg(CFGID_LINE_AUTOANSWER_MODE+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%s ", get_printable_cfg(CFGID_LINE_AUTHNAME+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%s ", get_printable_cfg(CFGID_LINE_PASSWORD+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%s ", get_printable_cfg(CFGID_LINE_DISPLAYNAME+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
        debugif_printf("%s\n", get_printable_cfg(CFGID_LINE_CONTACT+i, buf, MAX_CONFIG_VAL_PRINT_LEN));
      }
    }

    return (0);
}
Ejemplo n.º 6
0
int32_t
cprShowMessageQueueStats (int32_t argc, const char *argv[])
{
    debugif_printf("CPR Message Queues\n");
    return 0;
}