Jump to content


< Back to Forum


 

Connect Database


  • Please log in to reply

#1 ThaoHuynh 04 April 2017 - 07:30 PM

Hi VoiceGuide Team,

 

Can i connect VoiceGuide to SQL Server Management Studio ?

Thank you for your support.

 

Thao Huynh



#2 SupportTeam 04 April 2017 - 07:37 PM

VoiceGuide can use a MS SQL Server database as its database engine.

 

Please see: http://www.voiceguid...rnal_config.htm



#3 ThaoHuynh 05 April 2017 - 12:52 PM

I have created a simple script to connect database. I also created a PhoneBookDB database in SQL 2012.

And when i use SJPhone call VoiceGuide system, it display "Decline to talk". But if i run Credit Card Payment.vgs (not using Query DB), it still worked.

I attached my config.xml, srcipt and WireShark capture. Please check attached files. 



#4 SupportTeam 05 April 2017 - 01:02 PM

Please .ZIP up and post the ktTel and vgEnigne traces from VoiceGuide's \log\ subdirectory. ,we cna then see what is happening on the call and advise.

 

Are you running an Evaluation version of VoiceGuide ? Was the VoiceGuide service restarted immediately before placing the inbound calls?

 

You should exit all VoiceGuide apps, then stop the VoiceGuide service, wait about 10 seconds after the VoiceGuide service has stopped and then start the VoiceGuide service.

 

Once the VoiceGuide service is started you can then place the call.



#5 ThaoHuynh 05 April 2017 - 01:06 PM

I'm running VoicdGuide 7.5.8. 

  • Attached File  log.zip   107.29KB   23 downloads


#6 SupportTeam 05 April 2017 - 01:20 PM

Please check your config.xml

 

vgEngine trace shows "not answering as no script attached to line" :

095036.007  22   3   1 ev    CallState GCEV_OFFERED, crn=8000001, iEvent=0 ,2,0,8, s1:192.168.76.37|, s2:192.168.76.21, s3:]. build_date: 27-Feb-17 12:59:25.18
095036.008   9   3   1 state <offered> : cid=192.168.76.37 , dnis=192.168.76.21
095036.008   9   3   1 note  not answering as no script attached to line
095036.012  22   3   1 ev    CallState GCEV_DROPCALL, crn=8000001, iEvent=0 ,1,0,32, s1:, s2:, s3:]. build_date: 27-Feb-17 12:59:25.18

in last trace: 0405_0949_vgEngine.txt

 

the script entry was set to:

 

C:\Users\Admin\AppData\Local\VirtualStore\Program Files (x86)\VoiceGuide\Scripts\Credit Card Payment\Credit Card Payment.vgs

094932.094   6               ReadXmlInto_zConfigXml_Channels read in: dxxxB1C1| iptB1T1 C:\Users\Admin\AppData\Local\VirtualStore\Program Files (x86)\VoiceGuide\Scripts\Credit Card Payment\Credit Card Payment.vgs allowDialout=1

which resulted in:

094934.940   9   1   0       OpenChanels could not load script [C:\Users\Admin\AppData\Local\VirtualStore\Program Files (x86)\VoiceGuide\Scripts\Credit Card Payment\Credit Card Payment.vgs]

after correcting your Config.xml and setting it to an existing .vgs file please restart the VoiceGuide service.

 

Config.xml settings are read in during VoiceGuide service startup.

 

 

 

vgEngine trace also shows:

094938.082  14               Db_Open GetFactory call [System.Data.SqlClient]
094938.082  14               Db_Open sDbName=[PhoneBookDB]
094938.082  14               Db_Open CreateConnection call
094938.082  14               Db_Open CreateConnection returned. conn=System.Data.SqlClient.SqlConnection, this=ktlib.vgDb.vgDb_ProviderInvariant
094938.083  14               Db_Open sConnString in.len=87, rvreplaced.len=87
094938.083  14               Db_Open conn.Open call
094938.083  14         ERROR Db_Open conn.Open, ex: Login failed for user 'sa'.
094938.083  14         WARN  Db_Open failed. Cannot read outbound dialer database.


#7 ThaoHuynh 05 April 2017 - 02:02 PM

I have modified Config.xml. So SJPhone can call to VoiceGuide system, but i can't hear correct .wav file. And after that, voiceguide hang up automatically.

Why i failed login for user 'sa' while i can connect SQL server for user 'sa'?

 

  • sql.png
  • Attached File  log.zip   4.04MB   25 downloads


#8 SupportTeam 05 April 2017 - 02:22 PM

The scripts start module is set to be "Get HomeNum", which is a database query module.

 

That module runs a query:

 

Select HomeNum from PhoneNum where MobileNum = '$RV[Say MobileNum]'

 

