{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
struct ast_sockaddr remote_address = { {0,} };
- int hdrlen = 12, res = 0, i = 0;
+ int hdrlen = 12, res = -1, i = 0;
char data[256];
unsigned int *rtpheader = (unsigned int*)data;
unsigned int measured_samples;
/* Make sure we know where the remote side is so we can send them the packet we construct */
if (ast_sockaddr_isnull(&remote_address)) {
- return -1;
+ goto cleanup;
}
/* Convert the given digit to the one we are going to send */
digit = digit - 'a' + 12;
} else {
ast_log(LOG_WARNING, "Don't know how to represent '%c'\n", digit);
- return -1;
+ goto cleanup;
}
rtp->dtmfmute = ast_tvadd(ast_tvnow(), ast_tv(0, 500000));
rtp->seqno++;
}
+ res = 0;
/* Oh and we can't forget to turn off the stuff that says we are sending DTMF */
rtp->lastts += rtp->send_duration;
+cleanup:
rtp->sending_digit = 0;
rtp->send_digit = 0;
- return 0;
+ return res;
}
static int ast_rtp_dtmf_end(struct ast_rtp_instance *instance, char digit)