Sorry for all the forums topics, working hard on all the dialplan things, learning everyday.
(Asterisk 18 Function_PJSIP_HEADER - Asterisk Project - Asterisk Project Wiki)
Adding an extra sip header for the callee with a hardcoded value works.
[ctbVariableOutboundCallStartSuccess]
exten => 1,1,Verbose(Variable outbound call start success)
same => n,Set(ctbMonitor=${SHELL(echo '${ctbJsonResult}' | jq '.data.callRecording' | tr -d '\n"')})
same => n,Verbose(Callrecording: ${ctbMonitor})
same => n,ExecIf($[${ctbMonitor}=1]?MixMonitor(${ctbCodexLocation}${ctbSessionId}.wav))
same => n,Set(CALLERID(num)=+${ctbOutboundDialedNumber})
;same => n,Dial(PJSIP/+${ctbEmployeeOutboundNumber}@${ctbSipProviderEndpoint}&PJSIP/${ctbWebPhoneEndpoint},${ctbDialTimeOut},g)
same => n,Verbose(Visitor user id ${ctbVisitorUserId})
same => n,Dial(PJSIP/${ctbWebPhoneEndpoint},${ctbDialTimeOut},b(ctbVariableOutboundCallStartHeaders^addheader^1))
same => n,Verbose(Call result: ${DIALSTATUS});
same => n,Log(NOTICE, Call result: ${DIALSTATUS})
[ctbVariableOutboundCallStartHeaders]
exten => addheader,1,Set(PJSIP_HEADER(add,CtbVisitorUserId)=12)
Changing
exten => addheader,1,Set(PJSIP_HEADER(add,CtbVisitorUserId)=12)
into
exten => addheader,1,Set(PJSIP_HEADER(add,CtbVisitorUserId)=${ctbVisitorUserId})
Does not work and leaves the value empty.
Note that ${ctbVisitorUserId} out put is 126, so the channel variable is set
How can you set a channel variable value as header value?