We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

PHP/MySQL problem - Reads first entry, skips others

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
KikiEss
Posts: 9
Joined: Tue Aug 28, 2007 11:46 am
Location: philadelphia
Contact:

PHP/MySQL problem - Reads first entry, skips others

Post by KikiEss »

Here's the problem. I've created a PHP file, incorporating vxml, that draws information from a mysql database and reads it off to the listener. It's set up so that each vxml field corresponds to a different row from the mysql table. When I check out the source code in the browser, this is what I get (p.s. changes have been made in the prompts to protect intellectual property):

Code: Select all

<?xml version="1.0" ?> 
- <vxml version="2.0">
- <form id="Instructions">
- <block>
  <prompt bargein="false">The following is a complete listing in the Philadelphia metro. Press 1 at any time to repeat a listing. Press 2 to skip to the next listing. Press the star key to go back to the previous menu. Press the pound key to disconnect.</prompt> 
  <goto next="#AllPhilly" /> 
  </block>
  </form>
- <form id="AllPhilly">
- <field name="Metro1">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Bottom...</prompt> 
- <filled>
- <if cond="Metro1==1">
  <clear namelist="Metro1" /> 
  <reprompt /> 
  <elseif cond="Metro1==2" /> 
  <goto nextitem="Metro2" /> 
  <elseif cond="Metro1=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro1=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro1" expr="0" /> 
  </catch>
  </field>
- <field name="Metro2">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Cave...</prompt> 
- <filled>
- <if cond="Metro2==1">
  <clear namelist="Metro2" /> 
  <reprompt /> 
  <elseif cond="Metro2==2" /> 
  <goto nextitem="Metro3" /> 
  <elseif cond="Metro2=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro2=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro2" expr="0" /> 
  </catch>
  </field>
- <field name="Metro3">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Cavern...</prompt> 
- <filled>
- <if cond="Metro3==1">
  <clear namelist="Metro3" /> 
  <reprompt /> 
  <elseif cond="Metro3==2" /> 
  <goto nextitem="Metro4" /> 
  <elseif cond="Metro3=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro3=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro3" expr="0" /> 
  </catch>
  </field>
- <field name="Metro4">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Charter...</prompt> 
- <filled>
- <if cond="Metro4==1">
  <clear namelist="Metro4" /> 
  <reprompt /> 
  <elseif cond="Metro4==2" /> 
  <goto nextitem="Metro5" /> 
  <elseif cond="Metro4=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro4=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro4" expr="0" /> 
  </catch>
  </field>
- <field name="Metro5">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Copy...</prompt> 
- <filled>
- <if cond="Metro5==1">
  <clear namelist="Metro5" /> 
  <reprompt /> 
  <elseif cond="Metro5==2" /> 
  <goto nextitem="Metro6" /> 
  <elseif cond="Metro5=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro5=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro5" expr="0" /> 
  </catch>
  </field>
- <field name="Metro6">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Maggy...</prompt> 
- <filled>
- <if cond="Metro6==1">
  <clear namelist="Metro6" /> 
  <reprompt /> 
  <elseif cond="Metro6==2" /> 
  <goto nextitem="Metro7" /> 
  <elseif cond="Metro6=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro6=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro6" expr="0" /> 
  </catch>
  </field>
- <field name="Metro7">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Port...</prompt> 
- <filled>
- <if cond="Metro7==1">
  <clear namelist="Metro7" /> 
  <reprompt /> 
  <elseif cond="Metro7==2" /> 
  <goto nextitem="Metro8" /> 
  <elseif cond="Metro7=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro7=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro7" expr="0" /> 
  </catch>
  </field>
- <field name="Metro8">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Ralph's...</prompt> 
- <filled>
- <if cond="Metro8==1">
  <clear namelist="Metro8" /> 
  <reprompt /> 
  <elseif cond="Metro8==2" /> 
  <goto nextitem="Metro9" /> 
  <elseif cond="Metro8=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro8=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro8" expr="0" /> 
  </catch>
  </field>
