Dialogflow CX Session Parameter

907 views
Skip to first unread message

anchit...@gmail.com

unread,
Jul 15, 2022, 8:00:14 AM7/15/22
to UniMRCP
Hello Team,

Is it possible to set session parameters in a Dialogflow CX session using unimrcp and FreeSWITCH? 
I went through the forum and found out this:
you can pass parameters via grammar like this   builtin:event/yourevent?callerid=your value

I did a similar implementation but am unsure how to fetch this parameter in my Dialogflow CX as I would like to add the parameter to my fulfilment message. 

play_and_detect_speech(silence_stream://50 detect:unimrcp:google-mrcp-cx {speech-language=en,start-input-timers=false,no-input-timeout=50000,recognition-timeout=15000}builtin:event/welcome?test_number=456456;format=json;projectid=enminilisa-noqxmg;location=global;agent=008da0c3-3c91-4d07-98c4-01c197974a26;language=en;api=v3beta1)

As you can see here, I am triggering an event welcome. And I am hoping to fetch the parameter specified test_number.

Kindly, guide us as to what can be done in this situation.

Thank You,
Anchit Dave

Vahagn Kocharyan

unread,
Jul 15, 2022, 9:33:19 PM7/15/22
to uni...@googlegroups.com
Hi. Please refer to this

You can pass any parameter and get it from $session.params


--
You received this message because you are subscribed to the Google Groups "UniMRCP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unimrcp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unimrcp/c27693b5-dc55-47d1-81ba-dc488dbb806bn%40googlegroups.com.

anchit...@gmail.com

unread,
Jul 21, 2022, 2:08:13 AM7/21/22
to UniMRCP
Hi,

Sorry for the delayed response! Thank you so much for your assistance.
I have tried the steps mentioned above. Tried to pass a parameter called test_number.

FreeSWITCH Command:
session.execute("play_and_detect_speech", 'silence_stream://50 detect:unimrcp:google-mrcp-cx {speech-language=en,start-input-timers=false,' \
                 'no-input-timeout=50000,recognition-timeout=15000}builtin:event/welcome?test_number=456456;format=json;projectid=enminilisa-noqxmg;location=global;agent=008da0c3-3c91-4d07-98c4-01c197974a26;language=en;api=v3beta1')

Dialogflow Setup to fetch the param test_number
Screenshot from 2022-07-21 11-24-44.png

But the prompt I receive does not resolve the variable to its values. 

Response:
{"languageCode":"en","responseMessages":[{"text":{"text":["Hi $session.params.test_number"]}},{"text":{"text":["Can you please provide your registered number?"]}}],"currentPage":{"name":"projects/enminilisa-noqxmg/locations/global/agents/008da0c3-3c91-4d07-98c4-01c197974a26/flows/00000000-0000-0000-0000-000000000000/pages/8d172b2e-08c1-4e3e-904d-de28b0ad6a1e","displayName":"verification.getRegisteredNumber"},"intentDetectionConfidence":1,"diagnosticInfo":{"Alternative Matched Intents":[],"Triggered Transition Names":["4a4088b8-be77-4b70-836c-37a2a485d7d1"],"Transition Targets Chain":[{"TargetPage":"8d172b2e-08c1-4e3e-904d-de28b0ad6a1e"}],"Session Id":"cc66bbb1f5ac4858","Execution Sequence":[{"Step 1":{"InitialState":{"Event":"welcome","FlowState":{"FlowId":"00000000-0000-0000-0000-000000000000","Name":"Default Start Flow","PageState":{"Status":"ENTERING_PAGE","PageId":"START_PAGE","Name":"Start Page"},"Version":0}},"Type":"INITIAL_STATE"}},{"Step 2":{"Type":"STATE_MACHINE","StateMachine":{"FlowState":{"Version":0,"FlowId":"00000000-0000-0000-0000-000000000000","Name":"Default Start Flow","PageState":{"Name":"Start Page","Status":"ENTERING_PAGE","PageId":"START_PAGE"}},"TriggeredEvent":"welcome","TriggeredEventHandlerId":"4a4088b8-be77-4b70-836c-37a2a485d7d1"},"FunctionExecution":{"Responses":[{"responseType":"HANDLER_PROMPT","source":"VIRTUAL_AGENT","text":{"redactedText":["Hi $session.params.test_number"],"text":["Hi $session.params.test_number"]}}]}}},{"Step 3":{"Type":"STATE_MACHINE","FunctionExecution":{"Responses":[{"source":"VIRTUAL_AGENT","responseType":"HANDLER_PROMPT","text":{"redactedText":["Hi $session.params.test_number"],"text":["Hi $session.params.test_number"]}},{"responseType":"ENTRY_PROMPT","source":"VIRTUAL_AGENT","text":{"text":["Can you please provide your registered number?"],"redactedText":["Can you please provide your registered number?"]}}]},"StateMachine":{"FlowState":{"Name":"Default Start Flow","FlowId":"00000000-0000-0000-0000-000000000000","PageState":{"PageId":"8d172b2e-08c1-4e3e-904d-de28b0ad6a1e","Name":"verification.getRegisteredNumber","Status":"ENTERING_PAGE"},"Version":0}}}},{"Step 4":{"StateMachine":{"FlowState":{"FlowId":"00000000-0000-0000-0000-000000000000","Name":"Default Start Flow","PageState":{"Name":"verification.getRegisteredNumber","FormFilled":true,"Status":"TRANSITION_ROUTING","PageId":"8d172b2e-08c1-4e3e-904d-de28b0ad6a1e"},"Version":0}},"Type":"STATE_MACHINE"}}],"Unfulfilled Parameters":["$session.params.test_number"]},"triggerEvent":"welcome","match":{"matchType":"EVENT","confidence":1,"event":"welcome"}}

Prompt Received: 
"Hi $session.params.test_number" instead of "Hi 456456"

Kindly help me with the same. I think I am missing something?
FYI, I am triggering a custom event!

Thank You
Anchit Dave

Vahagn Kocharyan

unread,
Jul 22, 2022, 2:10:36 PM7/22/22
to UniMRCP
Hi 
Try to use builtin:intent/welcome?parameters={' test_number  ':' 456456  '} 

Regards
Vahagn

anchit...@gmail.com

unread,
Jul 28, 2022, 2:30:29 AM7/28/22
to UniMRCP
This solved our issue. Thank you so much.
Reply all
Reply to author
Forward
0 new messages