Benny Amorsen wrote:
> Imagine that you have this code:
> 
> exten => _X!,n,Set(foo=${QUEUE_WAITING_COUNT(${QueueName})}))
> 
> If ${QueueName} happens to be unset, this will cause a warning:
> 
> [Jul 22 14:26:17] ERROR[8114]: app_queue.c:5187
> queue_function_queuewaitingcount: QUEUE_WAITING_COUNT requires an
> argument: queuename
> 
> The obvious solution:
> 
> exten => _X!,n,ExecIf($["${QueueName}" != 
> ""]?Set(foo=${QUEUE_WAITING_COUNT(${QueueName})}))
> 
> However, this doesn't actually work! Functions and variables on the
> right hand side are evaluated BEFORE it is decided whether it needs to
> be executed at all!

Try this, as I think the IF() function works differently (I could be wrong 
though):

exten => _X!,n,Exec(${IF($["${QueueName}" != 
""]?Set(foo=${QUEUE_WAITING_COUNT(${QueueName})}:NoOp())})

Leif Madsen.
http://www.leifmadsen.com
http://www.oreilly.com/catalog/asterisk

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to