Maybe it's a bug?

static int linkset_addsigchan(int sigchan)
{
struct dahdi_ss7 *link;
int res;
int curfd;
struct dahdi_params p;
struct dahdi_bufferinfo bi;
struct dahdi_spaninfo si;

link = ss7_resolve_linkset(cur_linkset);
if (!link) {
	ast_log(LOG_ERROR, "Invalid linkset number.  Must be between 1 and %d\n", NUM_SPANS + 1);
	return -1;
}

I think “NUM_SPANS + 1” should be “NUM_SPANS”