VXML record processing dtmf termchar - voice-recording

I am having trouble processing a dtmf within a record tag.
I am looking to identify the zero entered during recording and perform specific action based on the value. zero could be entered anytime before or after speaking.
With the following snippet I see that when I enter zero, the application exits. It looks like the block tag is reached, but then processing terminates. I am not sure what the problem is here. Or is there a better way to acheive the same?
I also referred the answer here: VoiceXML - Recognize DTMF in Recording, but need more details.
<form id="recordMessage">
<property name="termchar" value="" />
<property name="inputmodes" value="dtmf" />
<var name="lastdtmfchar" expr="1"/>
<record name="recording" beep="true" maxtime="120s" dtmfterm="false" type="audio/wav">
<grammar mode="dtmf" version="1.0" root="dtmfSettings" xmlns="http://www.w3.org/2001/06/grammar">
<rule id="dtmfSettings" >
<one-of>
<item>0</item>
<item>#</item>
</one-of>
</rule>
</grammar>
<filled>
<assign name="lastdtmfchar" expr="recording$.termchar"/>
<if cond = "recording$.termchar == '#'">
<prompt> Hash entered
</prompt>
</if>
<if cond = "recording$.termchar == '0'">
<prompt> zero entered
</prompt>
</if>
</filled>
</record>
<block>
<if cond = "lastdtmfchar == '1'">
<prompt> block value not assigned
</prompt>
</if>
<if cond = "lastdtmfchar == '#'">
<prompt> block hash entered
</prompt>
</if>
<if cond = "lastdtmfchar == '0'">
<prompt> block zero entered
</prompt>
</if>
</block>
There is only this record tag in the form, but the root doc has all the handlers..
<vxml .....>
<catch event="connection.disconnect.hangup">
<goto next="${hangupUrl}?cause=hangup" />
</catch>
<catch event="connection.disconnect">
<goto next="${hangupUrl}?cause=disconnect" />
</catch>
<catch event="error">
<prompt>
<audio src="${goodbyeUrl">
</audio>
</prompt>
<exit/>
</catch>
<catch event="*">
<prompt>
<audio src="${goodbyeUrl">
</audio>
</prompt>
<exit/>
</catch>
<property name="termchar" value="#"/>
<link dtmf="0" next="${globalHandlerUrl}">
</link>
</vxml>

As you mentioned, dtmfterm = false may be the reason.
You can get the grammar matched character by accessing application.lastresult$. Refer http://www.w3.org/TR/voicexml20/#dml2.3.6
Agree with #kevin that in IVRs, a lot of things depend on the vendor itself (using a grammar in record is itself optional in the spec)

Related

Blazorise LayoutSider not visible to anonymous users

