diff -Naur asterisk.old/callerid.c asterisk/callerid.c --- asterisk.old/callerid.c 2004-08-04 19:45:56.000000000 +0100 +++ asterisk/callerid.c 2004-08-08 23:18:02.000000000 +0100 @@ -107,7 +107,7 @@ casdi2 = sin(CAS_FREQ2 * 2.0 * M_PI / 8000.0); } -struct callerid_state *callerid_new(void) +struct callerid_state *callerid_new(int cid_signalling) { struct callerid_state *cid; cid = malloc(sizeof(struct callerid_state)); @@ -119,8 +119,13 @@ cid->fskd.nstop = 1; /* 1 stop bit */ cid->fskd.paridad = 0; /* No parity */ cid->fskd.bw=1; /* Filter 800 Hz */ - cid->fskd.f_mark_idx = 2; /* 1200 Hz */ - cid->fskd.f_space_idx = 3; /* 2200 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; /* Digital PLL reset */ cid->fskd.x0 = 0.0; @@ -253,9 +258,9 @@ case 1: /* Date */ break; - case 2: /* Number */ - case 3: /* Number (for Zebble) */ - case 4: /* Number */ + case 2: /* Number (UK: Calling Number) */ + case 3: /* Number (for Zebble) (UK: Called Number */ + case 4: /* Number (UK: Reason for no Number, P=Withheld, O=Unavailable) */ res = cid->rawdata[x]; if (res > 32) { ast_log(LOG_NOTICE, "Truncating long caller ID number from %d bytes to 32\n", cid->rawdata[x]); @@ -265,8 +270,8 @@ /* Null terminate */ cid->number[res] = '\0'; break; - case 7: /* Name */ - case 8: /* Name */ + case 7: /* Name (UK: Calling Name or Text) */ + case 8: /* Name (UK: Reason for no Name, P=Withheld, O=Unavailable) */ res = cid->rawdata[x]; if (res > 32) { ast_log(LOG_NOTICE, "Truncating long caller ID name from %d bytes to 32\n", cid->rawdata[x]); @@ -275,6 +280,8 @@ memcpy(cid->name, cid->rawdata + x + 1, res); cid->name[res] = '\0'; break; + case 17: /* UK: Call type, 1=Voice Call, 2=Ringback when free, 129=Message waiting */ + case 19: /* UK: Network message system status (Number of messages waiting) */ case 22: /* Something French */ break; default: diff -Naur asterisk.old/channels/chan_zap.c asterisk/channels/chan_zap.c --- asterisk.old/channels/chan_zap.c 2004-08-08 19:45:46.000000000 +0100 +++ asterisk/channels/chan_zap.c 2004-08-08 23:29:36.000000000 +0100 @@ -156,6 +156,7 @@ static int usedistinctiveringdetection = 0; static int use_callerid = 1; +static int cid_signalling = 1; static int zaptrcallerid = 0; static int cur_signalling = -1; @@ -462,6 +463,7 @@ time_t guardtime; /* Must wait this much time before using for new call */ int dialednone; int use_callerid; /* Whether or not to use caller id on this channel */ + int cid_signalling; /* CID signalling type bell202 or v23 */ int hidecallerid; int callreturn; int permhidecallerid; /* Whether to hide our outgoing caller ID or not */ @@ -906,7 +908,10 @@ "Ringer Off", "Hook Transition Complete", "Bits Changed", - "Pulse Start" + "Pulse Start", + "Timer Expired", + "Timer Ping", + "Polarity Reversal" }; static struct { @@ -935,7 +940,7 @@ static char *event2str(int event) { static char buf[256]; - if ((event < 15) && (event > -1)) + if ((event < 18) && (event > -1)) return events[event]; sprintf(buf, "Event %d", event); /* safe */ return buf; @@ -5062,7 +5067,7 @@ } #endif if (p->use_callerid) { - cs = callerid_new(); + cs = callerid_new(p->cid_signalling); if (cs) { #if 1 bump_gains(p); @@ -5276,6 +5281,7 @@ } #endif break; + case ZT_EVENT_POLARITY: case ZT_EVENT_WINKFLASH: case ZT_EVENT_RINGOFFHOOK: if (i->inalarm) break; @@ -6153,6 +6159,7 @@ tmp->channel = channel; tmp->stripmsd = stripmsd; tmp->use_callerid = use_callerid; + tmp->cid_signalling = cid_signalling; tmp->zaptrcallerid = zaptrcallerid; tmp->restrictcid = restrictcid; tmp->use_callingpres = use_callingpres; @@ -8823,6 +8830,12 @@ sscanf(ringc, "%d,%d,%d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]); } else if (!strcasecmp(v->name, "usecallerid")) { use_callerid = ast_true(v->value); + } else if (!strcasecmp(v->name, "cidsignalling")) { + if (!strcasecmp(v->value, "bell202")) { + cid_signalling = 1; + } else if (!strcasecmp(v->value, "v23")) { + cid_signalling = 2; + } } else if (!strcasecmp(v->name, "threewaycalling")) { threewaycalling = ast_true(v->value); } else if (!strcasecmp(v->name, "cancallforward")) { @@ -9342,6 +9355,7 @@ language[0] = '\0'; musicclass[0] = '\0'; use_callerid = 1; + cid_signalling = 1; cur_signalling = -1; cur_group = 0; cur_callergroup = 0; @@ -9481,6 +9495,12 @@ sscanf(ringc, "%d,%d,%d", &drings.ringnum[2].ring[0], &drings.ringnum[2].ring[1], &drings.ringnum[2].ring[2]); } else if (!strcasecmp(v->name, "usecallerid")) { use_callerid = ast_true(v->value); + } else if (!strcasecmp(v->name, "cidsignalling")) { + if (!strcasecmp(v->value, "bell202")) { + cid_signalling = 1; + } else if (!strcasecmp(v->value, "v23")) { + cid_signalling = 2; + } } else if (!strcasecmp(v->name, "threewaycalling")) { threewaycalling = ast_true(v->value); } else if (!strcasecmp(v->name, "transfer")) { diff -Naur asterisk.old/coef_in.h asterisk/coef_in.h --- asterisk.old/coef_in.h 2001-03-20 20:11:26.000000000 +0000 +++ asterisk/coef_in.h 2004-08-08 23:15:46.000000000 +0100 @@ -6,4 +6,8 @@ }, { 9.8539686961e-02,-5.6297236492e-02,4.2915323820e-01,-1.2609358633e+00,2.2399213250e+00,-2.9928879142e+00,2.5990173742e+00,0.0000000000e+00, }, }, { { 1.8229206610e-04,-7.8997325866e-01,-7.7191410839e-01,-2.8075643964e+00,-1.6948618347e+00,-3.0367273700e+00,-9.0333559408e-01,0.0000000000e+00, }, { 9.8531161839e-02,-5.6297236492e-02,-1.1421579050e-01,-4.8122536483e-01,-4.0121072432e-01,-7.4834487567e-01,-6.9170822332e-01,0.0000000000e+00, - }, }, + }, }, { { 1.8229206611e-04,-7.8997325866e-01,2.5782298908e+00,-5.3629717478e+00,6.5890882172e+00,-5.8012914776e+00,3.0171839130e+00,0.0000000000e+00, + }, { 9.8534230718e-02,-5.6297236492e-02,3.8148618075e-01,-1.0848760410e+00,1.8441165168e+00,-2.4860666655e+00,2.3103384142e+00,0.0000000000e+00, + }, }, { { 1.8229206610e-04,-7.8997325866e-01,-3.8715051001e-01,-2.6192408538e+00,-8.3977994034e-01,-2.8329897913e+00,-4.5306444352e-01,0.0000000000e+00, + }, { 9.8531160936e-02,-5.6297236492e-02,-5.7284484199e-02,-4.3673866734e-01,-1.9564766257e-01,-6.2028156584e-01,-3.4692356122e-01,0.0000000000e+00, + }, }, diff -Naur asterisk.old/fskmodem.c asterisk/fskmodem.c --- asterisk.old/fskmodem.c 2001-11-10 20:30:18.000000000 +0000 +++ asterisk/fskmodem.c 2004-08-08 20:29:50.000000000 +0100 @@ -20,8 +20,8 @@ #define NBW 2 #define BWLIST {75,800} -#define NF 4 -#define FLIST {1400,1800,1200,2200} +#define NF 6 +#define FLIST {1400,1800,1200,2200,1300,2100} #define STATE_SEARCH_STARTBIT 0 #define STATE_SEARCH_STARTBIT2 1 diff -Naur asterisk.old/include/asterisk/callerid.h asterisk/include/asterisk/callerid.h --- asterisk.old/include/asterisk/callerid.h 2004-08-08 19:45:47.000000000 +0100 +++ asterisk/include/asterisk/callerid.h 2004-08-08 19:50:51.000000000 +0100 @@ -54,7 +54,7 @@ * This function returns a malloc'd instance of the callerid_state data structure. * Returns a pointer to a malloc'd callerid_state structure, or NULL on error. */ -extern struct callerid_state *callerid_new(void); +extern struct callerid_state *callerid_new(int cid_sig); //! Read samples into the state machine. /*!