Author Topic: CID  (Read 6649 times)

arts111199

  • Newbie
  • *
  • Posts: 28
    • View Profile
CID
« 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

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: CID
« Reply #1 on: June 10, 2014, 12:58:14 AM »
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???)

arts111199

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: CID
« Reply #2 on: June 10, 2014, 01:57:23 AM »
Thank You Marian
It is working

cc08

  • Guest
Re: CID
« Reply #3 on: September 03, 2015, 03:51:27 PM »
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.


marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: CID
« Reply #4 on: September 07, 2015, 01:42:19 AM »
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)