> Are those PBXs directly connected to each other through a SIP trunk ?
Yes, and the reason is definitely transmitted in the SIP header and also
parsed by asterisk and displayed in debug output.
After reading a bit more in chan_sip.c (I’m not a coder) I fear the result is
just put in a temporary variable __SIPDIVERSIONREASON but not in a variable
useable in the dialplan.