jarvis
jarvis copied to clipboard
Problème utilisation Bing (statusCode": 401, "message": "Access denied due to invalid subscription key)
Bonjour à tous,
J'essaye d'installer Jarvis sur Mon Raspberry mais je ne parviens pas à le faire fonctionner avec Bing (j'ai le fameux message d'erreur DEBUG: json={ "statusCode": 401, "message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription." }
Je précise que j'utilise SnowBoy pour le HotWord qui fonctionne bien et Jarvis fonctionne bien en mode ligne de commande ou avec la reconnaissance vocale également positionnée sur SnowBoy (mais que je ne souhaite pas garder pour éviter d'enregistrer toutes les commandes).
J'ai essayé de suivre les proposition de résolution positionnées ici, mais je n'y parviens pas malgré le test d'un nouveau main.sh pour bing https://github.com/alexylem/jarvis/issues/888
Je me pose la question de la génération de ma clé sur Bing car je suis allé ici pour l'obtenir : https://azure.microsoft.com/fr-fr/try/cognitive-services/
Je me suis authentifié et j'ai récupéré deux clés avec le message suivant : "Services vocaux pour essais gratuits sur Azure.com. 5 000 transactions par mois, 20 par minute. Les clés de version d’essai expirent après une période de 30 jours à l’issue de laquelle vous pouvez créer un compte Cognitive Services sur le portail Azure. Point de terminaison: https://westus.api.cognitive.microsoft.com/sts/v1.0 Clé 1: e2095c6cd62a4a578f1....... Clé 2: 3a220230b8a44ba7a6......."

