Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Music Fails to Play - dialogRequestId mismatch when using voice command from phone to SampleApp #2092

Open
1 task done
stevenoonan opened this issue Jun 27, 2023 · 0 comments

Comments

@stevenoonan
Copy link

stevenoonan commented Jun 27, 2023

Briefly summarize your issue:

When I try to play music with a voice command from my phone's Alexa to my Ubuntu box running the SampleApp, the command makes it to the SampleApp but fails to play music.

When I play music via the GUI on the Alexa phone app, it works. When I directly command the SampleApp via voice, it works.

What is the expected behavior?

Music should play regardless of voice or GUI command.

What behavior are you observing?

The SampleApp is failing on a check of m_dialogRequestId.

When using a voice command on the Alexa phone app, the DirectiveProcessor has it set to the empty string "" and message from the cloud has it set to "null". This causes the check at DirectiveProcessor.cpp 94 to fail.

if (!directive->getDialogRequestId().empty() && directive->getDialogRequestId() != m_dialogRequestId) { /* ...... */ }

A sample log of the dropped action:

DirectiveProcessor:onDirective:messageId=5283361e-fa76-4cea-8a4e-9dd0defa14c0,action=dropped,reason=dialogRequestIdDoesNotMatch,namespace=System,name=ResetUserInactivity,directivesDialogRequestId=null,dialogRequestId=ded0e913-2843-4147-992f-696be1214ad3

When the command comes down from the cloud using the Alexa phone app GUI, the m_dialogRequestId from the AVSMessageHeader is set to the empty string "" instead of "null", and music works.

My fix is to check avsDialogRequestId in parseHeader() for "null", and if so, set it to "".

#define DEBUG_NORMALIZE_NULLDLG_REQ_ID

    // This is an optional header field - it's ok if it is not present.
    // Avoid jsonUtils::retrieveValue because it logs a missing value as an ERROR.
    std::string avsDialogRequestId;
    auto it = headerIt->value.FindMember(JSON_MESSAGE_DIALOG_REQUEST_ID_KEY);
    if (it != headerIt->value.MemberEnd()) {
        convertToValue(it->value, &avsDialogRequestId);
    }

#ifdef DEBUG_NORMALIZE_NULLDLG_REQ_ID
    /* FIX: normalize "null" to "" */
    if (avsDialogRequestId == "null") {
        avsDialogRequestId = "";
    }
#endif

With that fix, everything seems to work fine.

Provide the steps to reproduce the issue, if applicable:

It currently fails every time on my setup. I don't know why the cloud is sending a "null vs "".

Tell us about your environment:

What version of the AVS Device SDK are you using?

  3.0.0

Tell us what hardware you're using:

  • [X ] Desktop / Laptop

Tell us about your OS (Type & version):

  • WSL Ubuntu Linux 20.04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant