[asterisk-dev] chan_skinny fixes

Sergio Chersovani mlists at c-net.it
Wed Apr 5 14:22:15 MST 2006


Jeremy McNamara ha scritto:
> This is about his accusation that North's work is based on chan_sccp, 
> which nobody but Sergio can see - So I am asking him for the proof.
Well now I really think you are not smart nor a developer

This is my function since august 2005, below you will find north's patch 
function

void sccp_dev_build_buttontemplate(sccp_device_t *d, btnlist * btn) {
    uint8_t i;
    if (!d || !d->session)
        return;
    sccp_log(10)(VERBOSE_PREFIX_3 "%s: Building button template %s(%d), 
user config %s\n",    d->id, skinny_devicetype2str(d->skinny_type), 
d->skinny_type, d->config_type);
   
    if (!strcasecmp(d->config_type,"7914")) {
        for (i = 0 ; i < 34 ; i++)
            (btn++)->type = SKINNY_BUTTONTYPE_MULTI;
        return;
    }

    switch (d->skinny_type) {
        case SKINNY_DEVICETYPE_30SPPLUS:
        case SKINNY_DEVICETYPE_30VIP:
            for (i = 0 ; i < 4 ; i++)
                (btn++)->type = SKINNY_BUTTONTYPE_LINE;
            for (i = 0 ; i < 9 ; i++)
                (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
                    /* Column 2 */
            (btn++)->type = SKINNY_BUTTONTYPE_VOICEMAIL;
            (btn++)->type = SKINNY_BUTTONTYPE_FORWARDALL;
            (btn++)->type = SKINNY_BUTTONTYPE_CONFERENCE;
            (btn++)->type = SKINNY_BUTTONTYPE_CALLPARK;
            for (i = 0 ; i < 9 ; i++)
                (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
            break;
        case SKINNY_DEVICETYPE_12SPPLUS:
        case SKINNY_DEVICETYPE_12SP:
        case SKINNY_DEVICETYPE_12:
            (btn++)->type = SKINNY_BUTTONTYPE_LINE;
            (btn++)->type = SKINNY_BUTTONTYPE_LINE;
            (btn++)->type = SKINNY_BUTTONTYPE_LASTNUMBERREDIAL;
            (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
            (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
            (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
            (btn++)->type = SKINNY_BUTTONTYPE_HOLD;
            (btn++)->type = SKINNY_BUTTONTYPE_TRANSFER;
            (btn++)->type = SKINNY_BUTTONTYPE_FORWARDALL;
            (btn++)->type = SKINNY_BUTTONTYPE_CALLPARK;
            (btn++)->type = SKINNY_BUTTONTYPE_VOICEMAIL;
            (btn++)->type = SKINNY_BUTTONTYPE_CONFERENCE;
            break;
        case SKINNY_DEVICETYPE_CISCO7902:
            (btn++)->type = SKINNY_BUTTONTYPE_LINE;
            (btn++)->type = SKINNY_BUTTONTYPE_HOLD;
            (btn++)->type = SKINNY_BUTTONTYPE_TRANSFER;
            (btn++)->type = SKINNY_BUTTONTYPE_DISPLAY;
            (btn++)->type = SKINNY_BUTTONTYPE_VOICEMAIL;
            (btn++)->type = SKINNY_BUTTONTYPE_CONFERENCE;
            (btn++)->type = SKINNY_BUTTONTYPE_FORWARDALL;
            (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
            (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
            (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
            (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
            (btn++)->type = SKINNY_BUTTONTYPE_LASTNUMBERREDIAL;
            break;
        case SKINNY_DEVICETYPE_CISCO7912:
        case SKINNY_DEVICETYPE_CISCO7911:
        case SKINNY_DEVICETYPE_CISCO7905:
            (btn++)->type = SKINNY_BUTTONTYPE_LINE;
            (btn++)->type = SKINNY_BUTTONTYPE_HOLD;
            for (i = 0 ; i < 9 ; i++)
                (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;

            break;
        case SKINNY_DEVICETYPE_CISCO7935:
        case SKINNY_DEVICETYPE_CISCO7936:
            (btn++)->type = SKINNY_BUTTONTYPE_LINE;
            (btn++)->type = SKINNY_BUTTONTYPE_LINE;
            break;
        case SKINNY_DEVICETYPE_CISCO7910:
                (btn++)->type = SKINNY_BUTTONTYPE_LINE;
                (btn++)->type = SKINNY_BUTTONTYPE_HOLD;
                (btn++)->type = SKINNY_BUTTONTYPE_TRANSFER;
                (btn++)->type = SKINNY_BUTTONTYPE_DISPLAY;
                (btn++)->type = SKINNY_BUTTONTYPE_VOICEMAIL;
                (btn++)->type = SKINNY_BUTTONTYPE_CONFERENCE;
                (btn++)->type = SKINNY_BUTTONTYPE_FORWARDALL;
                (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
                (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
                (btn++)->type = SKINNY_BUTTONTYPE_LASTNUMBERREDIAL;
            break;
        case SKINNY_DEVICETYPE_CISCO7940:
        case SKINNY_DEVICETYPE_CISCO7941:
        case SKINNY_DEVICETYPE_CISCO7941GE:
                (btn++)->type = SKINNY_BUTTONTYPE_MULTI;
                (btn++)->type = SKINNY_BUTTONTYPE_MULTI;
            break;
        case SKINNY_DEVICETYPE_CISCO7920:
        case SKINNY_DEVICETYPE_CISCO7960:
        case SKINNY_DEVICETYPE_CISCO7961:
        case SKINNY_DEVICETYPE_CISCO7961GE:
                for (i = 0 ; i < 6 ; i++)
                    (btn++)->type = SKINNY_BUTTONTYPE_MULTI;
            break;
        case SKINNY_DEVICETYPE_CISCO7970:
        case SKINNY_DEVICETYPE_CISCO7971:
        case SKINNY_DEVICETYPE_CISCO_IP_COMMUNICATOR:
            for (i = 0 ; i < 8 ; i++)
                (btn++)->type = SKINNY_BUTTONTYPE_MULTI;
            break;
        case SKINNY_DEVICETYPE_ATA186:
            (btn++)->type = SKINNY_BUTTONTYPE_LINE;
            for (i = 0 ; i < 4 ; i++)
                (btn++)->type = SKINNY_BUTTONTYPE_SPEEDDIAL;
            break;
        default:
        /* at least one line */
        (btn++)->type = SKINNY_BUTTONTYPE_LINE;
    }
    return;
}

North's code?

static void *get_button_template(struct skinnysession *s, button_definition_template *btn)
+{
+	struct skinny_device *d = s->device;
+	struct skinny_addon *a = d->addons;
+	int i;
+
+	switch (d->type) {
+		case SKINNY_DEVICE_30SPPLUS:
+		case SKINNY_DEVICE_30VIP:
+			/* 13 rows, 2 columns */
+			for (i = 0; i < 4; i++)
+				(btn++)->buttonDefinition = BT_LINE;
+			(btn++)->buttonDefinition = BT_REDIAL;
+			(btn++)->buttonDefinition = BT_VOICEMAIL;
+			(btn++)->buttonDefinition = BT_CALLPARK;
+			(btn++)->buttonDefinition = BT_FORWARDALL;
+			(btn++)->buttonDefinition = BT_CONFERENCE;
+			for (i = 0; i < 4; i++)
+				(btn++)->buttonDefinition = BT_NONE;
+			for (i = 0; i < 13; i++)
+				(btn++)->buttonDefinition = BT_SPEEDDIAL;
+			
+			break;
+		case SKINNY_DEVICE_12SPPLUS:
+		case SKINNY_DEVICE_12SP:
+		case SKINNY_DEVICE_12:
+			/* 6 rows, 2 columns */
+			for (i = 0; i < 2; i++)
+				(btn++)->buttonDefinition = BT_LINE;
+			(btn++)->buttonDefinition = BT_REDIAL;
+			for (i = 0; i < 3; i++)
+				(btn++)->buttonDefinition = BT_SPEEDDIAL;
+			(btn++)->buttonDefinition = BT_HOLD;
+			(btn++)->buttonDefinition = BT_TRANSFER;
+			(btn++)->buttonDefinition = BT_FORWARDALL;
+			(btn++)->buttonDefinition = BT_CALLPARK;
+			(btn++)->buttonDefinition = BT_VOICEMAIL;
+			(btn++)->buttonDefinition = BT_CONFERENCE;
+			break;
+		case SKINNY_DEVICE_7910:
+			(btn++)->buttonDefinition = BT_LINE;
+			(btn++)->buttonDefinition = BT_HOLD;
+			(btn++)->buttonDefinition = BT_TRANSFER;
+			(btn++)->buttonDefinition = BT_DISPLAY;
+			(btn++)->buttonDefinition = BT_VOICEMAIL;
+			(btn++)->buttonDefinition = BT_CONFERENCE;
+			(btn++)->buttonDefinition = BT_FORWARDALL;
+			for (i = 0; i < 2; i++)
+				(btn++)->buttonDefinition = BT_SPEEDDIAL;
+			(btn++)->buttonDefinition = BT_REDIAL;
+			break;
+		case SKINNY_DEVICE_7960:
+		case SKINNY_DEVICE_7961:
+		case SKINNY_DEVICE_7961GE:
+			for (i = 0; i < 6; i++)
+				(btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
+			break;
+		case SKINNY_DEVICE_7940:
+		case SKINNY_DEVICE_7941:
+		case SKINNY_DEVICE_7941GE:
+			for (i = 0; i < 2; i++)
+				(btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
+			break;
+		case SKINNY_DEVICE_7935:
+		case SKINNY_DEVICE_7936:
+			for (i = 0; i < 2; i++)
+				(btn++)->buttonDefinition = BT_LINE;
+			break;
+		case SKINNY_DEVICE_ATA186:
+			(btn++)->buttonDefinition = BT_LINE;
+			break;
+		case SKINNY_DEVICE_7970:
+		case SKINNY_DEVICE_7971:
+		case SKINNY_DEVICE_CIPC:
+			for (i = 0; i < 8; i++)
+				(btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
+			break;
+		case SKINNY_DEVICE_7985:
+			/* I have no idea what the buttons look like on these. */
+			ast_log(LOG_WARNING, "Unsupported device type '%d (7985)' found.\n", d->type);
+			break;
+		case SKINNY_DEVICE_7912:
+		case SKINNY_DEVICE_7911:
+		case SKINNY_DEVICE_7905:
+			(btn++)->buttonDefinition = BT_LINE;
+			(btn++)->buttonDefinition = BT_HOLD;
+			/* If we wanted, we could put speed dials here, and they could be used with AbbrDial. */
+			break;
+		case SKINNY_DEVICE_7920:
+			/* I don't know if this is right. */
+			for (i = 0; i < 4; i++)
+				(btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
+			break;
+		case SKINNY_DEVICE_7902:
+			ast_log(LOG_WARNING, "Unsupported device type '%d (7902)' found.\n", d->type);
+			break;
+		case SKINNY_DEVICE_SCCPGATEWAY_AN:
+		case SKINNY_DEVICE_SCCPGATEWAY_BRI:
+			ast_log(LOG_WARNING, "Unsupported device type '%d (SCCP gateway)' found.\n", d->type);
+			break;
+		default:
+			ast_log(LOG_WARNING, "Unknown device type '%d' found.\n", d->type);
+			break;
+	}
+
+	a = d->addons;
+	while (a) {
+		if (!strcasecmp(a->type, "7914")) {
+			for (i = 0; i < 14; i++)
+				(btn++)->buttonDefinition = BT_CUST_LINESPEEDDIAL;
+		} else {
+			ast_log(LOG_WARNING, "Unknown addon type '%s' found.  Skipping.\n", a->type);
+		}
+		a = a->next;
+	}
+
+	return btn;
+}

fun uh? it looks the same function 

Sergio






More information about the asterisk-dev mailing list