VoiceGuide IVR Software Main Page
Jump to content

Hangup Scripts

Recommended Posts

I want to create a "global" hangup script. I have created the script and it works - but, every module has to have this specified, even if the "$RV[AFTERHANGUPRUN]" is set to the correct module in the opening module script. It seems that whenever a new module is branched to (goto, gosub, etc), the RV is cleared and the script never runs. This is most inconvenient, especially, as I want to use the VM system, it means that I have to modify EVERY module to run the script.

 

I can appreciate that you may want to have different scripts in different modules, but it should be a case of setting this once, then if needed, setting it to a specific local value in a particular module, a bit like VBS error management, whereby if its set locally, use it, else look back up the module chain and run the last one found.

 

Anyway, have I got this right or am I missing something?

 

If I set every VM module, are there any side-effects? (there is no documentation on the VM anywhere or if there is, can you send it to me?).

 

I have set this as a global RV in the VG.INI but this doesn't seem to work any different.

 

Any help appreciated...

Share this post


Link to post
every module has to have this specified, even if the "$RV[AFTERHANGUPRUN]" is set to the correct module in the opening module script. It seems that whenever a new module is branched to (goto, gosub, etc), the RV is cleared and the script never runs.

Could you please post a copy of VoiceGuide's Debug Printout which captures the problem, this will allow us to see what is going on.

We have not found any problems with setting the 'On hangup' script.

 

You can also set the "On Hangup" script using the "Edit"->"Script Properties" menu in Script Designer.

If you jump to a new script that setting takes precedence - maybe that is what' happening here...

Share this post


Link to post

Okay, after a few tests, this is what I've found: Firstly, I have created 2 scripts: testh2.vgs and testh3.vgs. The first script runs an FX to set the $RV[RUNAFTERHANGUP] to the script ghangup.vgs - which does some logging and works fine if it is called. After the FX, I path to a PLAY module (Play1) which on timeout (or digit #) runs testh3.vgs, either by gosub or goto. This 2nd script, just does a vb script:[ghangup.vgs]

095450.13 0 Script Load D:\VG\KTRDEV\ghangup.vgs[/b]

095450.13 7 Loaded VbsAtHangup into:2

095450.13 7 timer clear

095450.13 7 [HangupLog] Running VB Script...

095450.14 7 rv replace start (strlen>500)

095450.14 7 rv ns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[scriptsPath]{D:\VG\KTRDEV\}[scriptPath]{D:\VG\KTRDEV}[$RV_STARTTIME]{04/04/2005 09:54:43}[$RV_DEVICEID]{7}[$RV_CIDNAME]{}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{}[DoHangup_Input]{"ghangup.vgs"}[DoHangup]{ghangup.vgs}[RUNAFTERHANGUP]{ghangup.vgs}[Hangup Time]{04/04/2005 09:54:49}