which does not return any rows, and the script then moves to module "Hang up" :

105111.237  25   3   1       dbcompleted. iRowsAffected=0
105111.240  25   3   1       FindNextVgmTitleInPathList: next module title is=[Hang up]

Most likely what you probably want to do is to set the script's starting module to be a different module.

 

The starting module can be set in the VoiceGuide Script Editor, using the Edit -> Script Properties menu.



#9 SupportTeam 05 April 2017 - 02:34 PM

The database connection made from module "Get HomeNum" was successful, while the Dialer database connection specified in the Config.xml file was not.

 

If both connections are to the same database then would recommend comparing the Connection Strings used.

 

The current script seems to be more for incoming calls, so perhaps it may be OK to leave the Dialer database config that is specified in Config.xml at the default setting for now (?)



#10 ThaoHuynh 05 April 2017 - 02:59 PM

My config.xml

 

<OutDialQue_ADODB_Provider>System.Data.SqlClient</OutDialQue_ADODB_Provider>
<OutDialQue_Database>PhoneBookDB</OutDialQue_Database>
<OutDialQue_ConnectString>Data Source=CLTMACHINE1\SQLEXPRESS2012;Database=PhoneBookDB;User ID=sa;Password=******;</OutDialQue_ConnectString>
<OutDialQue_PortToUse_LinkField></OutDialQue_PortToUse_LinkField>
<OutDialQue_SqlPrefix></OutDialQue_SqlPrefix>
<OutDialQue_SqlSuffix></OutDialQue_SqlSuffix>
 
 
In Query DB:
Data Source=CLTMACHINE1\SQLEXPRESS2012;Initial Catalog=PhoneBookDB;User ID=sa;Password=******;


#11 ThaoHuynh 05 April 2017 - 03:01 PM

I also can't hear .wav in my script, and can't enter the number.



#12 SupportTeam 05 April 2017 - 03:03 PM

Have you tried using "Initial Catalog=" instead of "Database=" in the Config.xml connection string?



#13 SupportTeam 05 April 2017 - 03:09 PM

I also can't hear .wav in my script, and can't enter the number.

 

Please post vgEngine trace capturing the latest call.



#14 ThaoHuynh 05 April 2017 - 03:38 PM

This is my vgEngine file.

  • Attached File  log.zip   17.76KB   25 downloads


#15 SupportTeam 05 April 2017 - 03:49 PM

Trace shows that module "Get HomeNum" is still the starting module for the script  C:\Program Files (x86)\VoiceGuide\Scripts\Credit Card Payment\demo.vgs :

115537.431  22   3   1 ev    CallState GCEV_ANSWERED, crn=8000001, iEvent=0 ,256,1,4, s1:, s2:, s3:]. build_date: 27-Feb-17 12:59:25.18
115537.433   9   3   1 state <offered> : cid=192.168.76.37 , dnis=192.168.76.21 connected
115537.483   9   3   1       RunModule start Database Query, [Get HomeNum], iModuleIdx=1, previous: vgm=0, vgs=1:0
115537.483   9   3   1 state [Get HomeNum] DB Query
                             Select HomeNum from PhoneNum where MobileNum = '$RV[Say MobileNum]'

Please open the script C:\Program Files (x86)\VoiceGuide\Scripts\Credit Card Payment\demo.vgs  in the VoiceGuide Script Editor, and then use the Edit -> Script Properties menu to set the starting module for the script and save the script after making the selection.

 

Then place a call into the system again.

 

No need to restart the VoiceGuide service. The saved script will be used for all new calls handled by the system.



#16 ThaoHuynh 05 April 2017 - 05:05 PM

I have edited script properties and saved the script. I set the starting module is "Enter your MobileNum", but trace shows that module "Get HomeNum" is still the starting module for the script.



#17 SupportTeam 05 April 2017 - 05:13 PM

Recommend re-confirming that the right script was edited...

 

Try this a test: change the name of module "Get HomeNum" to something else. Does the new module name appear in vgEngine trace at next call?



#18 ThaoHuynh 05 April 2017 - 05:23 PM

I change the name of module, and also restart DCM, and VoiceGuide system. But it still appear old module name.



#19 SupportTeam 05 April 2017 - 05:31 PM

Sounds like you are editing the wrong script. But you can try restarting the VoiceGuide service after making the change if you'd like to be sure. (No need to restart DCM)

 

Have you used the filename from the Config.xml file when opening the script for editing?

 

The vgEngine trace will also show you the filename of the script that was loaded.



#20 ThaoHuynh 05 April 2017 - 06:09 PM

It's my fault. I not exit Script Designer before start VoiceGuide system.



#21 SupportTeam 05 April 2017 - 06:12 PM

