I modified this external grammar file as below
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" mode="dtmf" version="1.0" root="LAST4SSN_DTMF">
<rule id="LAST4SSN_DTMF" scope="public">
<one-of>
<item>
<tag>out = ""</tag>
<item repeat="4">
<ruleref uri="#DIGIT"/>
<tag>out = out + DIGIT.value;</tag>
</item>
<item repeat="0-1">
#
</item>
<tag> out = "Number"; </tag>
</item>
<item>
0
<tag>
out = "Agent";
out = "COMMAND";
</tag>
</item>
</one-of>
</rule>
<rule id="DIGIT">
<one-of>
<item>
1
<tag>value = "1";</tag>
</item>
<item>
2
<tag>value = "2";</tag>
</item>
<item>
3
<tag>value = "3";</tag>
</item>
<item>
4
<tag>value = "4";</tag>
</item>
<item>
5
<tag>value = "5";</tag>
</item>
<item>
6
<tag>value = "6";</tag>
</item>
<item>
7
<tag>value = "7";</tag>
</item>
<item>
8
<tag>value = "8";</tag>
</item>
<item>
9
<tag>value = "9";</tag>
</item>
<item>
0
<tag>value = "0";</tag>
</item>
</one-of>
</rule>
</grammar>
when I enter only '0', it detects the input and grammar file return COMMAND.
But when I try any other digit, the grammar file always return noMatch...
here is the o/p of MCP logs:
2016-09-04 04:34:36.581 DBUG 0185017C-1029C4B7 10440 08500000 VGGrammarFactory.C:122 ProcessInput(): Calling ProcessInput with 5
2016-09-04 04:34:36.581 DBUG 0185017C-1029C4B7 10440 08500000 VGDTMFRecognitionSessionMgr.C:517 ProcessAllGrammars(): ProcessInput returned NO_MATCH for grammar 5748c0e3ed3c514ba98b91f2f8e32c55
2016-09-04 04:34:36.581 DBUG 0185017C-1029C4B7 10440 08500000 VGDTMFRecognitionThread.C:789 HandleNextTimerEvent(): Next timeout 3000
2016-09-04 04:34:36.600 DBUG 0185017C-1029C4B7 12328 0B200000 MPCDTMFDispatcher.cxx:94 MPCDTMFDispatcher::MediaTransmit - LastDTMFRxTimeIndex=1764903141, LastProcessedDTMF=true, LastDTMF=5, LastRxTime=1764903141, PacketTimeIndex=1764903141
2016-09-04 04:34:36.641 DBUG 0185017C-1029C4B7 11080 0B200000 MPCDTMFDispatcher.cxx:94 MPCDTMFDispatcher::MediaTransmit - LastDTMFRxTimeIndex=1764903141, LastProcessedDTMF=true, LastDTMF=5, LastRxTime=1764903141, PacketTimeIndex=1764903141
2016-09-04 04:34:36.660 DBUG 0185017C-1029C4B7 13248 0B200000 MPCDTMFDispatcher.cxx:94 MPCDTMFDispatcher::MediaTransmit - LastDTMFRxTimeIndex=1764903141, LastProcessedDTMF=true, LastDTMF=5, LastRxTime=1764903141, PacketTimeIndex=1764903141
2016-09-04T04:34:36.932 Trc 33009 INFO 00000000-00000000 11252 02800FA1 Request received: OPTIONS sip:<IP Address>:5170 SIP/2.0
Via: SIP/2.0/UDP <IP Address>:5064;branch=z9hG4bK000000001B86AFA0cc06cc
From: <sip:GVP@<IP Address>:5064>;tag=B58B1BCE-F93F-4522-E491-94E0DE56EB55
To: sip:<IP Address>:5170
Max-Forwards: 70
CSeq: 67985 OPTIONS
Call-ID: 5F9099F5-3F66-434D-19A3-1A0375FB4E23-5064@<IP Address>
Contact: <sip:GVP@<IP Address>:5064>
Content-Length: 0
Supported: timer, uui
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 10440 08500000 VGDTMFRecognitionThread.C:2482 NotifyRecognitionComplete(): Session ID: 23. Completion Result: 3, GramID: , SI Result: (null), ConsumedDigits: 0
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 10440 0C000000 VXMLCallLeg.cxx:4918 VXMLCallLeg::HandleRecognitionComplete called
2016-09-04 04:34:39.581 DBUG 00000000-00000000 13044 0C000000 AppEventBase.h:61 app.VXML-NG AMEVENT_VXML_DTMF_RECO_COMPLETE - ID=23,Cause=RECO_COMPLETE_NO_MATCH,Result=<?xml version='1.0'?><result><interpretation><instance/><input mode="dtmf"><nomatch/></input></interpretation></result>
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 13044 0C000000 VXMLCallLeg.cxx:4932 VXMLCallLeg::HandleDTMFRecoDone called. Cause: 3
2016-09-04 04:34:39.581 DBUG 00000000-00000000 13044 0C000000 VXMLUtils.h:161 PlatformRecoResult() Create PlatformRecoResult 0x20e93890
2016-09-04 04:34:39.581 DBUG 00000000-00000000 13044 0C000000 VXMLUtils.h:252 PlatformPromptDoneInfo() Create PlatformPromptDoneInfo 0x1fa6ef00
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 13044 0C000000 VXMLCallLeg.cxx:5320 Entered delete noinput timeout timer.
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 13044 0C000000 VXMLCallLeg.cxx:2793 VXMLCallLeg::HandlePromptDone: nStatus = 7
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 13044 0C000000 VXMLCallLeg.cxx:2893 VXMLCallLeg::HandlePlayAndCollectDone
2016-09-04 04:34:39.581 DBUG 00000000-00000000 10440 08500000 VGDTMFRecognitionSessionMgr.C:317 DestroySession(): Started. Id: 26
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 4812 0C000000 VXMLSession.cxx:1888 ProcessEvents() Started
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 4812 0C000000 VXMLSession.cxx:1905 ProcessEvents() Event type [6], session id: [0185017C-1029C4B7]
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 4812 0C000000 VXMLSession.cxx:1954 ProcessEvents(): Play and Collect Done
2016-09-04 04:34:39.581 DBUG 10440 08500000 VGDTMFRecognitionThread.C:789 HandleNextTimerEvent(): Next timeout 0
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 4812 0C000000 VXMLSession.cxx:2465 HandlePlayAndCollectDoneEvent() Started
2016-09-04 04:34:39.581 DBUG 0185017C-1029C4B7 4812 0C000000 PlayAndCollectDoneEvent.cxx:65 Initialize() Recognition result: <?xml version='1.0'?><result><interpretation><instance/><input mode="dtmf"><nomatch/></input></interpretation></result>
2016-09-04 04:34:39.581 DBUG 00000000-00000000 4812 0C000000 JSDOMObject.h:284 __JSDOMTRACE ErrorHandler() 00000000202E5C10
2016-09-04 04:34:39.581 DBUG 00000000-00000000 4812 0C000000 JSDOM.cxx:285 __JSDOMTRACE DOMBuilderWrapper() 00000000202E5C00
2016-09-04 04:34:39.581 DBUG 00000000-00000000 4812 0C000000 JSDOM.cxx:299 __JSDOMTRACE m_pBuilder 000000002051FC08
2016-09-04 04:34:39.582 DBUG 00000000-00000000 4812 0C000000 JSDOM.cxx:313 __JSDOMTRACE m_pBuilder->release() 000000002051FC08
2016-09-04 04:34:39.582 DBUG 00000000-00000000 4812 0C000000 JSDOMObject.h:290 __JSDOMTRACE ~ErrorHandler() 00000000202E5C10
2016-09-04 04:34:39.582 DBUG 0185017C-1029C4B7 4812 0C000000 VXMLSession.cxx:2924 PopulateApplicationLastResult(VXMLPromptDoneInfo) Filling in application.lastresult$
2016-09-04 04:34:39.582 DBUG 0185017C-1029C4B7 4812 0C000000 VXMLSession.cxx:2968 PopulateApplicationLastResult(VXMLRecoResult) Filling in application.lastresult$
2016-09-04 04:34:39.582 DBUG 0185017C-1029C4B7 4812 0C000000 VXMLSession.cxx:3026 PopulateApplicationLastResult() Started
2016-09-04 04:34:39.582 DBUG 0185017C-1029C4B7 4812 0C000000 VXMLSession.cxx:3044 PopulateApplicationLastResult() There are 1 interpretation(s)
2016-09-04 04:34:39.582 DBUG 0185017C-1029C4B7 4812 0C000000 VXMLSession.cxx:4249 HandleInputEnd() Started for result: [7]
2016-09-04T04:34:39.582 Int 50025 0185017C-1029C4B7 4812 input_end NO_MATCH|dtmf||||1.000000
How do I handle this 'out' variable in case when multiple digits are to be detected ? Kidnly adivce.