VoiceGuide IVR Software Main Page
Jump to content

Transfer To Random Extension

Recommended Posts

I would like set up a script to randomly select anumber form list and then pass the selected number to the transfer call moduleto perform the transfer.

Please show me the script syntax as I believe it requires reading from a file (open text file) and to Randomize the result and pass the $RV result to the transfer module

Share this post


Link to post

So far I have come this far with the script - need assistance to complete the transfer section

 

 

CONST FOR_READING = 1

set vg = CreateObject("vgServices.CommandLink")

Set ofso = CreateObject("Scripting.FileSystemObject")

Set ofile = ofso.OpenTextFile("C:Program Files\Voiceguide\Scripts\Project\extensions.txt",FOR_READING)

 

arrFile = Split(ofile.readall,vbCrLf)

 

Randomize

 

i = Int((Rnd * UBound(arrFile)))

 

arrLine = Split(arrFile(i),",")

 

For i=0 To UBound(arrLine)

WScript.Echo arrLine(i)

 

 

vg.Script_Goto iLineId, "", "TransferToExt", sRv

 

set fso = Nothing

set vg = Nothing

 

Next

 

 

 

 

Share this post


Link to post

Probably the most straightforward approach here would be to use a "Run VBScript" type module and make it run a VBScript that opens the input file (or to simplify just set the phone numbers in the VBScript) and loads them into an array. Then a random selection of the array index is made and the contents of that array entry are saved as $RV which is then used in Transfer Call module.

Share this post


Link to post

Why was this included:

 

arrLine = Split(arrFile(i),",")

 

?

 

The below should probably be enough:

 

CONST FOR_READING = 1
set vg = CreateObject("vgServices.CommandLink")
Set ofso = CreateObject("Scripting.FileSystemObject")
Set ofile = ofso.OpenTextFile("C:Program Files\Voiceguide\Scripts\Project\extensions.txt",FOR_READING)

arrFile = Split(ofile.readall,vbCrLf)

Randomize

i = Int((Rnd * UBound(arrFile)))

sRv = "[xferdest]{" & arrFile(i) & "}"

vg.Script_Goto iLineId, "", "TransferToExt", sRv

set ofile = Nothing
set ofso = Nothing
set vg = Nothing

 

 

then use $RV[xferdest] in the module "TransferToExt"

Share this post


Link to post

Thank you

 

Here is the final script that works for other like me who need a little help on the coding...

 

 

 

CONST FOR_READING = 1

set vg = CreateObject("vgServices.CommandLink")

Set ofso = CreateObject("Scripting.FileSystemObject")

Set ofile = ofso.OpenTextFile("C:\Program Files\Voiceguide\Scripts\Project\extensions.txt",FOR_READING)

 

arrFile = Split(ofile.readall,vbCrLf)

 

Randomize

 

i = Int((Rnd * UBound(arrFile)))

 

sRv = "[TransfertoExt]{" & arrFile(i) & "}"

'sRv = arrFile(i)

 

vg.Script_Goto $RV_LINEID, "", "TransferToExt", sRv

'vg.Script_Goto $RV_LINEID, "", "C:\Program Files\VoiceGuide\Scripts\Project\Project.vgs\TransferToExt", sRv

 

set ofile = Nothing

set ofso = Nothing

set vg = Nothing

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×