Saving the script file should be sufficient. Once script file is saved all new calls handled by the system will use the the new script version.



#22 ThaoHuynh 05 April 2017 - 06:34 PM

I can query Database, but i can't get result and hear the result. Please check my script.

 

 

  • Attached File  demo.zip   17.24KB   28 downloads


#23 SupportTeam 05 April 2017 - 06:47 PM

Select HomeNum from PhoneNum where MobileNum = '1234'

 

creates these Result Variables ($RVs) when it returns:

 

151834.477  25   3   1       rv    add   Get HomeNum_HomeNum|455
151834.477  25   3   1       rv    add   Get HomeNum_1|455
151834.478  25   3   1       rv    add   Get HomeNum_HomeNum_1|455
151834.478  25   3   1       rv    add   Get HomeNum_1_1|455
151834.478  25   3   1       rv    add   Get HomeNum_RowCount|1

 

Please try using these $RVs in the 'Say Number' module:

 

$RV[Get HomeNum_HomeNum]

 

or

 

$RV[Get HomeNum_1]

 

or

 

$RV[Get HomeNum_HomeNum_1]

 

or

 

$RV[Get HomeNum_1_1]

 

 

Please see http://www.voiceguid.../moddbquery.htm for more information on $RVs created by Database Query module



#24 ThaoHuynh 05 April 2017 - 07:26 PM

It worked for me when i use $RV[Get HomeNum_1].

After 'Say Number' module, i want to write result to file use VBS. But i can't.

I nerver used VBScript before. I base "Credit Card Payment" script on.

 

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 5
set fso = CreateObject("Scripting.FileSystemObject")
set tsFile = fso.OpenTextFile("c:\output1.txt", ForAppending, True)
tsFile.WriteLine FormatNumber(Timer, 2) & ": $RV_STARTTIME, $RV_CIDNUMBER, $RV_CIDNAME, $RV_DNIS, $RV[Get HomeNum_1]"
tsFile.Close
set tsFile = Nothing
set fso = Nothing


#25 SupportTeam 05 April 2017 - 07:52 PM

Your "ForAppending" constant is set wrong.

 

And best not to write file to root "C:\", you will get a 'Permission Denied' error on many systems.

 

 

So change:

 

Const ForAppending = 5

 

to:

 

Const ForAppending = 8

 

and change

 

set tsFile = fso.OpenTextFile("c:\output1.txt", ForAppending, True)

 

to use another directory, eg:

 

set tsFile = fso.OpenTextFile("c:\MyNewDir\output1.txt", ForAppending, True)

 

and you probabaly want to change the

 

tsFile.WriteLine FormatNumber(Timer, 2) &  ....

 

to be:

 

tsFile.WriteLine Now &  ....

 

 

 

You can save the VBScript into a file (.vbs suffix) and just run it by double clicking it. That's a good way to debug your VBScripts.



#26 ThaoHuynh 05 April 2017 - 08:26 PM

it still not working, and 'Say HomeNum' module aslo speak 3 times.

  • Attached File  demo.zip   17.91KB   27 downloads


#27 SupportTeam 05 April 2017 - 08:41 PM

In module "Say HomeNum" change the number or "replays" from 2 to 0. This will ensure that module "Say HomeNum" will only play the message once.

 

Then add this path to module "Say HomeNum" :

 

 

on {timeout 0} goto [Write to file]

 

 

you can just copy and paste the above path into the Paths text box in module's "Say HomeNum" Paths tab.

 

The "Timeout 0" path will be taken as soon as the sound files in module "Say HomeNum" complete playing.

 

Oh, and as you are playing a sound file to caller while running that module, change the Wait type option in module "Write to file" to be: "Wait until VBScript and Sound File completes".

 

 

You might want to add this to the end of the VBScript:

 

set vg = CreateObject("vgServices.CommandLink")
vg.Run_ResultReturn $RV_LINEID, "Success"
set vg = Nothing

 

 

This way the Success path will be taken from the "Write to file" module.

 

So the complete script in that VBScript module would be:

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
set fso = CreateObject("Scripting.FileSystemObject")
set tsFile = fso.OpenTextFile("c:\MyNewDir\output1.txt", ForAppending, True)
tsFile.WriteLine Now & ": $RV_STARTTIME, $RV_CIDNUMBER, $RV_CIDNAME, $RV_DNIS, $RV[Get HomeNum_1]"
tsFile.Close
set tsFile = Nothing
set fso = Nothing
set vg = CreateObject("vgServices.CommandLink")
vg.Run_ResultReturn $RV_LINEID, "Success"
set vg = Nothing


#28 ThaoHuynh 05 April 2017 - 09:22 PM

It worked. Thank you so so so so so so ...  much.