[asterisk-users] Re: Arrays ???
Benchev
bbench at mail.bg
Thu Aug 3 09:09:56 MST 2006
> Im aware of ARRAY and would have used it but it only sets variables - you
> cant reference the array by name or its elements as is common in other
> programming languages.
>
> Would it be possible to use ASTDB and the "while" application? For
> instance the user inputs 3 numbers to be used for Follow me and the dial
> plan iterates thru them checking for CF CW etc etc changing the numbers if
> needs be then dialling.
>
Basically, for automation, the <key> is usually doomed to be the callerid.
A pair of <family><key> may have only one <value>. I.e there's no need
to delete an entry with a pair just to change the value, you just
"put" THE pair with the "new<value>" and it's overwritten.
Probably, if you use different <family> ...
However you might do :
database put CF/123456 23456,34567,45678
And while:
exten => s,1,Set(temp=${DB(CF/${ARG1})})
exten => s,n,Set(temp1=${CUT(temp,\,,1)}); if macro
exten => s,n,Set(temp2=${CUT(temp,\,,2)})
exten => s,n,Set(temp3=${CUT(temp,\,,3)})
exten =>
s,n,Dial(LOCAL/${TEMP1}@default&LOCAL/${TEMP2}@default&LOCAL/${TEMP3}@default,15,r)
...
Another shortcut is with only one <value> and timeout 15 secs:
database put CF/123456 23456|15
First it rings for 15 secs to 23456and in case they'd forgot to
disable CF, starts ringing 123456.
Hope the above will give you even more ideas.
Benchev
More information about the asterisk-users
mailing list