I'm building a new .NET 6.0 application using Blazor Web Server and Blazorise 0.9.5.2.
As presently configured, the sider layout is only visible to logged-in users. Anonymous users see the entire layout except the sider. Comparing the HTTP content in both conditions shows that the only differences between anonymous and logged-in users are the presence or absence of the two nav bar links that depend on authorization, as well as the out-of-the-box display of "Welcome, user" vs. "Login" in the upper right corner. Chrome shows no failures to download CSS or JS in either case.
The MainLayout.razor looks like this:
<Layout Sider="true">
<LayoutSider>
<LayoutSiderContent>
<Bar Breakpoint="Breakpoint.Desktop" NavigationBreakpoint="Breakpoint.Tablet" ThemeContrast="ThemeContrast.Dark"
Mode="BarMode.VerticalInline" CollapseMode="BarCollapseMode.Small">
<BarToggler />
<BarBrand>
<BarItem>
<BarLink To="">
<BarIcon IconName="_customIcon" />
My SIte
</BarLink>
</BarItem>
</BarBrand>
<NavMenu />
</Bar>
</LayoutSiderContent>
</LayoutSider>
<Layout>
<LayoutHeader Fixed="true">
<Bar #bind-Visible="#_topbarVisible" Breakpoint="Breakpoint.Desktop" Background="Background.Primary" ThemeContrast="ThemeContrast.Light">
<BarBrand>
<BarItem>
<BarLink To="">
<BarIcon IconName="FontAwesomeIcons.CloudSun" />
My Site
</BarLink>
</BarItem>
</BarBrand>
#* ReSharper disable once UnknownCssClass *#
<BarMenu Class="justify-content-end">
<BarEnd>
<AuthorizeView>
<Authorized>
<BarItem>
<Blazorise.Icon Name="FontAwesomeIcons.User" Visibility="Visibility.Visible" />
Hi, #context?.User?.Identity?.Name
</BarItem>
</Authorized>
</AuthorizeView>
<BarItem>
<LoginDisplay />
</BarItem>
</BarEnd>
</BarMenu>
</Bar>
</LayoutHeader>
<LayoutContent Padding="Padding.Is4.OnX">
#Body
</LayoutContent>
<LayoutFooter Fixed="true" Padding="Padding.Is4.OnX">
Copyright ©#DateTimeOffset.UtcNow.Year Inner Drive Technology.
</LayoutFooter>
</Layout>
</Layout>
The NavMenu.razor component looks like this:
#using Blazorise.Icons.FontAwesome
<BarMenu>
<BarStart>
<BarItem>
<BarLink To="">
<BarIcon IconName="FontAwesomeIcons.Home" />
Home
</BarLink>
</BarItem>
<BarItem>
<BarLink To="/Current">
<BarIcon IconName="FontAwesomeIcons.CloudSun" />
Current
</BarLink>
</BarItem>
<AuthorizeView>
<Authorized>
<BarItem>
<BarLink To="/ApiStatus">
<BarIcon IconName="FontAwesomeIcons.Server" />
API Status
</BarLink>
</BarItem>
<BarItem>
<BarLink To="/BuildStatus">
<BarIcon IconName="FontAwesomeIcons.Rocket" />
Build Status
</BarLink>
</BarItem>
</Authorized>
</AuthorizeView>
<BarItem>
<BarLink To="/About">
<BarIcon IconName="FontAwesomeIcons.InfoCircle" />
About
</BarLink>
</BarItem>
</BarStart>
</BarMenu>
Program.cs contains this section:
builder.Services.AddRazorPages(options =>
{
options.Conventions.AllowAnonymousToFolder("/");
options.Conventions.AllowAnonymousToPage("/Index");
options.Conventions.AllowAnonymousToFolder("/_content");
options.Conventions.AllowAnonymousToFolder("/Pages");
options.Conventions.AllowAnonymousToFolder("/Shared");
});
The problem seems to be the presence of the Mode="BarMode.VerticalInline" attribute. (I'll spare you the A/B testing that led to this conclusion.) When the Mode attribute is present, the entire sider is hidden for anonymous users. When it's absent, the entire sider is visible.
Anyone know what's up with this?
Well, this was fun. And all that CORS stuff was a red herring.
The issue: the default AddAuthorization service provider options blocked a request somewhere, so removing it allowed all the page components to load, even while keeping the authentication-required bits hidden.
builder.Services.AddAuthorization(options =>
{
// By default, all incoming requests will be authorized according to the default policy
//options.FallbackPolicy = options.DefaultPolicy; // Removed this line
});
Removing the fallback policy fixed this issue.

Alfresco share worflow form validation

I have been trying to validate my alfresco share workflow form for several days without success. This is what i have done.
Configured my workflow in the share-config-custom.xml located in %TOMCAT_HOME%tomcat\shared\classes\alfresco\web-extension
set my contraint handler as follows.
<constraint-handlers>
<constraint type="MANDATORY"
validation-handler="Alfresco.forms.validation.examplestaffnumber"
event="keyup" />
</constraint-handlers>
</field>
This field i have set to mandatory
< label-id="Staff Number" id="leave:staffnumber" mandatory="true">
I have created the contraint hanlder javascript and placed it at %ALFRESCO_HOME%\tomcat\webapps\share\js folder. This is both js and min.js
Finaly added the js in form.get.head.ftl located at %ALFRESCO_HOME%tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\form
folder like this
<#script type="text/javascript" src="${page.url.context}/res/js/examplevalidation.js">
When I select my worflow form and key values in the staff number form nothing happens. I have checked in the firebug but there is no any call to the js.
Where could i have gone wrong?
I think you have not added dependencies for your java script. To do that add below code in your share-config-custom.xml located in %ALFRESCO_HOME%tomcat\shared\classes\alfresco\web-extension
<config>
<forms>
<dependencies>
<js src="/js/examplevalidation.js" />
</dependencies>
</forms>
</config>
And your constrains handler should be like
<field id="leave:staffnumber" label-id="Staff Number" mandatory="true">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
<constraint-handlers>
<constraint type="MANDATORY" validation-handler="Alfresco.forms.validation.examplestaffnumber" event="blur"/>
</constraint-handlers>
</field>
And function in your js should be like this:
Alfresco.forms.validation.examplestaffnumber = function examplestaffnumber(
field, args, event, form, silent, message) {
// your code with return statement
}
Hope this helps!!!

How to set REQUEST HEADER in spring Integration

We have a asp page which reading some information form request like this:
varLogon = Request.ServerVariables("HTTP_logon")
If we want to post something to the asp page using spring integration, we are unable to pass the HTTP_logon to the page,
This is not working
Any idea, what and how we can set the request header information?
<int:header-enricher input-channel="pdfgenheaderchannel" output-channel="pdfgenchannel">
<int:header name="HTTP_ordernumber" method="getOrdernumber" ref="reportbean"/>
<int:header name="reportID" method="getReportID" ref="reportbean"/>
<int:header name="Content-Type" value="text/html"/>
<int:header name="logon" value="orderADCB"/>
<int:header name="HTTP_logon" value="orderADCB"/>
</int:header-enricher>
<int-http:outbound-gateway id="pdfgenerationoutboundgateway"
request-channel="pdfgenchannel"
url="http://x.xy.xx.y/convertHTMLtoPDF.asp"
http-method="POST"
expected-response-type="java.lang.String"
charset="UTF-8"
reply-channel="replyChannel"
request-factory="requestFactory" />
You have to specify a header-mapper for the <int-http:outbound-gateway>. By default it maps only standard HTTP headers:
<beans:bean id="headerMapper" class="org.springframework.integration.http.support.DefaultHttpHeaderMapper"
factory-method="outboundMapper">
<beans:property name="outboundHeaderNames" value="*"/>
<beans:property name="userDefinedHeaderPrefix" value=""/>
</beans:bean>
<int-http:outbound-gateway header-mapper="headerMapper"/>
You can user following routing component to route according to header values.
<int:header-value-router input-channel="routingChannel" header-name="headerObject">
<int:mapping value="value1" channel="channel1" />
<int:mapping value="calue2" channel="channel2" />
</int:header-value-router>

NHibernate One-To-Many Delete Not Cascading

I have a 'Photo' class and a 'Comment' class. An Photo can have multiple comments assigned to it.
I have this configured as a one-to-many relationship within my HBM mapping file, and have set cascade="all-delete-orphan" against the 'Comments' bag within the Photo.hbm.xml mapping file.
However, if I try to delete a Photo which has 1 or more Comments associated with it, I am getting 'The DELETE statement conflicted with the REFERENCE constraint "FK_Comments_Photos"'
I tried a couple of other cascade options against the Comments bag in my Photo.hbm.xml but regardless of what I set it to, I'm getting the same outcome each time. I just want to be able to delete a Photo and have any associated comments automatically delete too.
Here is my Photo mapping (edited for brevity):
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" .... default-access="property" default-cascade="none" default-lazy="true">
<class xmlns="urn:nhibernate-mapping-2.2" name="Photo" table="Photos">
<id name="PhotoId" unsaved-value="0">
<column name="PhotoId" />
<generator class="native" />
</id>
...
<bag name="Comments" table="Comments" cascade="all-delete-orphan" order-by="DateTimePosted desc" where="Approved=1">
<key column="PhotoId" />
<one-to-many class="Comment" />
</bag>
</class>
Here is my Comment mapping (edited for brevity):
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" ... default-access="property" default-cascade="none" default-lazy="true">
<class xmlns="urn:nhibernate-mapping-2.2" name="Comment" table="Comments">
<id name="CommentId" unsaved-value="0">
<column name="CommentId"></column>
<generator class="native" />
</id>
...
<property name="Author" not-null="true" />
<property name="Body" not-null="true" />
<property name="Approved" not-null="true" />
<many-to-one name="Photo" not-null="true">
<column name="PhotoId" />
</many-to-one>
</class>
Does anyone have any suggestions as to why the cascade is not happening when I try to delete a Photo with comments associated with it?
UPDATE: The only way I can get the cascade to happen is to configure the 'Delete Rule' within SQL Server against this relationship to 'Cascade', and in doing so means that I don't need to specify any cascade action within my NHibernate Mapping. However, this isn't ideal for me - I'd like to be able to configure the cascade behaviour within the NHibernate Mapping ideally, so I'm still confused as to why it doesn't appear to be taking any notice of my NHibernate cascade setting?
My guess would be that the problem comes from the fact that the many-to-one in the Comment mapping is set to not-null="true".
Because of that, NHibernate is not allowed to set this property to null temporarily before it deletes the Photo object and therefore when is goes about deleting the Photo object SQL Server throws an foreign key exception.
If I remember correctly for the order of actions when deleting is:
Set foreign key value to null in all child objects
Delete parent object
Delete all child references
Try to remove the not-null="true" from the many-to-one and see what will happen.
Try with inverse="true" on the bag collection of your mapping.
I had similar problem for 1 day .. and got frustrated over it.
Finally the solution boiled down to the DB.
I had to change the FK key constraints in "INSERT UPDATE SPECIFICATION"
'Delete Rule' : from 'No Action' to 'Cascade'
additionally you can also set
'Update Rule' : from 'No Action' to 'Cascade'
You can specify the delete-cascade option in NH:
<bag name="Comments" cascade="all-delete-orphan" order-by="DateTimePosted desc" where="Approved=1">
<key column="PhotoId" on-delete="cascade"/>
<one-to-many class="Comment" />
</bag>
You probably should make it inverse. Then I wonder where your FK_Comments_Photos column is specified.

Voicexml how to store input into a global variable

I'm creating a voicexml appliacation.
I want to store an user input into a global variable.
I wondered, the input should be stored in the fieldvar. shouldn't it? After I tried it with this, i tried to store it in an global variable:
<assign name="myvar" expr="'myinput'"/>
but somehow it didn't work. I used value expr="var" as expr.
<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml
http://www.w3.org/TR/voicexml20/vxml.xsd"
version="2.0">
<var name="myProdukt" />
<form id="test">
<field name="var">
<prompt bargein="true" bargeintype="hotword" >Sagen Sie ein Produkt</prompt>
<grammar root="main" version="1.0" xml:lang="de-DE">
<rule id="main" scope="public">
<one-of>
<item> p1 </item>
<item> p2 </item>
<item> p3 </item>
<item> p4 </item>
</one-of>
</rule>
</grammar>
<filled>
<assign name="myProdukt" expr="<value expr="var"/>"/>
</filled>
</field>
</form>
<<!--[...] Here i want to use the input.-->
</vxml>
thanks in advance
---------------EDIT:
now i used this:
<filled>
test
<assign name="myProdukt" expr="var" />
</filled>
I only changed that. The Applications says "test" but then there is an error.
It isn'T allowed to use "var" instead I used an other name :-)
Did you try a simple assignment of field var to the variable myProdukt like so ?
<filled>
<assign name="myProdukt" expr="var"/>
</filled>
Which would be fine except that according to Section 5.1, Variables and Expressions of the Voice XML specification:
VoiceXML variables, including form
item variables, must not contain
ECMAScript reserved words.
So, you'll need to rename the field var to something that is not a reserved word in ECMAscript, say productSelection:
<field name="productSelection">
<!-- .. prompt, grammar as before .. -->
<filled>
<assign name="myProdukt" expr="productSelection"/>
</filled>
</field>

Resources