Yate Community Forum
Yate server => Other Yate server issues => Topic started by: arts111199 on June 09, 2014, 06:34:44 AM
-
Dear All
Please could you help me to change caller in random way in regexroute
For example
caller=? what should be here to generate random caller -id ?
Thank You in Advance
-
See the random function in regexroute. (explained in regexroute.conf.sample)
$(random,STRING)
Each ? char in STRING will be replaced with a random digit
E.g:
${caller}^100$=;caller=$(random,000???)
-
Thank You Marian
It is working
-
Hi, Marian!
How to make a random choice from a given array of elements using the $(random) function?
For example: $(random, STRING(1,2)(1,2,3))
The issue arose in connection with the fact that I need of random lines: trunk1, trunk2, trunk3.
-
Try this one:
${caller}^100$={
.*=;choice=$(random,?)
${choice}^[0,1,2,3]$=callto_line_1
${choice}^[4,5,6]$=callto_line_2
.....
}
Or you may use the index function (it will choose the target by incrementing a variable):
[$once]
line_index=1
[default]
${caller}^100$=line/123;line=$(index,$(line_index),line1,line2,line3)