Skip to content
Snippets Groups Projects
Commit ef60d0ef authored by Pedro Kiefer's avatar Pedro Kiefer
Browse files

Fixes two small regressions from ASTERISK-20157

- receive_dtmf_digits had the wrong buffer length
- app_alarmreceiver should wait 100ms before sending the second part of handshake

(closes issue ASTERISK-20484)
Reported by: Jean-Philippe Lord
Tested by: Jean-Philippe Lord, Pedro Kiefer
Patches:
     ASTERISK-20484_v2.diff uploaded by Kaloyan Kovachev (license 5506)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375081 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 2142fc3b
Branches
Tags
No related merge requests found
...@@ -171,6 +171,7 @@ static void database_increment(char *key) ...@@ -171,6 +171,7 @@ static void database_increment(char *key)
* *
* \param chan Asterisk Channel * \param chan Asterisk Channel
* \param digit_string Digits String * \param digit_string Digits String
* \param buf_size The size of the Digits String buffer
* \param length Length of the message we expect * \param length Length of the message we expect
* \param fdto First Digit Timeout * \param fdto First Digit Timeout
* \param sdto Other Digits Timeout * \param sdto Other Digits Timeout
...@@ -179,7 +180,7 @@ static void database_increment(char *key) ...@@ -179,7 +180,7 @@ static void database_increment(char *key)
* \retval 1 if a timeout occurred * \retval 1 if a timeout occurred
* \retval -1 if the caller hung up or on channel errors * \retval -1 if the caller hung up or on channel errors
*/ */
static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int length, int fdto, int sdto) static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int buf_size, int length, int fdto, int sdto)
{ {
int rtn = 0; int rtn = 0;
int i = 0; int i = 0;
...@@ -188,7 +189,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int ...@@ -188,7 +189,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int
struct timeval lastdigittime; struct timeval lastdigittime;
lastdigittime = ast_tvnow(); lastdigittime = ast_tvnow();
while (i < length && i < sizeof(digit_string) - 1) { while (i < length && i < buf_size - 1) {
/* If timed out, leave */ /* If timed out, leave */
if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) > ((i > 0) ? sdto : fdto)) { if (ast_tvdiff_ms(ast_tvnow(), lastdigittime) > ((i > 0) ? sdto : fdto)) {
ast_verb(4, "AlarmReceiver: DTMF Digit Timeout on %s\n", ast_channel_name(chan)); ast_verb(4, "AlarmReceiver: DTMF Digit Timeout on %s\n", ast_channel_name(chan));
...@@ -464,7 +465,7 @@ static int receive_ademco_contact_id(struct ast_channel *chan, int fdto, int sdt ...@@ -464,7 +465,7 @@ static int receive_ademco_contact_id(struct ast_channel *chan, int fdto, int sdt
res = send_tone_burst(chan, "1400", 100, tldn, 0); res = send_tone_burst(chan, "1400", 100, tldn, 0);
if (!res) { if (!res) {
ast_verb(4, "AlarmReceiver: Sending 2300Hz 100ms burst (ACK)\n"); ast_verb(4, "AlarmReceiver: Sending 2300Hz 100ms burst (ACK)\n");
res = send_tone_burst(chan, "2300", 100, tldn, 0); res = send_tone_burst(chan, "2300", 100, tldn, 100);
} }
} }
if (res) { if (res) {
...@@ -476,7 +477,7 @@ static int receive_ademco_contact_id(struct ast_channel *chan, int fdto, int sdt ...@@ -476,7 +477,7 @@ static int receive_ademco_contact_id(struct ast_channel *chan, int fdto, int sdt
return 0; return 0;
} }
res = receive_dtmf_digits(chan, event, sizeof(event) - 1, fdto, sdto); res = receive_dtmf_digits(chan, event, sizeof(event), sizeof(event) - 1, fdto, sdto);
if (res < 0) { if (res < 0) {
if (events_received == 0) { if (events_received == 0) {
/* Hangup with no events received should be logged in the DB */ /* Hangup with no events received should be logged in the DB */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment