I'm trying to forward a specific incoming header to the other leg of the call, but can't figure out how to pass the value of the header in the incoming leg to the pre-dial handler
[addheaders] exten => addheader,1,Verbose("Setting header") exten => addheader,1,Verbose(${somevar}) ; The 'somevar' variable doesn't exist anymore exten => addheader,n,Set(PJSIP_HEADER(add,X-MyHeader)=test) exten => addheader,n,Set(PJSIP_HEADER(add,X-MyHeader2)=${somevar}) exten => addheader,n,Return() [incoming] exten => _+4600.,1,Ringing exten => _+4600.,n,Set(somevar=${PJSIP_HEADER(read,TheHeaderIWantToForward)}) exten => _+4600.,n,Verbose(${somevar}) ; Prints the correct value exten => _+4600.,n,Dial(PJSIP/${EXTEN:1},,b(addheaders^addheader^1)) exten => _+4600.,n,Hangup I have successfully managed to add the X-MyHeader to the outbound call leg (as the asterisk documentation shows how to), but how do I actually pass the value to the other context? I can't read the variable in "[addheaders]", and I can only read the headers in "[incoming]"