Пример #1
0
struct callerid_state *callerid_new(int cid_signalling)
{
	struct callerid_state *cid;

	if ((cid = ast_calloc(1, sizeof(*cid)))) {
#ifdef INTEGER_CALLERID
		cid->fskd.ispb = 7;          	/* 1200 baud */	
		/* Set up for 1200 / 8000 freq *32 to allow ints */
		cid->fskd.pllispb  = (int)(8000 * 32  / 1200);
		cid->fskd.pllids   = cid->fskd.pllispb/32;
		cid->fskd.pllispb2 = cid->fskd.pllispb/2;
		
		cid->fskd.icont = 0;           /* PLL REset */
		/* cid->fskd.hdlc = 0; */     	/* Async */
		cid->fskd.nbit = 8;           	/* 8 bits */
		cid->fskd.instop = 1;        	/* 1 stop bit */
		/* cid->fskd.paridad = 0; */  	/* No parity */
		cid->fskd.bw = 1;             	/* Filter 800 Hz */
		if (cid_signalling == 2) {    	/* v23 signalling */
			cid->fskd.f_mark_idx  = 4;	/* 1300 Hz */
			cid->fskd.f_space_idx = 5;	/* 2100 Hz */
		} else {                      	/* Bell 202 signalling as default */
			cid->fskd.f_mark_idx  = 2;	/* 1200 Hz */
			cid->fskd.f_space_idx = 3;	/* 2200 Hz */
		}
		/* cid->fskd.pcola = 0; */    	/* No clue */
		/* cid->fskd.cont = 0.0; */   	/* Digital PLL reset */
		/* cid->fskd.x0 = 0.0; */
		/* cid->fskd.state = 0; */
		cid->flags = CID_UNKNOWN_NAME | CID_UNKNOWN_NUMBER;
		/* cid->pos = 0; */

		fskmodem_init(&cid->fskd);
#else
		cid->fskd.spb = 7.0;          	/* 1200 baud */
		/* cid->fskd.hdlc = 0; */     	/* Async */
		cid->fskd.nbit = 8;           	/* 8 bits */
		cid->fskd.nstop = 1.0;        	/* 1 stop bit */
		/* cid->fskd.paridad = 0; */  	/* No parity */
		cid->fskd.bw = 1;             	/* Filter 800 Hz */
		if (cid_signalling == 2) {    	/* v23 signalling */
			cid->fskd.f_mark_idx =  4;	/* 1300 Hz */
			cid->fskd.f_space_idx = 5;	/* 2100 Hz */
		} else {                      	/* Bell 202 signalling as default */
			cid->fskd.f_mark_idx =  2;	/* 1200 Hz */
			cid->fskd.f_space_idx = 3;	/* 2200 Hz */
		}
		/* cid->fskd.pcola = 0; */    	/* No clue */
		/* cid->fskd.cont = 0.0; */   	/* Digital PLL reset */
		/* cid->fskd.x0 = 0.0; */
		/* cid->fskd.state = 0; */
		cid->flags = CID_UNKNOWN_NAME | CID_UNKNOWN_NUMBER;
		/* cid->pos = 0; */
#endif
	}

	return cid;
}
Пример #2
0
struct tdd_state *tdd_new(void)
{
	struct tdd_state *tdd;
	tdd = ast_calloc(1, sizeof(*tdd));
	if (tdd) {
#ifdef INTEGER_CALLERID
		tdd->fskd.ispb = 176;        /* 45.5 baud */
		/* Set up for 45.5 / 8000 freq *32 to allow ints */
		tdd->fskd.pllispb  = (int)((8000 * 32 * 2) / 90);
		tdd->fskd.pllids   = tdd->fskd.pllispb / 32;
		tdd->fskd.pllispb2 = tdd->fskd.pllispb / 2;
		tdd->fskd.hdlc = 0;         /* Async */
		tdd->fskd.nbit = 5;         /* 5 bits */
		tdd->fskd.instop = 1;       /* integer rep of 1.5 stop bits */
		tdd->fskd.parity = 0;       /* No parity */
		tdd->fskd.bw=0;             /* Filter 75 Hz */
		tdd->fskd.f_mark_idx = 0;   /* 1400 Hz */
		tdd->fskd.f_space_idx = 1;  /* 1800 Hz */
		tdd->fskd.xi0  = 0;
		tdd->fskd.state = 0;
		tdd->pos = 0;
		tdd->mode = 0;
		fskmodem_init(&tdd->fskd);
#else
		tdd->fskd.spb = 176;        /* 45.5 baud */
		tdd->fskd.hdlc = 0;         /* Async */
		tdd->fskd.nbit = 5;         /* 5 bits */
		tdd->fskd.nstop = 1.5;      /* 1.5 stop bits */
		tdd->fskd.parity = 0;       /* No parity */
		tdd->fskd.bw=0;             /* Filter 75 Hz */
		tdd->fskd.f_mark_idx = 0;   /* 1400 Hz */
		tdd->fskd.f_space_idx = 1;  /* 1800 Hz */
		tdd->fskd.pcola = 0;        /* No clue */
		tdd->fskd.cont = 0;         /* Digital PLL reset */
		tdd->fskd.x0 = 0.0;
		tdd->fskd.state = 0;
		tdd->pos = 0;
		tdd->mode = 2;
#endif
		tdd->charnum = 0;
	} else
		ast_log(LOG_WARNING, "Out of memory\n");
	return tdd;
}