Jump to content

IVM Script Response


RW22281
 Share

Recommended Posts

Can someone help me out with this problem?

 

I have written a PHP script that queries a database, and extracts a value. In this example, lets say that the possible values returned for the variable are 1,2,and 3. What I would like to do is then have the application respond according to this value. i.e. if the value returned is a one, say "the color is blue", if it is a two, text to speech "the color is red", etc.

 

What I am struggling with is how to get the IVM application to perform an action based on a response to the variable. Should this be done via script?

 

This seems like a very common usage so I would imagine someone has figured out a good way to do this, so any help or guidance you can provide would be GREATLY appreciated.

 

Cheers!

Link to comment
Share on other sites

PHP can return a value to IVM using the print command.

For example, print "Hello" will send "Hello" back to IVM, although that would not do anything useful.

 

What you can return to IVM is a variable assignment.

Let me give an example:

print "MyVar=haha";

Should set a MyVar variable to haha within IVM

 

Now here is where it gets interesting...

IVM has a built-in variable called NextOGM.

If you set that variable, you can change the OGM IVM will go to next.

 

For example:

print "NextOGM=CorrectPIN";

 

Should send IVM to the CorrectPIN OGM after processing the php script.

 

If you send a variable assignment back, you can then use that variable for something else like text to speech scripts. If I remember correctly, you may need to enclose the variable name in %percent% signs when you use it in IVM.

 

I think you can also send back multiple variable assignment statements by putting an '&' in between them.

E.g. var1=101&var2=blah

 

If you need to put a space in the variable value, use '+'

E.g. var1=blue+is+a+nice+colour

 

That's pretty much it I think

Link to comment
Share on other sites

  • 2 weeks later...

Python - Thanks for the response.

 

Can't quite seem to get it working though. Can you take a look at my setup below and let me know what you think?

 

My OGM's look like this:

 

Answer OGM: "Insert number followed by pound key". Key Reponse-> Variable Name:'certificate'. #: Go To OGM...Process

 

Process OGM: Run another executable or program: "http://dev.something.com/redemption.php?number=%certificate%" (see below) Message Then..."Goodbye - Polite Hangup"

 

ValidCert OGM: TTS Valid Cert (End of Message-> Then...'Hang Up - Immediate')

InvalidCert OGM: TTS Invalid Cert (End of Message-> Then...'Hang Up - Immediate')

CertNotFound OGM: TTS Cert Not Found (End of Message-> Then...'Hang Up - Immediate')

 

 

 

..and my PHP script looks like this:

 

 

 

<?php

$number=$_GET['number'];

 

// Connect to server and select database.

 

$query ="select status from dev1 where cn='$number'";

$result= mysql_query($query);

if (!$result)

{

$message = 'Invalid query: ' . mysql_error() . "\n";

$message .= 'Whole query: ' . $query;

die($message);

}

 

else

{

if($row = mysql_fetch_array($result))

{

extract($row);

 

 

if ($status==1)

{

 

$query1 = "UPDATE dev1 SET status = '0' WHERE cn = '$number'";

$result1= mysql_query($query1);

 

if (!$result1)

{

$message1 = 'Invalid query: ' . mysql_error() . "\n";

$message1 .= 'Whole query: ' . $query1;

die($message1);

}

 

print "NextOGM=ValidCert";

 

}

 

if ($status==0)

{

echo "status0=";

echo "$status";

print "NextOGM=InvalidCert";

}

}

 

else

{

print "NextOGM=CertNotFound";

echo "Not Found";

}

}

 

// close connection

mysql_close();

 

?>

 

 

 

I would think it may have to do with the way my OGMs are setup. I have tested the php script using test variables and that seems to be working fine, I just think my interaction between NextOGM and actions programmed within the IVM setup for 'Message Then...' may be messed up. Any Ideas?

 

 

Cheers!

Link to comment
Share on other sites

Ok, the first problem is that it appears you are making a plug-in call directly to a URL (which by default Windows will send to the default web browser). I don't think that will work (or at least I haven't tried) because IVM wouldn't be able to scan the output of the script from the browser, you're basically just telling the web browser to open the php page as if it was a web page.

 

Instead I get IVM to execute PHP from the command line, as if the php script is a Windows executable rather than a web page. In other words, I would install PHP on the local IVM machine and run php.exe as the plugin... i.e.: C:\PHP\php.exe (or whatever your PHP.exe path is)

You can then pass arguments to PHP.exe from IVM, including the script name/path to run and any additional parameters (check PHP command line documentation for more details).

 

IVM should then be able to scan the output off the command line.

 

Also, there may be another problem in that IVM may pick up both your print & echo statements, which would most likely cause IVM to get confused by the output. Try commenting out the echos if you encounter further problems.

Link to comment
Share on other sites

Python -

 

