aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-30 15:26:04 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-09-30 15:26:04 +0000
commit6952b8b20d7f575e2a09ba952cf61312ffd0324c (patch)
tree5e1d1726926e5cf19f6bc9b9c86062f8707783dd /channels
parent5a5518b36199933d9ddbe752ad894fcaa53f57da (diff)
Merge ring pulse stuff (Bug #2016)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3856 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_zap.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index b4149cfc9..5997ac209 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -9480,6 +9480,7 @@ static int setup_zap(void)
int i;
struct zt_ring_cadence new_cadence;
int cid_location = -1;
+ int firstcadencepos = 0;
char original_args[80];
int cadence_is_ok = 1;
@@ -9495,23 +9496,30 @@ static int setup_zap(void)
/* Ring cadences cannot be negative */
for (i=0;i<element_count;i++) {
- if (c[i] < 1) {
- if ((i % 2 == 1) && (cid_location == -1)) {
- /* Silence duration, negative possibly okay */
- if (c[i] == 0) {
- ast_log(LOG_ERROR, "Silence duration cannot be zero: %s\n", original_args);
- cadence_is_ok = 0;
- } else {
- cid_location = i;
+ if (c[i] == 0) {
+ ast_log(LOG_ERROR, "Ring or silence duration cannot be zero: %s\n", original_args);
+ cadence_is_ok = 0;
+ break;
+ } else if (c[i] < 0) {
+ if (i % 2 == 1) {
+ /* Silence duration, negative possibly okay */
+ if (cid_location == -1) {
+ cid_location = i;
c[i] *= -1;
+ } else {
+ ast_log(LOG_ERROR, "CID location specified twice: %s\n",original_args);
+ cadence_is_ok = 0;
+ break;
}
- } else if (cid_location) {
- ast_log(LOG_ERROR, "CID location specified twice: %s\n",original_args);
- cadence_is_ok = 0;
} else {
- ast_log(LOG_ERROR, "Negative or zero ring duration: %s\n",original_args);
- cadence_is_ok = 0;
- break;
+ if (firstcadencepos == 0) {
+ firstcadencepos = i; /* only recorded to avoid duplicate specification */
+ /* duration will be passed negative to the zaptel driver */
+ } else {
+ ast_log(LOG_ERROR, "First cadence position specified twice: %s\n",original_args);
+ cadence_is_ok = 0;
+ break;
+ }
}
}
}