0

I want to generate a random number from 1 to 10 inside the extensions.conf with asterisk. Using the infamous rand(1,10) is just not working. I know I'm not using the proper language for extensions to understand so any kind of help I can get on this is greatly appreciated.

Here's what I have:

exten => 123456789,2,MeetMe(rand(1,10),qdM)
4

1 回答 1

3
pro-sip*CLI> core show function RAND 

  -= Info about function 'RAND' =- 

[Synopsis]
Choose a random number in a range.                       

[Description]
Choose a random number between <min> and <max>.  <min> defaults to '0', if
not specified, while <max> defaults  to 'RAND_MAX' (2147483647 on many
systems).
Example:  Set(junky=${RAND(1,8)}); Sets junky to a random number between
1 and 8, inclusive.

[Syntax]
RAND([min][,max])

[Arguments]
Not available

[See Also]
Not available

So you can use it as:

exten=>123456789,1,Meetme(${RAND(1,10)},qdM)
于 2013-04-15T14:52:37.170 回答