the code is: [setcodec] exten => s,1,Set(SIP_CODEC=${MASTER_CHANNEL(CODEC)}) exten => s,n,Set(SIPCALLID=${PJSIP_HEADER(read,Call-ID)}) exten => s,n,Verbose(0,WE ARE USING ${SIP_CODEC} FOR "${SIPCALLID}") exten => s,n,Return executed from exten => _X.,n,Dial(PJSIP/${CODEC}-outbound/sip:${DID}${EXTEN}@${Target},,M(short^${EXTEN:-11}^${CALLERID(num)})${C${recvip}}b(setcodec,s,1)) the code executes fine -- Executing [s@setcodec:1] Set("PJSIP/ulaw-outbound-00000007", "SIP_CODEC=ulaw") in new stack [May 26 13:51:34] DEBUG[26311][C-00000003]: pbx.c:1308 new_find_extension: Nothing strange about this match [May 26 13:51:34] DEBUG[26311][C-00000003]: pbx.c:1309 new_find_extension: returning an exact match-- first found-- s [May 26 13:51:34] DEBUG[26002]: res_pjsip_header_funcs.c:269 read_header: There was no datastore from which to read headers. [May 26 13:51:34] DEBUG[26311][C-00000003]: pbx_variables.c:708 pbx_substitute_variables_helper_full: Function PJSIP_HEADER(read,Call-ID) result is '(null)' [May 26 13:51:34] DEBUG[26311][C-00000003]: pbx.c:2825 pbx_extension_helper: Launching 'Set' -- Executing [s@setcodec:2] Set("PJSIP/ulaw-outbound-00000007", "SIPCALLID=") in new stack