*** ../asterisk/dsp.c 2005-10-25 03:12:04.000000000 +0700 --- dsp.c 2005-11-02 09:38:23.000000000 +0700 *************** *** 58,72 **** #include "asterisk/alaw.h" /* Number of goertzels for progress detect */ #define GSAMP_SIZE_NA 183 /* North America - 350, 440, 480, 620, 950, 1400, 1800 Hz */ #define GSAMP_SIZE_CR 188 /* Costa Rica, Brazil - Only care about 425 Hz */ #define GSAMP_SIZE_UK 160 /* UK disconnect goertzel feed - shoud trigger 400hz */ #define PROG_MODE_NA 0 ! #define PROG_MODE_CR 1 ! #define PROG_MODE_UK 2 /* For US modes */ #define HZ_350 0 #define HZ_440 1 #define HZ_480 2 --- 58,74 ---- #include "asterisk/alaw.h" /* Number of goertzels for progress detect */ #define GSAMP_SIZE_NA 183 /* North America - 350, 440, 480, 620, 950, 1400, 1800 Hz */ #define GSAMP_SIZE_CR 188 /* Costa Rica, Brazil - Only care about 425 Hz */ + #define GSAMP_SIZE_TH 188 /* Thailand - Same as CR and Brazil except 403 Hz */ #define GSAMP_SIZE_UK 160 /* UK disconnect goertzel feed - shoud trigger 400hz */ #define PROG_MODE_NA 0 ! #define PROG_MODE_CR 1 ! #define PROG_MODE_TH 2 ! #define PROG_MODE_UK 3 /* For US modes */ #define HZ_350 0 #define HZ_440 1 #define HZ_480 2 *************** *** 76,85 **** --- 78,89 ---- #define HZ_1800 6 /* For CR/BR modes */ #define HZ_425 0 + #define HZ_403 0 + /* For UK mode */ #define HZ_400 0 static struct progalias { char *name; *************** *** 87,105 **** --- 91,111 ---- } aliases[] = { { "us", PROG_MODE_NA }, { "ca", PROG_MODE_NA }, { "cr", PROG_MODE_CR }, { "br", PROG_MODE_CR }, + { "th", PROG_MODE_TH }, { "uk", PROG_MODE_UK }, }; static struct progress { int size; int freqs[7]; } modes[] = { { GSAMP_SIZE_NA, { 350, 440, 480, 620, 950, 1400, 1800 } }, /* North America */ { GSAMP_SIZE_CR, { 425 } }, + { GSAMP_SIZE_TH, { 403 } }, { GSAMP_SIZE_UK, { 400 } }, }; #define DEFAULT_THRESHOLD 512 *************** *** 1078,1094 **** newstate = DSP_TONE_STATE_TALKING; } else newstate = DSP_TONE_STATE_SILENCE; break; case PROG_MODE_CR: ! if (hz[HZ_425] > TONE_MIN_THRESH * TONE_THRESH) { newstate = DSP_TONE_STATE_RINGING; } else if (dsp->genergy > TONE_MIN_THRESH * TONE_THRESH) { newstate = DSP_TONE_STATE_TALKING; } else newstate = DSP_TONE_STATE_SILENCE; break; case PROG_MODE_UK: if (hz[HZ_400] > TONE_MIN_THRESH * TONE_THRESH) { newstate = DSP_TONE_STATE_HUNGUP; } break; --- 1084,1110 ---- newstate = DSP_TONE_STATE_TALKING; } else newstate = DSP_TONE_STATE_SILENCE; break; case PROG_MODE_CR: ! if (hz[HZ_425] > TONE_MIN_THRESH * TONE_THRESH ! && dsp->genergy < TONE_MIN_THRESH * TONE_THRESH) { newstate = DSP_TONE_STATE_RINGING; } else if (dsp->genergy > TONE_MIN_THRESH * TONE_THRESH) { newstate = DSP_TONE_STATE_TALKING; } else newstate = DSP_TONE_STATE_SILENCE; break; + case PROG_MODE_TH: + if (hz[HZ_403] > TONE_MIN_THRESH * TONE_THRESH + && dsp->genergy < TONE_MIN_THRESH * TONE_THRESH) { + newstate = DSP_TONE_STATE_RINGING; + } else if (dsp->genergy > TONE_MIN_THRESH * TONE_THRESH) { + newstate = DSP_TONE_STATE_TALKING; + } else + newstate = DSP_TONE_STATE_SILENCE; + break; case PROG_MODE_UK: if (hz[HZ_400] > TONE_MIN_THRESH * TONE_THRESH) { newstate = DSP_TONE_STATE_HUNGUP; } break;