- <field name="Metro9">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Remy's...</prompt> 
- <filled>
- <if cond="Metro9==1">
  <clear namelist="Metro9" /> 
  <reprompt /> 
  <elseif cond="Metro9==2" /> 
  <goto nextitem="Metro10" /> 
  <elseif cond="Metro9=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro9=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro9" expr="0" /> 
  </catch>
  </field>
- <field name="Metro10">
  <grammar type="application/x-jsgf" mode="dtmf">0|1|2|"*"|"#"</grammar> 
  <prompt bargein="true">Roy...</prompt> 
- <filled>
- <if cond="Metro10==1">
  <clear namelist="Metro10" /> 
  <reprompt /> 
  <elseif cond="Metro10==2" /> 
  <goto nextitem="Metro11" /> 
  <elseif cond="Metro10=='*'" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="Metro10=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <assign name="Metro10" expr="0" /> 
  </catch>
  </field>
- <field name="EndValue">
  <grammar type="application/x-jsgf" mode="dtmf">1</grammar> 
  </field>
- <filled>
- <if cond="EndValue==1">
  <goto next="#ListEnd" /> 
  </if>
  </filled>
- <catch event="noinput nomatch">
  <goto next="#ListEnd" /> 
  </catch>
  </form>
- <form id="ListEnd">
  <property name="timeout" value="5" /> 
- <field name="EndChoice">
  <grammar type="application/x-jsgf" mode="dtmf">1|2|"#"</grammar> 
  <prompt bargein="true">To repeat these listings, press 1. To go back to the main menu, press 2. Press the pound key to disconnect.</prompt> 
- <filled>
- <if cond="EndChoice==1">
  <goto nextitem="Metro1" /> 
  <elseif cond="EndChoice==2" /> 
  <goto next="EEPhillymenu.vxml" /> 
  <elseif cond="EndChoice=='#'" /> 
  <goto next="#end" /> 
  </if>
  </filled>
- <nomatch>
  I did not understand that response. 
  <reprompt /> 
  </nomatch>
- <noinput>
  <reprompt /> 
  </noinput>
- <noinput count="3">
  <prompt>Thank you for calling.</prompt> 
  <disconnect /> 
  </noinput>
  </field>
  </form>
- <form id="end">
- <block>
  <prompt>Thank you for calling.</prompt> 
  <disconnect /> 
  </block>
  </form>
  </vxml>

So it appears to work just fine. That is, until I actually call the assigned phone number. The system reads up to and through the first field (Metro 1) correctly and then goes through the rest of them, not reading anything off until it gets to the form labeled "ListEnd". What's going on here? At first i started thinking that maybe I have to re-reference the PHP "include" statement, make sure the $result array is still open. However, that can't be the case because, as you can see above, it's reading the rows of data just fine.

I've included the call log below.

Code: Select all

Mon 12 Nov 2007 09:11:03 PM EST:

