Freeze the disputed answer and expected field
Record timestamp and timezone, caller and callee channel names, unique and linked identifiers, endpoint or trunk, Call-ID, INVITE CSeq, answering destination, final status, header name, requested instance, returned value and the dialplan location that consumed it. Preserve a sanitized working exchange when one exists.
Classify the first symptom: unknown function, handler never ran, no 200 answer, empty value, wrong field instance, wrong outbound leg, provisional or error response expected, value lost after return, duplicate name collapsed by enumeration or consumer rejected a correct value.
Confirm version, module and message scope
Verify the running Asterisk branch and maintenance release meet the documented 16.28.0, 18.14.0 or 19.6.0 floors and that res_pjsip_header_funcs is loaded. Then prove the expected field belongs to the 200 response to an outbound INVITE.
A header seen in an inbound request, outbound INVITE, provisional response, final failure, REGISTER or later in-dialog request belongs to another interface or observation path. Do not diagnose channel inheritance when the expected message is outside the documented response scope.
Prove the handler ran on the answered callee
Inspect the active dialplan and a bounded call trace. Confirm Dial() used uppercase U, the routine started at s,1, executed after this callee answered and returned before bridging. Parallel dialing, queues, Local channels, forwarding and transfers can create several outbound channels; the linked identifier does not merge their response headers.
Lowercase b runs before dialing and is appropriate for request preparation, not for reading a future 200 response. Uppercase B runs on the caller. Moving the same expression among these handlers without mapping channel lifetime can produce another empty result.
Enumerate names and test repeated instances
Use PJSIP_RESPONSE_HEADERS() with the smallest useful prefix to establish which names the function exposes on the selected answered channel. Then read the exact name and explicit instance number with PJSIP_RESPONSE_HEADER(). Compare both to the sanitized 200 response for that Call-ID and CSeq.
Enumeration returns unique names, not a value list or instance count. If multiple Via, Record-Route or custom fields exist, preserve their wire order and test the intended number rather than treating the first value as the complete result.
Trace the value across the channel boundary
If the callee handler reads the correct value but later caller dialplan sees nothing, inspect how the variable is named and propagated. A callee-local variable does not become caller state merely because the channels share one call. Copy only the required value through the deployment-approved inheritance or shared-state mechanism and define when it is cleared.
Keep this handoff separate from SIP proof. A variable that survives does not establish that the peer authenticated, honored a route, changed connected identity or maintained the same value in later messages.
Correct one owner and repeat the same call path
Correct only the demonstrated boundary: supported release, loaded module, 200-response expectation, selected callee, uppercase U placement, Gosub entry or return, exact field name, instance number or post-handler variable transfer. Repeat the same authorized route and retain the response and consumer outcome independently.
Check a no-answer or rejected call and an unrelated route so missing values remain distinguishable from wrong values. Remove temporary protocol logging and protect identities and route data. No PBX, module, dialplan, channel, request, response, header, endpoint, bridge or 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.
- Asterisk PJSIP_RESPONSE_HEADER dialplan function ↗
- Asterisk PJSIP_RESPONSE_HEADERS dialplan function ↗
- Asterisk pre-bridge handlers ↗
- Asterisk 22 Dial application ↗
- Asterisk res_pjsip header-function source ↗
- RFC 3261: SIP Session Initiation Protocol ↗
Examples require adaptation to your topology. No live PBX or hardware testing is claimed.