095450.14 7 eng run vbs [wscript "C:\Program Files\VoiceGuide\data\vbs_7_1.vbs" //I] copy of script in: vbs_7_1.vbs

095450.17 7 VBScript Run continuing...

095450.19 7 rv add [Hangup Time]{04/04/2005 09:54:50}

095450.19 7 Hanging up call... [Run module : no success path defined]

095450.19 7 HangupCall_Common Mode=AfterHangupRun

095450.19 7 ReinitTelephony due to IDLE

095450.20 7 tapi Reply (LineEvReply) ok 65675 0

095450.22 7 tapic lineDeallocateCall(MainCall:65778) 0

095450.56 7 lineOpen(7)=>

095450.56 7 Waiting for a call...

095450.56 7 LineHandle=65709

095450.56 7 timer set 3 EV_TIMEOUT_ATERIDLE_ALLOWOUT

095450.59 7 cl RvGet_All

095451.34 0 dial start any summary:|7:rdy=0|8:idx=0|9:idx=0|10:idx=0|

095453.75 7 timer fired EV_TIMEOUT_ATERIDLE_ALLOWOUT

095453.75 7 ScriptEventCode 9013 iLineState=900

095454.36 0 dial start any summary:|7:idx=0|8:idx=0|9:idx=0|10:idx=0|

 

 

This script shows a GOSUB - the RV RUNAFTERHANGUP is set, but no script runs

100237.84 7 linedevstate 2048 0 0

100237.84 7 callstate OFFERING 65779 0 4

100237.88 7 callinfo CALLEDID

100237.88 7 callinfo ORIGIN

100237.88 7 ring 0

100237.88 7 rv clear

100237.88 7 Answer the call at 04/04/2005 10:02:37

100237.88 7 lineAnswer(65779) => 65625

100237.95 0 dial start any summary:|7:hc>0|8:idx=0|9:idx=0|10:idx=0|

100238.42 7 callstate CONNECTED 65779 1 0

100238.42 7 callstate CONNECTED 65779,1,0

100238.42 7 WorkingModeTAPI@Connected=

100238.42 7 WorkingModeScript@Connected=

100238.45 7 Inband detection not enabled

100238.45 7 StartLoadedVgs at 04/04/2005 10:02:38, v5.2.3066

100238.45 7 AddRVns [scriptsPath]{D:\VG\KTRDEV\}

100238.45 7 AddRVns [scriptPath]{D:\VG\KTRDEV}

100238.45 7 rv add [$RV_STARTTIME]{04/04/2005 10:02:38}

100238.45 7 rv add [$RV_DEVICEID]{7}

100238.45 7 rv add [$RV_CIDNAME]{}

100238.47 7 AddRVns [PathApp]{C:\Program Files\VoiceGuide\}

100238.47 7 rv add [$RV_CIDNUMBER]{}

100238.47 7 tapi Reply (LineEvReply) ok 65625 0

100238.48 7 callinfo MONITORMODES

100238.48 7 timer clear

100238.48 7 [DoHangup] Evaluate ["$RV[GHANGUP]"]

100238.50 7 rv replace start: ["$RV[GHANGUP]"]

100238.50 7 rv ns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[scriptsPath]{D:\VG\KTRDEV\}[scriptPath]{D:\VG\KTRDEV}[$RV_STARTTIME]{04/04/2005 10:02:38}[$RV_DEVICEID]{7}[$RV_CIDNAME]{}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{}

100238.50 7 rv replace end: ["ghangup.vgs"]

100238.50 7 .Eval(Cstr("ghangup.vgs"))

100238.52 7 AddRVns [DoHangup_Input]{"ghangup.vgs"}

100238.52 7 AddRVns [DoHangup]{ghangup.vgs}

100238.52 7 AddRVns [RUNAFTERHANGUP]{ghangup.vgs}

100238.53 7 Eval Expr result:[ghangup.vgs] stored in $RV[RUNAFTERHANGUP]

100238.53 7 path {ghangup.vgs} not found

100238.53 7 timer clear

100238.53 7 [Play1] Playing

100238.55 7 [Play1] Playing (F01.wav)

100238.55 7 play set playid=214109

100238.58 7 PlaySoundStart ok [F01.wav]

100238.58 7 timer clear

100238.58 7 RunModule PLAY end

100238.59 7 wa(50507,21410900)

100238.59 7 callinfo MONITORMODES

100243.75 7 dtmf # (65779,35,2)

100243.75 7 ScriptEventCode 35 iLineState=1100

100243.77 7 LsPlayMsg #

100243.77 7 stack idx=1

100243.77 7 rv add [scriptStart_Time]{04/04/2005 10:02:43}

100243.77 7 rv add [scriptStart_CalledFrom_Script]{D:\VG\KTRDEV\testh2.vgs}

100243.78 7 rv add [scriptStart_CalledFrom_Module]{Play1}

100243.78 0 Script Load testh3.vgs

100243.78 7 eng loaded [testh3.vgs] into:2

100243.78 7 AddRVns [scriptsPath]{}

100243.80 7 eng StartModuleDefault=[VBS2]

100243.84 7 PlaySoundStop err=0

100243.84 7 rv add [VBS2]{#}

100243.86 7 timer clear

100243.86 7 [VBS2] Running VB Script...

100243.86 7 rv replace start: [msgbox "$RV[RUNAFTERHANGUP]"

]

100243.86 7 rv ns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[scriptsPath]{D:\VG\KTRDEV\}[scriptPath]{D:\VG\KTRDEV}[$RV_STARTTIME]{04/04/2005 10:02:38}[$RV_DEVICEID]{7}[$RV_CIDNAME]{}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{}[DoHangup_Input]{"ghangup.vgs"}[DoHangup]{ghangup.vgs}[RUNAFTERHANGUP]{ghangup.vgs}[scriptStart_Time]{04/04/2005 10:02:43}[scriptStart_CalledFrom_Script]{D:\VG\KTRDEV\testh2.vgs}[scriptStart_CalledFrom_Module]{Play1}[scriptsPath]{}[VBS2]{#}

100243.88 7 rv replace end: [msgbox "ghangup.vgs"

]

100243.88 7 eng run vbs [wscript "C:\Program Files\VoiceGuide\data\vbs_7_1.vbs" //I] copy of script in: vbs_7_1.vbs

100243.91 7 VBScript Run continuing...

100243.92 7 timer clear

100243.92 7 [Play2] Playing

100243.92 7 [Play2] Playing (F02.wav)

100243.92 7 play set playid=219484

100243.95 7 PlaySoundStart ok [F02.wav]

100243.95 7 timer clear

100243.95 7 RunModule PLAY end

100243.97 7 wa(150551,21948400)

100243.97 7 callinfo MONITORMODES

100251.80 7 callstate DISCONNECTED 65779 0 0

100251.81 7 ScriptEventCode 9250 iLineState=1100

100251.81 7 LsPlayMsg EV_REMOTEPARTY_DISCONNECT

100251.81 7 rv add [Hangup Time]{04/04/2005 10:02:51}

100251.83 7 Hanging up call...

100251.83 7 RecSoundStop ok

100251.89 7 PlaySoundStop err=0

100251.89 7 timer set 2 EV_TIMEOUT_WAITFORIDLEAFTERLINEDROP

100251.89 7 fnHangupCall end

100251.94 7 linedevstate 2048 0 0

100251.94 7 callstate IDLE 65779 0 0

100251.94 7 WorkingMode@Idle=

100251.95 7 timer clear

100251.95 7 timer set 1 EV_TIMEOUT_TIMETOREINITLINE

100251.95 7 tapi Reply (LineEvReply) ok 65847 0

100252.98 7 timer fired EV_TIMEOUT_TIMETOREINITLINE

100252.98 7 ScriptEventCode 9008 iLineState=900

100252.98 7 LsAwaitingCalls EV_TIMEOUT_TIMETOREINITLINE

100252.00 7 ReinitTelephony due to IDLE

100252.00 7 tapic lineDeallocateCall(MainCall:65779) 0

100253.16 7 lineOpen(7)=>

100253.16 7 Waiting for a call...

100253.16 7 LineHandle=65574

100253.16 7 timer set 3 EV_TIMEOUT_ATERIDLE_ALLOWOUT

100253.19 0 dial start any summary:|7:rdy=0|8:idx=0|9:idx=0|10:idx=0|

100256.45 7 timer fired EV_TIMEOUT_ATERIDLE_ALLOWOUT

100256.45 7 ScriptEventCode 9013 iLineState=900

100257.23 0 dial start any summary:|7:idx=0|8:idx=0|9:idx=0|10:idx=0|

 

 

This script is showing a GOTO script from the start - no hangup script runs despite the RV RUNAFTERHANGUP is set correctly

 

095839.44 7 linedevstate 2048 0 0

095839.44 7 callstate OFFERING 66342 0 4

095839.45 7 callinfo CALLEDID

095839.45 7 callinfo ORIGIN

095839.45 7 ring 0

095839.45 7 rv clear

095839.45 7 Answer the call at 04/04/2005 09:58:39

095839.45 7 lineAnswer(66342) => 65897

095839.64 0 dial start any summary:|7:hc>0|8:idx=0|9:idx=0|10:idx=0|

095839.98 7 callstate CONNECTED 66342 1 0

095839.98 7 callstate CONNECTED 66342,1,0

095839.98 7 WorkingModeTAPI@Connected=

095839.98 7 WorkingModeScript@Connected=

095840.03 7 Inband detection not enabled

095840.03 7 StartLoadedVgs at 04/04/2005 09:58:40, v5.2.3066

095840.03 7 AddRVns [scriptsPath]{D:\VG\KTRDEV\}

095840.03 7 AddRVns [scriptPath]{D:\VG\KTRDEV}

095840.03 7 rv add [$RV_STARTTIME]{04/04/2005 09:58:40}

095840.03 7 rv add [$RV_DEVICEID]{7}

095840.03 7 rv add [$RV_CIDNAME]{}

095840.05 7 AddRVns [PathApp]{C:\Program Files\VoiceGuide\}

095840.05 7 rv add [$RV_CIDNUMBER]{}

095840.05 7 tapi Reply (LineEvReply) ok 65897 0

095840.06 7 callinfo MONITORMODES

095840.06 7 timer clear

095840.06 7 [DoHangup] Evaluate ["$RV[GHANGUP]"]

095840.06 7 rv replace start: ["$RV[GHANGUP]"]

095840.08 7 rv ns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[scriptsPath]{D:\VG\KTRDEV\}[scriptPath]{D:\VG\KTRDEV}[$RV_STARTTIME]{04/04/2005 09:58:40}[$RV_DEVICEID]{7}[$RV_CIDNAME]{}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{}

095840.08 7 rv replace end: ["ghangup.vgs"]

095840.08 7 .Eval(Cstr("ghangup.vgs"))

095840.09 7 AddRVns [DoHangup_Input]{"ghangup.vgs"}

095840.09 7 AddRVns [DoHangup]{ghangup.vgs}

095840.09 7 AddRVns [RUNAFTERHANGUP]{ghangup.vgs}

095840.09 7 Eval Expr result:[ghangup.vgs] stored in $RV[RUNAFTERHANGUP]

095840.11 7 path {ghangup.vgs} not found

095840.11 7 timer clear

095840.11 7 [Play1] Playing

095840.13 7 [Play1] Playing (F01.wav)

095840.13 7 play set playid=975687

095840.16 7 PlaySoundStart ok [F01.wav]

095840.16 7 timer clear

095840.16 7 RunModule PLAY end

095840.16 7 wa(50507,97568700)

095840.17 7 callinfo MONITORMODES

095845.61 7 dtmf # (66342,35,2)

095845.63 7 ScriptEventCode 35 iLineState=1100

095845.63 7 LsPlayMsg #

095845.63 7 rv add [scriptEnd_Time]{04/04/2005 09:58:45}

095845.64 7 rv add [scriptEnd_Goto_Script]{testh3.vgs}

095845.64 7 rv add [scriptEnd_Goto_Module]{}

095845.64 7 rv add [scriptStart_Time]{04/04/2005 09:58:45}

095845.64 7 rv add [scriptStart_CalledFrom_Script]{D:\VG\KTRDEV\testh2.vgs}

095845.66 7 rv add [scriptStart_CalledFrom_Module]{Play1}

095845.66 0 Script Load testh3.vgs

095845.66 7 eng loaded [testh3.vgs] into:2

095845.67 7 AddRVns [scriptsPath]{}

095845.67 7 eng StartModuleDefault=[VBS2]

095845.72 7 PlaySoundStop err=0

095845.72 7 rv add [VBS2]{#}

095845.75 7 timer clear

095845.75 7 [VBS2] Running VB Script...

095845.75 7 rv replace start: [msgbox "$RV[RUNAFTERHANGUP]"

]

095845.75 7 rv ns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[scriptsPath]{D:\VG\KTRDEV\}[scriptPath]{D:\VG\KTRDEV}[$RV_STARTTIME]{04/04/2005 09:58:40}[$RV_DEVICEID]{7}[$RV_CIDNAME]{}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{}[DoHangup_Input]{"ghangup.vgs"}[DoHangup]{ghangup.vgs}[RUNAFTERHANGUP]{ghangup.vgs}[scriptEnd_Time]{04/04/2005 09:58:45}[scriptEnd_Goto_Script]{testh3.vgs}[scriptEnd_Goto_Module]{}[scriptStar

_Time]{04/04/2005 09:58:45}[scriptStart_CalledFrom_Script]{D:\VG\KTRDEV\testh2.vgs}[scriptStart_CalledFrom_Module]{Play1}[scriptsPath]{}[VBS2]{#}

095845.77 7 rv replace end: [msgbox "ghangup.vgs"

]

095845.77 7 eng run vbs [wscript "C:\Program Files\VoiceGuide\data\vbs_7_1.vbs" //I] copy of script in: vbs_7_1.vbs

095845.78 7 VBScript Run continuing...

095845.80 7 timer clear

095845.80 7 [Play2] Playing

095845.80 7 [Play2] Playing (F02.wav)

095845.80 7 play set playid=981359

095845.83 7 PlaySoundStart ok [F02.wav]

095845.83 7 timer clear

095845.83 7 RunModule PLAY end

095845.84 7 wa(150551,98135900)

095845.84 7 callinfo MONITORMODES

095854.31 7 callstate DISCONNECTED 66342 0 0

095854.31 7 ScriptEventCode 9250 iLineState=1100

095854.31 7 LsPlayMsg EV_REMOTEPARTY_DISCONNECT

095854.31 7 rv add [Hangup Time]{04/04/2005 09:58:54}

095854.33 7 Hanging up call...

095854.33 7 RecSoundStop ok

095854.39 7 PlaySoundStop err=0

095854.39 7 timer set 2 EV_TIMEOUT_WAITFORIDLEAFTERLINEDROP

095854.39 7 fnHangupCall end

095854.44 7 linedevstate 2048 0 0

095854.44 7 callstate IDLE 66342 0 0

095854.44 7 WorkingMode@Idle=

095854.45 7 timer clear

095854.45 7 timer set 1 EV_TIMEOUT_TIMETOREINITLINE

095854.45 7 tapi Reply (LineEvReply) ok 65880 0

095855.48 7 timer fired EV_TIMEOUT_TIMETOREINITLINE

095855.48 7 ScriptEventCode 9008 iLineState=900

095855.48 7 LsAwaitingCalls EV_TIMEOUT_TIMETOREINITLINE

095855.48 7 ReinitTelephony due to IDLE

095855.50 7 tapic lineDeallocateCall(MainCall:66342) 0

095855.66 7 lineOpen(7)=>

095855.66 7 Waiting for a call...

095855.66 7 LineHandle=65948

095855.67 7 timer set 3 EV_TIMEOUT_ATERIDLE_ALLOWOUT

095855.77 0 dial start any summary:|7:rdy=0|8:idx=0|9:idx=0|10:idx=0|

095858.95 7 timer fired EV_TIMEOUT_ATERIDLE_ALLOWOUT

095858.95 7 ScriptEventCode 9013 iLineState=900

095859.81 0 dial start any summary:|7:idx=0|8:idx=0|9:idx=0|10:idx=0|

Share this post


Link to post
If you jump to a new script that setting takes precedence - maybe that is what' happening here...

 

Sorry, just been re-reading your post - So this is it? The RV is ignored? Each script has to be explicitly specified? Well okay, but I really don't like this, it would be MUCH better if you used the previous script setting or RV if there was no other specified. Please update your documentation to say as much.

 

So what is the best way to provide a general hangup script for the VM system? have I got to customise EVERY module?

Share this post


Link to post
If I GOSUB to 2nd script and hangup, the hangup script does not run.

Looks like what was said in our previous reply is happening here:

If you jump to a new script that setting takes precedence - maybe that is what' happening here...

Setting $RV[RUNAFTERHANGUP] only sets it for current script.

 

Each script can have a different 'On Hangup' script - after all it's set 'per script' in the Script Designer (in "Edit"->"Script Properties" menu).

 

Best to set the hangup script you want using the "Edit"->"Script Properties" menu, but if you want to set the 'on hangup' script dynamically then you need to set it at the beginning of each script.

Share this post


Link to post

Okay - I hear ya - but further testing reveals a bigger problem.

 

If you set the hangup script dynamically at the beginning - then it runs fine provided you don't call another module.

 

BUT - if you do, when the module returns (either via GOSUB or GOTO) then the RV is ignored in the CALLING module too. So every time you return - you lose your hangup script !!! - So not only doesn't it run when you want when you call something, it doesn't run either when you come back!! Guys, this just isn't right. I'm resisting the temptation to curse here. Setting a hardcoded hangup-script path in every script via edit/script properties is a pain-in-the-ass - it absolutely stinks. I've got over 30 scripts and I only want to run one hang-up script. Is there anyway you can fix this?

 

SUGGESTION: if you make the $RV[RUNAFTERHANGUP] take precedence (or add one for this purpose, eg: $RV[GlobalHangup]) then if its set, its called. If it gets overidden somewhere down the line, then okay, thats what gets called, if it gets reset during a call, then thats what get called. If its not set at all - then use the script properties. How big a deal can this be?

 

OR SUGGESTION 2: let me put a $RV in the Edit Script Properties? ie: set $RV[MyGlobalHANGUP] in the dialogbox text.(I've tried this - it doesn't work).

 

Please help - its driving me nuts! - thx - tim.

 

PS: I've worked out the VM side of things now.

Share this post


Link to post

We'll look into how $RV[RUNAFTERHANGUP] behaves upon return back into the script.

 

In the meantime I'd suggest you just set the 'hangup script' using the "Edit"->"Script Properties" menu.

Share this post


Link to post

Setting of $RV[RUNAFTERHANGUP] is only valid during the current script and will change the if a goto/gosub is made to another script. This setting is wiped whenever a goto/gosub is made to another script

 

Upon goto/gosub the new scripts "OnHangup script" will be set as the script to run when call ends.

 

Even if at some later stage control of line is returned to the script within which the $RV[RUNAFTERHANGUP] was set, that setting will not be used. The script's original "OnHangup script" setting will be used.

 

If you wish to modify the way in which hangups are handled then you should be setting Result Variables whose values you then test inside 'OnHangup' script and performing different actions depending on what value the RV holds.

Share this post


Link to post

So basically $RV[RunAfterHangup] is a waste of time, fundamentally flawed and should be ignored? well okay.

Share this post


Link to post

As outlined in previous post, what you want to do can be easily accomplished by the standard method of setting your own RVs. And for your purposes that approach would be more suitable then using $RV[RunAfterHangup].

 

You can even set your RV to hold the filename of script you want to run, and from within the "OnHangup" script just "goto" immediately to that script using the RV within the goto statement.

 

For a great majority of applications $RV[RunAfterHangup] is quite adequate and it's not-persistent nature helps to enforce script simplicity and easy debugging. This does not seem to be the way that you wish to set up your scripts, so the approach outlined at top of this post is more appropriate.

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
×