ktruk Report post Posted 09/13/2005 11:19 AM Hi, Yesterday, I had a problem with a RUN module calling an external EXE file. Unfortunately, I have been working on the code, so can't offer you any logs, debugs or script files at this time, but felt that maybe you could explain and if necessary fix the following issue: I had a script which runs the RUN module, then calls a VBS module and when this ran in sequence in the script while "online" it worked fine. The same code was copied to a hangup script, but then stopped working. The same code runs still ran okay while online. When the hangup script was executed, the RUN module ran and did what it was supposed to do, but then would NOT call the subsequent VBS module. I tested this exhaustivley and could see no reason why the VBS script was not running. The debug traces just show the RUN module completing successfully and exiting back to the calling script as if a return had been executed. The only "afterthought" I had was maybe some variable disappears in a hangup script, which is present while online (eg: $RV_LINEID). After several hours, I ended up patching in a shell execute to the VBS code and taking out the RUN module altogether, which works as required. So problem solved for at this time. However, if you suspect or know what happened or there is a problem here, or something I need to watch out for, please let me know. Thanks - Tim. Share this post Link to post
ktruk Report post Posted 09/13/2005 12:57 PM I think I have found the problem... 134825.07 7 callstate DISCONNECTED 66340 0 0 134825.07 7 ScriptEventCode 9250 iLineState=1201 134825.07 7 LsRecRecording EV_REMOTEPARTY_DISCONNECT 134825.14 7 RecSoundStopTruncBytes ok 134825.14 7 rec length RV: RwdMsg_RecLen100ms = 56 134825.14 7 rv lg add [RwdMsg_RecLen100ms]{56} 134825.15 7 rv lg add [RwdMsg_EndRecCause]{disconnect} 134825.15 7 rv lg add [Hangup Time]{13/09/2005 13:48:25} 134825.15 7 Hanging up call... [During LsRecRecording] 134825.17 7 RecSoundStop ok 134825.17 7 PlaySoundStop err=0 134825.17 7 timer set 2 EV_TIMEOUT_WAITFORIDLEAFTERLINEDROP 134825.18 7 fnHangupCall end 134825.18 7 ScriptEventCode 8003 iLineState=900 134825.18 7 LsAwaitingCalls EV_REC_FINISHED 134825.22 7 linedevstate 2048 0 0 134825.22 7 callstate IDLE 66340 0 0 134825.22 7 WorkingMode@Idle= 134825.23 7 timer clear 134825.23 7 After Hangup script:[gHangup.vgs] 134825.23 0 LoadedVgs_Find D:\VG\KTRDEV\gHangup.vgs at idx=2 134825.25 7 timer clear 134825.25 7 [HangupLog] Running VB Script... 134825.25 7 rv replace start (strlen>500) 134825.25 7 rv ns [PathSysVoice]{C:\Program Files\VoiceGuide\system\voice\}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[DNIS]{0000}[scriptsPath]{D:\VG\KTRDEV\}[scriptPath]{D:\VG\KTRDEV}[$RV_STARTTIME]{13/09/2005 13:48:14}[$RV_DEVICEID]{7}[$RV_CIDNAME]{Extension 20}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{20}[$RV_DNIS]{0000}[DNIS]{0000}[RwdMsgFilename]{5091313481407}[DoSaveReward]{Y}[ wdMsgIntro]{#}[RwdMsg]{D:\VG\KTRDEV\ORDERS\5091313481407.wav}[RwdMsg_RecLen100ms]{56}[RwdMsg_EndRecCause]{disconnect}[ angup Time]{13/09/2005 13:48:25} 134825.26 7 eng run vbs [wscript "C:\Program Files\VoiceGuide\temp\vbs_7_2_0913134825.vbs" //I] copy of script in: vbs_7_2_0913134825.vbs 134825.28 7 VBScript Run continuing... 134825.30 7 rv lg add [Hangup Time]{13/09/2005 13:48:25} 134825.30 7 Hanging up call... [Run module : no success path defined] 134825.30 7 HangupCall_Common Mode=AfterHangupRun 134825.30 7 ReinitTelephony due to IDLE 134825.31 7 tapi Reply (LineEvReply) ok 65844 0 134825.37 7 tapic lineDeallocateCall(MainCall:66340) 0 134825.67 7 lineOpen(7)=> 134825.67 7 Waiting for a call... 134825.68 7 LineHandle=65861 134825.68 7 amchk set AMdet=False in Reinit@idle 134825.68 7 timer set 3 EV_TIMEOUT_ATERIDLE_ALLOWOUT 134826.36 0 dial start any summary:|7:rdy=0|8:idx=0|9:idx=0|10:idx=0| 134826.76 7 cl Script_Gosub D:\VG\KTRDEV\Save.vgs, , , 134826.78 7 cl no active call on line. 134827.50 7 cl RvGet_All 134828.86 7 timer fired EV_TIMEOUT_ATERIDLE_ALLOWOUT 134828.86 7 ScriptEventCode 9013 iLineState=900 134829.39 0 dial start any summary:|7:idx=0|8:idx=0|9:idx=0|10:idx=0| It appears that a gosub out of the current hangup script abandons the current call, so the called sub gets "NO ACTIVE CALL ON LINE" and terminates. Also see: http://voiceguide.com/forums/index.php?showtopic=3207 So, how do I successfully call a subscript block from a hangup script please, with the current call parameters/RVs, etc? Share this post Link to post
ktruk Report post Posted 09/13/2005 02:27 PM Further update (but please review above first!!)... If an "Evaluate" module is placed before the VBS module in the same script, and the path: "On {true} gosub [testScript.vgs|]" is called, then the subscript does get executed and works. My problem is that: due to the way the hangup script is called, (see: http://voiceguide.com/forums/index.php?showtopic=3187) I need several of these evaluate functions, one called after another in the same subscript. Here's my general aim. I want to have an online script call one of several database save functions when a user completes some operation, eg press 1, 2 or 3 to continue. The save-script is a separate script which works when called via GOSUB. However, if the user hangups instead of pressing the digit, then I want to call the SAME function, via GOSUB and have it do the same thing via the hangup-script. However, if its already been saved, don't resave it (ie: only save it once), so skip past the save if its already done before hanging up. Next, after a hangup, I also want to capture the same call variables for every call, so the same code should run This code-reuse is important to me for maintenance and debugging reasons. Sounds easy enough! in the online script path, say: on {3} gosub [save module.vgs] - works on the hangup script in VBS: if "SaveFlag"="Y" then "gosub save-module.vgs", followed by "stuff to do call log saving". BUT it doesn't work in VBS, due to "no active call on line" My options seem to be: a) use several evalute modules chained one after another in one generic script (works, but massive overhead) put all the code in the one VBS hangup script and repeat all the code in the online modules (again massive overhead) c) see if you can keep the call "current" on a gosub from the hangup module. If you have better ideas, feel free to offer them. As usual, I will appreciate any insight you may have. Thanks. Share this post Link to post
ktruk Report post Posted 09/13/2005 03:31 PM Been thinking about this and feel this is a bug. When a GOSUB is issued from the hangup script, the stack should show that a gosub is pending, so you should be able to look for this before abandoning the call. Would it be possible to incorporate this change in hangup script behaviour? Share this post Link to post
SupportTeam Report post Posted 09/14/2005 07:51 AM It is desirable to have the OnHangup script as short as possible. Having complicated and lengthy OnHangup scripts stops new calls from being processed in that line. All RVs which were present or created during the call are available to the OnHangup script. Update your system with attached .exe - you should now be able to call Script_Gosub etc while running the OnHangup script. VgMulti_5.2.5005.zip Share this post Link to post
ktruk Report post Posted 09/14/2005 09:26 AM Just when I think you guys are giving up on me, you pitch up and deliver the goods. Faith restored !!! I will try the new EXE today and get back to you with the results. The workaround fix of prefixing the VBS with an Evaluate function is now working for me. To avoid several Evaluate Function modules, I pass the name of a script to GOSUB if needed, or null and have it ignored (ie: the save flag above is now "xxx.vgs" and not "Y") and this is working okay. The integrated VBS solution requested will be much better and slightly quicker of course, so I will get right on it. Thanks for the advice above about line blocking. The scripts themselves are not taking very long to process and so far is acceptable. Now with a single evaluate in the hangup script performance is acceptable. (There is the downside of having to set/clear the save-script string, but I was doing this anyway). Light at end of tunnel getting brighter every day - cheers - Tim. And PS: 'bout time we got those ashes back !! ;-) Share this post Link to post
ktruk Report post Posted 09/14/2005 10:10 AM Sorry, but the above exe doesn't seem to fix the problem. Below is the tail-end of the debug-trace followed by a bit of code I am trying to run... 105540.34 7 eng RecSoundStart after beep [D:\VG\KTRDEV\ORDERS\5091410553507.wav] 105540.34 7 timer set 120 EV_TIMEOUT_GOTOMODULE 105547.27 7 callstate DISCONNECTED 65928 0 0 105547.27 7 ScriptEventCode 9250 iLineState=1201 105547.27 7 LsRecRecording EV_REMOTEPARTY_DISCONNECT 105547.33 7 RecSoundStopTruncBytes ok 105547.33 7 rec length RV: RwdMsg_RecLen100ms = 70 105547.33 7 rv lg add [RwdMsg_RecLen100ms]{70} 105547.33 7 rv lg add [RwdMsg_EndRecCause]{disconnect} 105547.34 7 rv lg add [Hangup Time]{14/09/2005 10:55:47} 105547.34 7 Hanging up call... [During LsRecRecording] 105547.34 7 RecSoundStop ok 105547.36 7 PlaySoundStop err=0 105547.36 7 timer set 2 EV_TIMEOUT_WAITFORIDLEAFTERLINEDROP 105547.37 7 fnHangupCall end 105547.37 7 ScriptEventCode 8003 iLineState=900 105547.37 7 LsAwaitingCalls EV_REC_FINISHED 105547.42 7 linedevstate 2048 0 0 105547.42 7 callstate IDLE 65928 0 0 105547.42 7 WorkingMode@Idle= 105547.42 7 timer clear 105547.45 7 After Hangup script:[gHangup.vgs] 105547.47 0 Script Load D:\VG\KTRDEV\gHangup.vgs 105547.48 7 Loaded VbsAtHangup into:2 105547.48 7 tapi Reply (LineEvReply) ok 65894 0 105547.48 7 timer clear 105547.48 7 [HangupLog] Running VB Script... 105547.50 7 rv replace start (strlen>500) 105547.50 7 rv ns [PathSysVoice]{}[PathApp]{C:\Program Files\VoiceGuide\}[PathDataVm]{C:\Program Files\VoiceGuide\data\}[PathVgSys]{C:\Program Files\VoiceGuide\system\}[DNIS]{0000}[ScriptsPath]{D:\VG\KTRDEV\}[ScriptPath]{D:\VG\KTRDEV}[$RV_STARTTIME]{14/09/2005 10:55:34}[$RV_DEVICEID]{7}[$RV_CIDNAME]{Extension 20}[PathApp]{C:\Program Files\VoiceGuide\}[$RV_CIDNUMBER]{20}[$RV_DNIS]{0000}[DNIS]{0000}[RwdMsgFilename]{5091410553507}[DoHangupScript]{RewardSave.vgs}[RwdMsgIntro]{#}[RwdMsg]{D:\VG\KTRDEV\ORDERS\5091410553507.wav}[RwdMsg_RecLen100ms]{70}[RwdMsg_EndRecCause]{disconnect}[Hangup Time]{14/09/2005 10:55:47} 105547.50 7 eng run vbs [wscript "C:\Program Files\VoiceGuide\temp\vbs_7_2_0914105547.vbs" //I //T:5] copy of script in: vbs_7_2_0914105547.vbs 105547.53 7 VBScript Run continuing... 105547.53 7 timer clear 105547.55 7 rv lg add [Hangup Time]{14/09/2005 10:55:47} 105547.55 7 Hanging up call... [Hangup Module] 105547.55 7 HangupCall_Common Mode=AfterHangupRun 105547.55 7 ReinitTelephony due to IDLE 105547.58 7 tapic lineDeallocateCall(MainCall:65928) 0 105547.89 7 lineOpen(7)=> 105547.89 7 Waiting for a call... 105547.91 7 LineHandle=65877 105547.91 7 amchk set AMdet=False in Reinit@idle 105547.91 7 timer set 3 EV_TIMEOUT_ATERIDLE_ALLOWOUT [B]105547.94 7 cl Script_Gosub RewardSave.vgs, , , 105547.94 7 cl no active call on line.[/B] 105547.95 0 dial start any summary:|7:rdy=0|8:idx=0|9:idx=0|10:idx=0| 105549.73 7 cl RvGet_All 105551.09 7 timer fired EV_TIMEOUT_ATERIDLE_ALLOWOUT 105551.09 7 ScriptEventCode 9013 iLineState=900 105551.97 0 dial start any summary:|7:idx=0|8:idx=0|9:idx=0|10:idx=0| The actual code I am trying to run: 'GLOBAL HANGUP PROCESSING - Write all RVs to callog 'SCRIPT: ghangup.vgs 'MODULE: HangupLog iLineID = $RV_LINEID set vg = CreateObject("VoiceGuide.CommandLink") if "$RV[DoHangupScript]" <> "" then vg.Script_GoSub iLineId, "$RV[DoHangupScript]", "", "", "", "" end if ... 'remainder of routine here - this runs !! The RV variable is set: $RV[DoHangupScript] = "RewardSave.vgs" As mentioned the GOSUB seems to fail, but returns to the caller and completes. If there is anything else I can sebnd you please say so. Thx - Tim. Share this post Link to post
SupportTeam Report post Posted 09/14/2005 12:27 PM Trace shows that the VBScript module [HangupLog] is set to "Do not wait..." : 222427.00 6 VBScript Run continuing... Please try changing it to "Wait until VBScript completes". Share this post Link to post
ktruk Report post Posted 09/15/2005 10:50 AM Okay, changing the run-mode allows the script to run. (This wasn't the problem before was it? I will kick myself if it was!!). Now, this works, but it appears that the VBS module continues to execute after the gosub call is made. eg: if x=true then vg.Script_gosub, ... end if msgbox "test" ie: the msgbox executes once on the original call, and once when the VBS module is rerun (via the gosub/return path). So, to avoid further execution, I would need: if x=true then vg.Script_gosub, ... wsh.quit end if msgbox "test" or if x=true then vg.Script_gosub, ... else msgbox "test" end if Is this correct? Does the VBS always run to completion then the GOSUB is actioned? Thanks - Tim. Share this post Link to post
SupportTeam Report post Posted 09/15/2005 01:59 PM Does the VBS always run to completion then the GOSUB is actioned? Yes. Just like an other VBScript, it executes one line after another... Share this post Link to post
ktruk Report post Posted 09/15/2005 02:36 PM Just to confirm, this is all working now. I did have a small problem that when the script executed to completion, it executed a Return_Result which interefered with the return of the called (gosub) module, causing it to take a fail path, even thou it looked like it and was acting as if Results were being returned, the trace-debug said nothing was being returned and took the failed path, before it returned to the calling module. Consider this closed now - thanks again for your help. Share this post Link to post