DTMF: Now allows to give duration and pause for digit

Also the dtmf encoder will return less samples, if the digit(+pause)
ends, so that the caller call set the next digit to play seamlessly.

A reset function allows to clear the decoder states, to prevent glitches
when re-attaching to an interrupted stream.
This commit is contained in:
Andreas Eversberg
2022-09-29 20:02:50 +02:00
parent a756ba8fd9
commit b60c844b4f
9 changed files with 74 additions and 44 deletions

View File

@@ -58,6 +58,7 @@ static int sms_ref = 0;
#define RINGING_TO 60.0 /* how long may the phone ring */
#define SUPERVISORY_TO1 3.0 /* 3 sec to detect after setup */
#define SUPERVISORY_TO2 20.0 /* 20 sec lost until abort */
#define DTMF_DURATION 0.1 /* 100ms */
/* Counters */
#define PAGE_TRIES 3 /* How many time do we try to page the phone */
@@ -1519,7 +1520,7 @@ static void rx_active(nmt_t *nmt, frame_t *frame)
break;
}
digit = nmt_value2digit(frame->digit);
dtmf_encode_set_tone(&nmt->dtmf, digit);
dtmf_encode_set_tone(&nmt->dtmf, digit, DTMF_DURATION, 0.0);
PDEBUG_CHAN(DNMT, DEBUG_INFO, "Received (odd) digit %c.\n", digit);
nmt->mft_num++;
break;
@@ -1542,7 +1543,7 @@ static void rx_active(nmt_t *nmt, frame_t *frame)
break;
}
digit = nmt_value2digit(frame->digit);
dtmf_encode_set_tone(&nmt->dtmf, digit);
dtmf_encode_set_tone(&nmt->dtmf, digit, DTMF_DURATION, 0.0);
PDEBUG_CHAN(DNMT, DEBUG_INFO, "Received (even) digit %c.\n", digit);
nmt->mft_num++;
break;