can't use a set variable
Hello Guys, I was already told about using the "inline" when setting a variable, which actually did set it, but i can't then use it, for some reason.. This is my dialplan <condition field="destination_number" expression="^.*"> <action inline="true" application="set" data="rand_val=${expr(randomize(&x);ceil(random(0,100,&x)))}"/> <action application="log" data="INFO Random value is ${rand_val}"/> <action inline="true" application="set" data="auth_call=${cond(${rand_val} < 41 ? YES : NO )}"/> <action application="log" data="INFO Result: ${auth_call}"/> <condition field="${auth_call}" expression="^YES$"> <action application="log" data="INFO ASR 40 we got ${rand_val}"/> <anti-action application="log" data="INFO ${auth_call} is not greater than 41"/> </condition> </condition> and the Log: EXECUTE sofia/external/12345@1.2.3.4 log(INFO cond(19 < 41 ? YES : NO ) is not greater than 41) 2013-09-02 17:57:27.090531 [INFO] mod_dptools.c:1567 cond(19 < 41 ? YES : NO ) is not greater than 41 EXECUTE sofia/external/12345@1.2.3.4 log(INFO Random value is 19) 2013-09-02 17:57:27.090531 [INFO] mod_dptools.c:1567 Random value is 19 EXECUTE sofia/external/12345@1.2.3.4 log(INFO Result: cond(19 < 41 ? YES : NO )) 2013-09-02 17:57:27.090531 [INFO] mod_dptools.c:1567 Result: cond(19 < 41 ? YES : NO ) 2013-09-02 17:57:27.090531 [NOTICE] switch_core_state_machine.c:262 sofia/external/12345@1.2.3.4 has executed the last dialplan instruction, hanging up. 2013-09-02 17:57:27.090531 [NOTICE] switch_core_state_machine.c:264 Hangup sofia/external/12345@1.2.3.4 [CS_EXECUTE] [NORMAL_CLEARING] Apparently the <condition field="${auth_call}" expression="^YES$"> is not working... Can you guys help? Thanks! David
On 09/02/13 18:00, David Villasmil wrote:
2013-09-02 17:57:27.090531 [INFO] mod_dptools.c:1567 Result: cond(19 < 41 ? YES : NO ) It seems to me that the variable auth_call contains the string value "cond(19 < 41 ? YES : NO )". It seems that this is not evaluated.
-- With kind regards Peter Steinbach Telefaks Services GmbH mailto:lists (att) telefaks.de Internet: www.telefaks.de
participants (2)
-
David Villasmil
-
Peter Steinbach