VoIP.info Troubleshooting

Asterisk HASH keys or ARRAY values are empty, changing or misaligned

Trace one failed branch through channel identity, writer, exact hash and key, key-snapshot timing, delimiter cardinality, mutation and cleanup before changing dialplan logic.

Reviewed 2026-10-19Current Asterisk Latest API HASH, HASHKEYS, ARRAY, ClearHash and SHIFT references, channel-variable setting and inheritance guidance, and the upstream func_strings implementation were reviewed October 19, 2026. The generated Latest API pages reported branch 23; the installed Asterisk branch, loaded func_strings module, dialplan revision, channel topology, key and value grammar, func_odbc result shape, concurrent writers and call outcomes remain deployment specific. No PBX, module, dialplan, channel, hash, key, value, ODBC function, database, packet, media stream or live call was inspected or testedAdvancedDocumentation based · not lab tested

Freeze one channel and one wrong decision

Record timestamp and timezone, installed Asterisk branch, loaded dialplan revision, context, extension and priority, channel name and unique and linked IDs, exact hash name, exact key, intended writer, write time, one HASHKEYS snapshot, raw ARRAY input with sensitive values redacted, expected assignment and actual branch.

Classify the first divergence: function unavailable, writer did not run, wrong channel, case or constructed-key mismatch, intentionally blank value, snapshot taken too early or late, mutation during iteration, ARRAY cardinality or delimiter mismatch, inherited variable lost, ClearHash on the wrong lifecycle, or later routing failure.

Prove module, syntax and the actual writer

Confirm the installed system exposes HASH, HASHKEYS and ARRAY, then compare the loaded priority with the source revision. Follow the exact Set(HASH(name,key)=value) writer and prove it completed on the channel later read. If single-argument HASH assignment is involved, identify the func_odbc function and its returned field shape.

Do not repair an empty read by prepopulating guessed defaults. First distinguish missing execution, wrong syntax, wrong hash name, wrong key and a valid blank policy.

Compare channel identity and creation timing

At both write and read, preserve channel name, unique ID and linked ID. Related channels do not share one ordinary variable store merely because they share a linked ID. If a snapshot or ARRAY target must cross a child boundary, prove whether it was set before child creation and whether one-level or recursive inheritance was intended.

A write after the child exists cannot retroactively populate that child. A later assignment to a prefixed or unprefixed form can replace both value and inheritance form. Use the existing channel-variable diagnostic when that is the first mismatch.

Hold one HASHKEYS snapshot constant

Capture HASHKEYS once before the loop and preserve the returned comma-delimited text. Compare it with keys written before that instant. If the loop adds a key, do not call HASHKEYS again as though it were the same collection; Asterisk documents that the result changes.

Process the saved list with a bounded mechanism such as SHIFT and record each key before reading its value. Do not infer business order from enumeration order. If another path can mutate the same state, prove the owner and timing rather than masking the race with a longer loop.

Validate ARRAY cardinality and delimiter ownership

Preserve the ordered variable-name list and raw comma-delimited producer output, then compare item positions before assignment. Confirm whether empty items or embedded commas are valid in that specific contract. ARRAY performs positional assignment; it does not attach names to returned fields.

For func_odbc, inspect the selected columns, multirow mode and escaping at its owner. Do not log credentials or customer data and do not reinterpret a database error, zero rows, blank field and malformed list as the same ARRAY symptom.

Correct one boundary and repeat the same trace

Correct only the earliest demonstrated owner: module availability, loaded priority, writer, channel, inheritance timing, key normalization, stable snapshot, delimiter contract, func_odbc result or misplaced ClearHash. Retain a rollback and restore temporary logging.

Repeat the same input plus one absent-key control, an authorized blank-value case, a key added after the snapshot and a differently sized ARRAY input. Verify the resulting call branch separately from state construction. No PBX, module, dialplan, channel, hash, key, value, ODBC function, database or live call was inspected or tested for this diagnostic.

Sources & applicability

Primary references for the technical details above. Operational examples and planning checklists are VoIP.info editorial guidance.

Examples require adaptation to your topology. No live PBX or hardware testing is claimed.