Skip to content

Commit 19c8419

Browse files
InterLinked1jcolp
authored andcommitted
chan_dahdi: Don't append cadences on dahdi restart.
Currently, if any custom ring cadences are specified, they are appended to the array of cadences from wherever we left off last time. This works properly the first time, but on subsequent dahdi restarts, it means that the existing cadences are left alone and (most likely) the same cadences are then re-added afterwards. In short order, the cadence array gets maxed out and the user begins seeing warnings that the array is full and no more cadences may be added. This buggy behavior persists until Asterisk is completely restarted; however, if and when dahdi restart is run again, then the same problem is reintroduced. This fixes this behavior so that cadence parsing is more idempotent, that is so running dahdi restart multiple times starts adding cadences from the beginning, rather than from wherever the last cadence was added. As before, it is still not possible to revert to the default cadences by simply removing all cadences in this manner, nor is it possible to delete existing cadences. However, this does make it possible to update existing cadences, which was not possible before, and also ensures that the cadences remain unchanged if the config remains unchanged. ASTERISK-29990 #close Change-Id: Ie32ea3e8a243b766756b1afce684d4a31ee7421d
1 parent fbe960c commit 19c8419

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

channels/chan_dahdi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17873,6 +17873,9 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
1787317873
int y;
1787417874
struct ast_variable *dahdichan = NULL;
1787517875

17876+
/* Re-parse any cadences from beginning, rather than appending until we run out of room */
17877+
user_has_defined_cadences = 0;
17878+
1787617879
for (; v; v = v->next) {
1787717880
if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
1787817881
continue;

configs/samples/chan_dahdi.conf.sample

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,10 +1286,11 @@ pickupgroup=1
12861286
; You can define your own custom ring cadences here. You can define up to 8
12871287
; pairs. If the silence is negative, it indicates where the caller ID spill is
12881288
; to be placed. Also, if you define any custom cadences, the default cadences
1289-
; will be turned off.
1289+
; will be turned off (overwritten).
12901290
;
12911291
; This setting is global, rather than per-channel. It will not update on
1292-
; a reload.
1292+
; a reload, but new and modified cadences will update on dahdi restart.
1293+
; A maximum of 24 cadences may be specified.
12931294
;
12941295
; Syntax is: cadence=ring,silence[,ring,silence[...]]
12951296
;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Subject: chan_dahdi
2+
3+
Previously, cadences were appended on dahdi restart,
4+
rather than reloaded. This prevented cadences from
5+
being updated and maxed out the available cadences
6+
if reloaded multiple times. This behavior is fixed
7+
so that reloading cadences is idempotent and cadences
8+
can actually be reloaded.

0 commit comments

Comments
 (0)