=================================================== AMI origination, using Channel: local/123456@dialleroutbound Extension: ConnectToAgent Context: DiallerConnected =================================================== dialplan: [dialleroutbound] exten => _X.,1,Dial(Zap/G5/${EXTEN},15,M(dialleranswered)) exten => _X.,n,Hangup() [macro-dialleranswered] exten => s,1,MixMonitor(${UNIQUEID}.gsm) [diallerconnected] exten => ConnectToAgent,1,Set(ARRAY(LEG1,MYCHAN)="${CHANNEL}") exten => ConnectToAgent,n,ImportVar(__ZAPCHANNEL=${LEG1}\,2,BRIDGEPEER) exten => ConnectToAgent,n,ImportVar(__CALLID=${ZAPCHANNEL},UNIQUEID) exten => ConnectToAgent,n,Verbose(<--- ${STRFTIME(||%m/%d/%Y %T)} ${CHANNEL} ZAPCHANNEL=${ZAPCHANNEL} CALLID=${CALLID} ) =================================================== notes: what this is meant to do: When the outbound call is dialed, I need to know in the first leg the uniqueid of the zap channel. Taking a real-world example: Local/123456@dialleroutbound-8101,2 dials the zap channel, which "answers", and the Local/123456@dialleroutbound-8101,1 leg is started exten => ConnectToAgent,1,Set(ARRAY(LEG1,MYCHAN)="Local/123456@dialleroutbound-8101,1") exten => ConnectToAgent,n,ImportVar(__ZAPCHANNEL=Local/123456@dialleroutbound-8101\,2,BRIDGEPEER) exten => ConnectToAgent,n,ImportVar(__CALLID=Zap/121-1,UNIQUEID) CALLID=1206468883.10113 (for example) this works for 9998 calls. for 2 calls, the CALLID is blank. The zap channel is set though !! Could it be possible that the timings get slightly out of sync, and the ,1 leg is started and imports the variables before the zap channel is fully set up ? FWIW, this only seems to happen on certain types of call (a bad number, "0" being dialled, straight to answermachine on a mobile), but not in all circumstances.