I am having a problem getting the following logic to work, in a macro. Basically, if the caller ID matches, set the outbond trunk to a Zap channel, otherwise use a SIP provider. exten => s,n,Set(TRUNK=${IF($[${CALLERIDNUM} 1234567890]?Zap/g1:SIP/LDPROVIDER)}) ; use PRI instead of SIP That works. The TRUNK variable is set properly. But the SIP LD provider requires a prepended code, so I say if the TRUNK var is the SIP/LDPROVIDER set another variable called PREPEND_CODE to the passed argument, otherwise use nothing if it's the Zap channel since I will just be sending the digits as is. exten => s,n,Set(PREPEND_CODE=${IF($[ ${TRUNK} SIP/LDPROVIDER]?${ARG2}:)}) However this always sets the PREPEND_CODE variable even if TRUNK is set to Zap/g1. If I use 'SIP/LDPROVIDER' or "SIP/LDPROVIDER" or even ${TRUNK:} = SIP (not sure if that's even valid but I tried it) it still sets the variable. I also tried using a space after the : but still doesn't work. Does IF only match digits??? Asterisk ver 1.2.12.1 I must be doing something wrong but am not sure what it is...any ideas? I have a feeling I missed up because I was looking at this at 2am and working on it via a cell phone SSH connection so I must be missing something obvious. Bill -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20061026/6ae7cdb6/attachment.htm