示例#1
0
static void super_tone_rx_fill_descriptor(super_tone_rx_descriptor_t *desc)
{
    int tone_id;

    tone_id = super_tone_rx_add_tone(desc);
    super_tone_rx_add_element(desc, tone_id, 400, 0, 700, 0);
    tone_names[tone_id] = "XXX";

    tone_id = super_tone_rx_add_tone(desc);
    super_tone_rx_add_element(desc, tone_id, 1100, 0, 400, 600);
    super_tone_rx_add_element(desc, tone_id, 0, 0, 2800, 3200);
    tone_names[tone_id] = "FAX tone";
}
/**
 * Add a tone to the tone descriptor
 *
 * @param descriptor the tone descriptor
 * @param key the tone key - this will be returned by the detector upon match
 * @return the tone ID
 */
int tone_descriptor_add_tone(tone_descriptor_t *descriptor, const char *key)
{
	int id = super_tone_rx_add_tone(descriptor->spandsp_tone_descriptor);
	if (id >= MAX_TONES) {
		return -1;
	}
	switch_set_string(descriptor->tone_keys[id], key);

	if (id > descriptor->idx) {
		descriptor->idx = id;
	}

	return id;
}
示例#3
0
static void parse_tone_set(super_tone_rx_descriptor_t *desc, xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur)
{
    int tone_id;

    printf("Parsing tone set\n");
    cur = cur->xmlChildrenNode;
    while (cur)
    {
        if (strcmp((char *) cur->name, "dial-tone") == 0)
        {
            printf("Hit %s\n", cur->name);
            tone_id = super_tone_rx_add_tone(desc);
            dialtone_tree = NULL;
            parse_tone(desc, tone_id, &dialtone_tree, doc, ns, cur);
            tone_names[tone_id] = "Dial tone";
        }
        else if (strcmp((char *) cur->name, "ringback-tone") == 0)
        {
            printf("Hit %s\n", cur->name);
            tone_id = super_tone_rx_add_tone(desc);
            ringback_tree = NULL;
            parse_tone(desc, tone_id, &ringback_tree, doc, ns, cur);
            tone_names[tone_id] = "Ringback tone";
        }
        else if (strcmp((char *) cur->name, "busy-tone") == 0)
        {
            printf("Hit %s\n", cur->name);
            tone_id = super_tone_rx_add_tone(desc);
            busytone_tree = NULL;
            parse_tone(desc, tone_id, &busytone_tree, doc, ns, cur);
            tone_names[tone_id] = "Busy tone";
        }
        else if (strcmp((char *) cur->name, "number-unobtainable-tone") == 0)
        {
            printf("Hit %s\n", cur->name);
            tone_id = super_tone_rx_add_tone(desc);
            nutone_tree = NULL;
            parse_tone(desc, tone_id, &nutone_tree, doc, ns, cur);
            tone_names[tone_id] = "NU tone";
        }
        else if (strcmp((char *) cur->name, "congestion-tone") == 0)
        {
            printf("Hit %s\n", cur->name);
            tone_id = super_tone_rx_add_tone(desc);
            congestiontone_tree = NULL;
            parse_tone(desc, tone_id, &congestiontone_tree, doc, ns, cur);
            tone_names[tone_id] = "Congestion tone";
        }
        else if (strcmp((char *) cur->name, "waiting-tone") == 0)
        {
            printf("Hit %s\n", cur->name);
            tone_id = super_tone_rx_add_tone(desc);
            waitingtone_tree = NULL;
            parse_tone(desc, tone_id, &waitingtone_tree, doc, ns, cur);
            tone_names[tone_id] = "Waiting tone";
        }
        /*endif*/
        cur = cur->next;
    }
    /*endwhile*/
}