Call Start Event: ANII 4844618069 DNIS 3569 VURL http://hosting.plumgroup.com/plumvp/director.vxml 
DocumentParser::FetchDocument() 
DocumentParser::FetchDocument(http://hosting.plumgroup.com/plumvp/director.vxml) 
Cache Hit: http://hosting.plumgroup.com/plumvp/director.vxml 
VXI::var_element(name="dnis" expr = "session.telephone.dnis") 
DocumentParser::FetchDocument(director.php) 
Posted form data is URL encoded 
Attempting to fetch http://hosting.plumgroup.com/plumvp/director.php 
Click here to view saved VoiceXML script
DocumentParser::FetchDocument(http://www.URL/FileName.php) 
Cache Miss: http://www.URL/FileName.php 
Attempting to fetch http://www.URL/FileName.php 
Click here to view saved VoiceXML script
GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
0|1|2|"*"|"#" 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
1 
</grammar> 

--------- 

GrammarManager::CreateGrammarFromString(application/x-jsgf): 
--------- 

<?xml version='1.0'?> 
<grammar xml:lang="en-us" mode="dtmf"> 
1|2|"#" 
</grammar> 

--------- 

bargein set to false 
INPUTMODES set to "DTMF VOICE" 
Audio segment added to prompt queue from TTS application/synthesis+ssml for: 
--------- 
<?xml version='1.0'?><speak> 
The following is a complete listing in the Philadelphia metro. 
Press 1 at any time to repeat a listing. 
Press 2 to skip to the next listing. 
Press the star key to go back to the previous menu. 
Press the pound key to disconnect. 
</speak> 
--------- 


Mon 12 Nov 2007 09:11:04 PM EST:

Newly queued prompts are now being played 
VXI::queue_prompts() 
bargein set to true 
INPUTMODES set to "DTMF VOICE" 
Audio segment added to prompt queue from TTS application/synthesis+ssml for: 
--------- 
<?xml version='1.0'?><speak> 
Bottom ...</speak> 
--------- 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro1' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:11:20 PM EST:

Newly queued prompts are now being played 


Mon 12 Nov 2007 09:11:34 PM EST:

received event: noinput 
VXI::assign_element(name="Metro1" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro2' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:11:38 PM EST:

received event: noinput 
VXI::assign_element(name="Metro2" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro3' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:11:41 PM EST:

received event: noinput 
VXI::assign_element(name="Metro3" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro4' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:11:44 PM EST:

received event: noinput 
VXI::assign_element(name="Metro4" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro5' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:11:47 PM EST:

received event: noinput 
VXI::assign_element(name="Metro5" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro6' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:11:51 PM EST:

received event: noinput 
VXI::assign_element(name="Metro6" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro7' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:11:54 PM EST:

received event: noinput 
VXI::assign_element(name="Metro7" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro8' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:11:57 PM EST:

received event: noinput 
VXI::assign_element(name="Metro8" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro9' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:12:01 PM EST:

received event: noinput 
VXI::assign_element(name="Metro9" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'Metro10' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:12:04 PM EST:

received event: noinput 
VXI::assign_element(name="Metro10" expr = "0" 
VXI::field_element - activating grammars for form = 'AllPhilly' formitem = 'EndValue' 
VXI::do_recognition() 
PromptManager::Play() 


Mon 12 Nov 2007 09:12:07 PM EST:

received event: noinput 
VXI::queue_prompts() 
bargein set to true 
INPUTMODES set to "DTMF VOICE" 
Audio segment added to prompt queue from TTS application/synthesis+ssml for: 
--------- 
<?xml version='1.0'?><speak> 
To repeat these listings, press 1. 
To go back to the main menu, press 2. 
Press the pound key to disconnect. 
</speak> 
--------- 
VXI::field_element - activating grammars for form = 'ListEnd' formitem = 'EndChoice' 
VXI::do_recognition() 
PromptManager::Play() 
Newly queued prompts are now being played 


Mon 12 Nov 2007 09:12:14 PM EST:

Found grammar match 
hypothesis #0: # (0.9990) 
bargein set to true 
INPUTMODES set to "DTMF VOICE" 
Audio segment added to prompt queue from TTS application/synthesis+ssml for: 
--------- 
<?xml version='1.0'?><speak> 
Thank you for calling. 
</speak> 
--------- 
VXI::disconnect_element() 
Newly queued prompts are now being played 


Mon 12 Nov 2007 09:12:18 PM EST:

Disconnect 
Disconnecting On Channel 3 
received event: connection.disconnect.hangup 
Disconnect 
Disconnecting On Channel 3 
VXI::exit_element() 
Call End Event 
Ending session 
Ending Session On Channel 3 
Assistance very much appreciated :cry:

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR code example for using <reprompt>

Post by support »

Hi,

You should add a <reprompt> in each of your catch blocks so the sample IVR code is

Code: Select all

<catch event="noinput nomatch">
  <assign name="Metro1" expr="0" />
  <reprompt/>
  </catch>
You would have to do this for the <catch> blocks of Metro2, Metro3, Metro4, Metro5,... all the way up to Metro10. This would allow you to listen to all the fields.

Hope this helps.

Regards,
Plum Support

Post Reply