Or je vois que le EndPoint est westus.api.cognitive.microsoft.com alors que je me suis connecté avec des paramètres et un compte "France". J'ai cherché partout mais je n'arrive pas à trouver comment générer une clé pour pouvoir utiliser l'URL proposée dans le main.sh de xStroke (post https://github.com/alexylem/jarvis/issues/888)
"localrequest="https://westeurope.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?"
Donc je ne sais pas dire si j'obtiens le message d'erreur car ma clé n'est pas valide ou si mon main.sh n'est pas bon (je précise que le main.sh installé avec Jarvis ne fonctionne pas non plus).
Voici ce que me donne Jarvis en mode debug 👍
MOI: (listening...)
DEBUG: goin in bin_STT()
DEBUG: start_listening hook
utils/timeout.sh 10 python recorders/snowboy/main.py 10 /dev/shm/jarvis-record.wav
________________|||||||||||||||||||___INFO:recorder:Ticks status: 16 19 3
DEBUG: speech duration was 20 (10 = 1 sec)
DEBUG: stop_listening hook
DEBUG: token missing or expired
* Trying 13.93.122.1...
* TCP_NODELAY set
* Connected to westeurope.api.cognitive.microsoft.com (13.93.122.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [85 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [3275 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [365 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [102 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=*.cognitive.microsoft.com
* start date: Nov 29 11:22:55 2017 GMT
* expire date: Nov 29 11:22:55 2019 GMT
* subjectAltName: host "westeurope.api.cognitive.microsoft.com" matched cert's "*.api.cognitive.microsoft.com"
* issuer: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; OU=Microsoft IT; CN=Microsoft IT TLS CA 2
* SSL certificate verify ok.
} [5 bytes data]
> POST /sts/v1.0/issueToken HTTP/1.1
> Host: westeurope.api.cognitive.microsoft.com
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 0
> Ocp-Apim-Subscription-Key: e2095c6cd62a4axxxxxxxxxxxxx (NB : changé pour l'exemple)
>
{ [5 bytes data]
< HTTP/1.1 401 Access Denied
< Content-Length: 143
< Content-Type: application/json
< apim-request-id: 511f61a4-0192-47d4-be16-d73d94a6d593
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
< WWW-Authenticate: AzureApiManagementKey realm="https://westeurope.api.cognitive.microsoft.com/sts/v1.0",name="Ocp-Apim-Subscription-Key",type="header"
< Date: Sun, 13 Jan 2019 14:23:00 GMT
<
{ [143 bytes data]
* Curl_http_done: called premature == 0
* Connection #0 to host westeurope.api.cognitive.microsoft.com left intact
DEBUG: json={ "statusCode": 401, "message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription." }
ERROR: Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.
(listening...)
Quelqu'un pourrait-il m'aider ? Merci par avance et très bonne journée.
Bonjour,
Est-ce que tu peux essayer avec la branche beta de Jarvis qui intègre la nouvelle API Azure ?
Sinon lors de mon essai j'ai aussi eu une clef API westus.api.cognitive.microsoft.com
Bonjour Oliv4945, Merci beaucoup pour ton aide. Aucun souci pour essayer la branche béta, mais désolé pour la question de néophyte, comment fait-on pour installer la branche béta ? J'ai essayer de chercher sur internet et sur le forum et je n'ai pas trouvé. Merci d'avance pour ton retour. Très bonne soirée !
Up : c'est bon j'ai trouvé : setting => general => branch => beta puis update. J'installe ce soir et je ferai un test ASAP ! Je vous tiens au courant. Très bonne soirée !
Bonsoir,
Alors testé ce soir et même résultat. Voici le résultat de test.sh avec le main.sh installé par Jarvis beta :
MAIN
DEBUG: token missing or expired
DEBUG: json={ "statusCode": 401, "message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription." }
ERROR: Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.
et avec le main.sh de xStroke :
MAIN
DEBUG: token missing or expired
* Trying 13.93.122.1...
* TCP_NODELAY set
* Connected to westeurope.api.cognitive.microsoft.com (13.93.122.1) port 443 (#0 )
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [85 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [3275 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [365 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [102 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=*.cognitive.microsoft.com
* start date: Nov 29 11:22:55 2017 GMT
* expire date: Nov 29 11:22:55 2019 GMT
* subjectAltName: host "westeurope.api.cognitive.microsoft.com" matched cert's "*.api.cognitive.microsoft.com"
* issuer: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; OU=Microsoft IT; CN=Microsoft IT TLS CA 2
* SSL certificate verify ok.
} [5 bytes data]
> POST /sts/v1.0/issueToken HTTP/1.1
> Host: westeurope.api.cognitive.microsoft.com
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 0
> Ocp-Apim-Subscription-Key: 1e7742e8ce945dcb4xxxxxxxxxxxxx
>
{ [5 bytes data]
< HTTP/1.1 401 Access Denied
< Content-Length: 143
< Content-Type: application/json
< apim-request-id: 06ff354c-3d98-4553-88cd-94ff753739ad
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
< WWW-Authenticate: AzureApiManagementKey realm="https://westeurope.api.cognitiv e.microsoft.com/sts/v1.0",name="Ocp-Apim-Subscription-Key",type="header"
< Date: Fri, 18 Jan 2019 17:33:30 GMT
<
{ [143 bytes data]
* Curl_http_done: called premature == 0
* Connection #0 to host westeurope.api.cognitive.microsoft.com left intact
DEBUG: json={ "statusCode": 401, "message": "Access denied due to invalid subscr iption key. Make sure to provide a valid key for an active subscription." }
ERROR: Access denied due to invalid subscription key. Make sure to provide a val id key for an active subscription.
Donc a priori pas d'évolution avec la version béta...
Bonsoir, La même chose, le même problème, le même résultat. Key bing bonne et à jour region = northeurope main.sh beta ou celui de de xStroke
Je ne sais plus quoi faire pour sauver Jarvis
En attendant, j'utilise WIT, ça fonctionne du premier coup parfaitement mais je trouve un peu lent, c'est pour ça que je voulais tester Bing... Très bonne soirée
Bonjour à tous,
J'ai un petit problème avec Bing Je suis sur la branche beta, ras de ce coté. En jarvis -nv (debug) , tout fonctionnent correctement, bing fait le travail Par contre en normal (sans debug), bing ne fonctionne pas. il lance l'enregistrement (le / tourne) puis rien.
Je ne peux pas vous mettre le debug/log car cela ne fonctionne qu'EN debug.
Quelqu'un à un piste ?
Merci par avance,
Bonjour, Effectivement WIT fonctionne bien, il est un peu plus lent à réagir, (il va pas WIT ...) mais par contre je crois que son utilisation est gratuite (pas de carte bancaire) et non limitée.
Bonjour, J'ai essayé de désinstaller / réinstaller sans succès. Quelqu'un a-t-il une piste pour faire fonctionner bing ? Merci d'avance !
Bonsoir.
Bing a changé ses méthodes. Je vous retrouverai les sources mais en gros le totalement gratuit, n'existe plus. Moi qui vient de monter mon jarvis avec snowboy en hotword et Bing en commandes, j'ai été obligé de faire comme ca: un compte "pay as you go" en option f0 sur l'api speech dans cognitive service. Au final c'est gratuit mais avec des limites mensuelles. Perso ça me suffit largement pour l'instant... À voir quand jarvis sera totalement opérationnel... Mais bon au moins ça roule 😜
Edit: voir le #909
Bonjour ArnoCtout as tu eu une réponce a ton problème de mode débug ? car j'ai le même. Salutations JB
Bonsoir,
Alors testé ce soir et même résultat. Voici le résultat de test.sh avec le main.sh installé par Jarvis beta :
MAIN DEBUG: token missing or expired DEBUG: json={ "statusCode": 401, "message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription." } ERROR: Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.et avec le main.sh de xStroke :
MAIN DEBUG: token missing or expired * Trying 13.93.122.1... * TCP_NODELAY set * Connected to westeurope.api.cognitive.microsoft.com (13.93.122.1) port 443 (#0 ) * ALPN, offering h2 * ALPN, offering http/1.1 * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: /etc/ssl/certs/ca-certificates.crt CApath: /etc/ssl/certs * TLSv1.2 (OUT), TLS header, Certificate Status (22): } [5 bytes data] * TLSv1.2 (OUT), TLS handshake, Client hello (1): } [512 bytes data] * TLSv1.2 (IN), TLS handshake, Server hello (2): { [85 bytes data] * TLSv1.2 (IN), TLS handshake, Certificate (11): { [3275 bytes data] * TLSv1.2 (IN), TLS handshake, Server key exchange (12): { [365 bytes data] * TLSv1.2 (IN), TLS handshake, Server finished (14): { [4 bytes data] * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): } [102 bytes data] * TLSv1.2 (OUT), TLS change cipher, Client hello (1): } [1 bytes data] * TLSv1.2 (OUT), TLS handshake, Finished (20): } [16 bytes data] * TLSv1.2 (IN), TLS change cipher, Client hello (1): { [1 bytes data] * TLSv1.2 (IN), TLS handshake, Finished (20): { [16 bytes data] * SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384 * ALPN, server did not agree to a protocol * Server certificate: * subject: CN=*.cognitive.microsoft.com * start date: Nov 29 11:22:55 2017 GMT * expire date: Nov 29 11:22:55 2019 GMT * subjectAltName: host "westeurope.api.cognitive.microsoft.com" matched cert's "*.api.cognitive.microsoft.com" * issuer: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; OU=Microsoft IT; CN=Microsoft IT TLS CA 2 * SSL certificate verify ok. } [5 bytes data] > POST /sts/v1.0/issueToken HTTP/1.1 > Host: westeurope.api.cognitive.microsoft.com > User-Agent: curl/7.52.1 > Accept: */* > Content-Type: application/x-www-form-urlencoded > Content-Length: 0 > Ocp-Apim-Subscription-Key: 1e7742e8ce945dcb4xxxxxxxxxxxxx > { [5 bytes data] < HTTP/1.1 401 Access Denied < Content-Length: 143 < Content-Type: application/json < apim-request-id: 06ff354c-3d98-4553-88cd-94ff753739ad < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload < x-content-type-options: nosniff < WWW-Authenticate: AzureApiManagementKey realm="https://westeurope.api.cognitiv e.microsoft.com/sts/v1.0",name="Ocp-Apim-Subscription-Key",type="header" < Date: Fri, 18 Jan 2019 17:33:30 GMT < { [143 bytes data] * Curl_http_done: called premature == 0 * Connection #0 to host westeurope.api.cognitive.microsoft.com left intact DEBUG: json={ "statusCode": 401, "message": "Access denied due to invalid subscr iption key. Make sure to provide a valid key for an active subscription." } ERROR: Access denied due to invalid subscription key. Make sure to provide a val id key for an active subscription.Donc a priori pas d'évolution avec la version béta...
Bonjour, Visiblement, tu tapes encore "westeurope.api.cognitive.microsoft.com". Il faudrait essayer de modifier cette url en westus.api.cognitive.microsoft.com.
Je viens d'installer Jarvis pour la première fois et j'ai du modifier des choses dans le main.sh pour que Bing fonctionne.
Je suis sur la branch normale non en béta.
Cordialement.
Bonjour à tous,
je me lance juste en domotique avec PI 3B+, et ai installé Jarvis ce week-end. Tout d'abord merci à tous les contributeurs et les créateurs de Jarvis... ca me promet des bons moments d'amusements avec ce superbe joujou :)
bon, maintenant les réjouissances: j'ai installé Bing et bien sur... ce ne marchait pas. J'y ai passé quelques heures, et ai pu corriger le pb. Du coup, je me dis que partager serait une bonne idée !!!
En synthèse, et comme dit par plusieurs personnes dans des post, le service a évolué. il faut donc désormais :
1- créer un compte sur Azure pour bénéficer de la nouvelle mouture de speech (de nombreux messages explique cela en détail)
2- récupérer depuis la console Azure l'url à appeler. vous pouvez également la récupérer directement ici: https://docs.microsoft.com/fr-fr/azure/cognitive-services/speech-service/rest-speech-to-text
Une fois le service créer, il faut modifier le fichier main.sh (dans jarvis/stt_engines/bing/main.sh)
3- modifier les deux urls Bing a- l'url d'appel à l'authentification
local json=`curl -X POST "https://francecentral.api.cognitive.microsoft.com/sts/v1.0/issuetoken" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Content-Length: 0" \
-H "Ocp-Apim-Subscription-Key: $bing_speech_api_key" \
--silent`
b- l'url d'appel au service
local request="https://francecentral.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=fr-FR"
request+="&format=simple"
request+="&profanity=raw" #with this we avoid the insult with <profanity> tags
et l'appel au service (en rajoutant bien le Host, qui semble désormais nécessaire)
json=`curl "$request" \
-H "Accept: application/json" \
-H "Transfer-Encoding: chunked" \
-H "Host: francecentral.stt.speech.microsoft.com" \
-H "Content-Type: audio/wav; codec=audio/pcm; samplerate=16000" \
-H "Authorization: Bearer $stt_bing_token" \
--data-binary "@$audiofile" \
--silent --fail`
4- enfin, la structure du JSON de retour a dû évolué également, donc même si en changeant les urls, Azure renvoi bien la bonne phrase (on peut le voir en mode verbose dans les logs), le parsing ne se fait pas correctement et on a toujours rien --> il faut donc modifier, toujours dans le main.sh, le parsing du résultat de Azure Speech
$verbose && jv_debug "DEBUG: json=$json"
# $local status=`echo $json | perl -lne 'print $1 if m{"status":"([^"]*)"}'`
local status=`echo $json | perl -lne 'print $1 if m{"RecognitionStatus":"([^"]*)"}'`$
if [ "$status" = "Success" ]; then
# echo $json | perl -lne 'print $1 if m{"name":"([^"]*)"}' > $forder
echo $json | perl -lne 'print $1 if m{"DisplayText":"([^"]*)"}' > $forder
fi
En modifiant tout ça, ça fonctionne bien maintenant chez moi (après quelques heures pour bien comprendre comment est architecturée l'ensemble).
Je vous joins mon main.sh si toutefois ma prose n'était pas clair (j'ai laissé les anciens appels, en les commentant dans le code) main.sh.txt
Pierre-Yves
et voici mon jarvis.sh -nv pour avoir la réf de ma config... pi@raspberrypi:~/jarvis $ ./jarvis.sh -nv Notice: you can use 'jarvis' instead of './jarvis.sh'
------------ Config ------------
jv_branch master
jv_version
jv_arch armv7l
jv_os_name raspbian
jv_os_version 9
language fr_FR
play_hw hw:0,0
rec_hw hw:0,0
speaker GN Netcom
microphone GN Netcom
recorder sox
trigger_stt snowboy
command_stt bing
tts_engine google
DEBUG: program_startup hook DEBUG: start_speaking hook "Bonjour Pierre-Yves" okgermaine: Bonjour Pierre-Yves DEBUG: using cache /dev/shm/bonjour_pierre-yves.mp3 DEBUG: stop_speaking hook User defined commands: AIDE BONJOUR|SALUT COMMENTAPPELLE* MERCI AU REVOIR|BYE ANNULE*|TERMINE* ENCORE* TEST* VERSION REPETE () ET (*) CA VA >OUI
NON|PAS QUELLE HEURE* FILLES Commands from plugin jarvis-systemd-startup:
Commands from plugin jarvis-testdebitadsl: DEBITINTERNET|ADSL DEBITMINIMUM DEBITMAXIMUM* Commands from plugin jarvis-domoticz: ALLUM[^ ]+ () ETEIN[^ ]+ () FERME () OUVRE () QUELETAT* ()|DONNE COMBIENDEGREEFAIT* ( okgermaine: Waiting to hear 'okgermaine' Pierre-Yves: (listening...) DEBUG: models=okgermaine INFO:snowboy:Ticks: [2, 20, 5, -1]