Made changes as you suggested. Ran the script via the command line and got the following output:

 

C:\Documents and Settings>"C:\Program Files\PHP\php.exe" "D:\WebSites\redemption.php" 11458180

NextOGM=ValidCert

 

C:\Documents and Settings>"C:\Program Files\PHP\php.exe" "D:\WebSites\redemption.php" 11458180

NextOGM=InvalidCert

 

From this output it appears to be operating correctly.

 

However, still no luck with the OGM transfers...here is a dump of my call log:

 

14:21:39 Answering call...

14:21:40 Answered line [1 "CS"] call number [17] cid [x] did[x] drn[0 (0ms)]

14:21:40 Text-to-Speech Synthesis: Thank You for calling.

Please enter your certificate number followed by the hash or pound key.

14:21:44 Caller pressed key [1]

14:21:44 Caller pressed key [2]

14:21:45 Caller pressed key [3]

14:21:46 Caller pressed key [4]

14:21:46 Caller pressed key [5]

14:21:47 Caller pressed key [6]

14:21:47 Caller pressed key [7]

14:21:48 Caller pressed key [8]

14:21:50 Caller pressed key [#]

14:21:50 Variable certificate = 12345678

14:21:50 Command - Go

14:21:50 Open OGM: Process Certificate

14:21:50 Run file: "C:\Program Files\PHP\php.exe" "D:\WebSites\redemption.php" 12345678

14:21:50 Plugin returned so skip to end

14:21:50 Command - Go

14:21:50 Open OGM:

14:21:50 Play system prompt: GoodBye

14:21:51 Play file: NONE

14:22:11 Command - Go

14:22:11 Open OGM:

14:22:11 Play system prompt: GoodBye

14:22:12 Call disconnected

14:22:12 Call has disconnected

14:22:12 Call disconnected

14:22:12 Overall Call Jitter = 5.90 ms

14:22:12 Lost 5 packets during last call. (0.30%)

 

For some reason, IVM is not recognizing and taking action on the command line output (ie.: "NextOGM=ValidCert"). Instead, it seems like it is sitting there idle not sure what it should do next and then finally times out.

 

Grrr....Any ideas?

Link to comment
Share on other sites

Also, on the 'message' tab within the php processing OGM, what should I set the "End of Message" variable to? (Wait:20, Repeat:0, Then.."???") -> Should I set it to 'Go to OGM', 'Goodbye', etc? I obviously want it to go to another OGM, however, this action should be dependant on the script output and will not be the same each time, therefore, I do not think I can set it here.

Link to comment
Share on other sites

Well I don't really know what to suggest.

 

According to the IVM 'sdk', that script should be working fine. I know that I have tested PHP plugins with IVM before (I'm talking year(s) ago though) on previous versions of the software, but I haven't actually done any testing recently.

 

You may need to contact NCH directly about this one, or at least someone else who is making use of plugins.

Link to comment
Share on other sites

Yeah - I have tried contacting support but the response has (and still is) been VERY slow and since they do not have a telephone support number, I'm kind of hanging right now.

 

Has anyone else out there successfully used a script that returns the NextOGM=xxx output and then used this output to transfer to the corresponding OGM? Essentially, what I would like to determine is that if the issue is with my script or the IVM configuration. If someone has a correctly functioning script (The sample PHP script in the sdk does not even work - improper PHP format) and they could send it to me it would be GREATLY appreciated. Please email the script to rob.wilker@gmail.com

 

THANKS!

Link to comment
Share on other sites

  • 2 weeks later...

Finally got it figured out - (no thanks to NCH Support)

 

*C:\Documents and Settings\All Users\Application Data\NCH Swift Sound\IVM\OGMs*

 

If your OGM is named say, MyOGM, its corresponding settings file will be MyOGM.ini

 

Open MyOGM.ini and find the line that says playcompletego. The value here will load the next OGM once MyOGM completes. So edit the PHP script and depending upon the return value, program the script to edit MyOGM.ini and modify the value of playcompletego.

 

 

Note: I tried contacting NCH Support for help with this issue (which I paid extra for), and they repeatedly ignored my requests and kept saying our developers are looking into it (for several weeks) with no reply. I would recommend saving your money and purchasing no "support" as they were completely useless and unresponsive.

 

 

Yeah - I have tried contacting support but the response has (and still is) been VERY slow and since they do not have a telephone support number, I'm kind of hanging right now.

 

Has anyone else out there successfully used a script that returns the NextOGM=xxx output and then used this output to transfer to the corresponding OGM? Essentially, what I would like to determine is that if the issue is with my script or the IVM configuration. If someone has a correctly functioning script (The sample PHP script in the sdk does not even work - improper PHP format) and they could send it to me it would be GREATLY appreciated. Please email the script to rob.wilker@gmail.com

 

THANKS!

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...