{"id":53015,"date":"2019-11-21T00:00:00","date_gmt":"2019-11-20T21:00:00","guid":{"rendered":"https:\/\/prohoster.info\/blog\/blog_prohoster\/hranilishhe-key-value-ili-kak-nashi-prilozheniya-stali-udobnee"},"modified":"2020-02-18T14:00:51","modified_gmt":"2020-02-18T11:00:51","slug":"hranilishhe-key-value-ili-kak-nashi-prilozheniya-stali-udobnee","status":"publish","type":"post","link":"https:\/\/prohoster.info\/nl\/blog\/administrirovanie\/hranilishhe-key-value-ili-kak-nashi-prilozheniya-stali-udobnee","title":{"rendered":"Key-value opslag, of hoe onze applicaties gebruiksvriendelijker werden","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/Voximplant\/blog\/476452\/\"><img decoding=\"async\" alt=\"Key-value opslag, of hoe onze applicaties gebruiksvriendelijker werden\" src=\"\/wp-content\/uploads\/2019\/11\/686d1669d32a1fb5c5a42cf6c068b19b.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><\/p>\n<p>Wie ontwikkelt op Voximplant, begrijpt het concept van \"applicaties\", die cloudscenario's, telefoonnummers, gebruikers, regels en belqueues met elkaar verbinden. Simpel gezegd zijn applicaties de hoeksteen van de ontwikkeling op ons platform, het toegangspunt tot iedere oplossing gebaseerd op Voximplant, aangezien alles begint met het cre\u00ebren van een applicatie.<\/p>\n<p>Vroeger \"vergeet\" een applicatie noch de acties die door de scenario's worden uitgevoerd, noch de resultaten van berekeningen, zodat ontwikkelaars gedwongen waren om waarden op externe services of op hun backend op te slaan. Als je ooit met local storage in een browser hebt gewerkt, lijkt onze nieuwe functionaliteit hier erg op, omdat het applicaties in staat stelt om \"sleutel-waarde\" paren te onthouden die uniek zijn voor elke applicatie in jouw account. Het functioneren van de opslag is mogelijk gemaakt door een nieuwe module. <noindex><a rel=\"nofollow\" href=\"https:\/\/voximplant.com\/docs\/references\/voxengine\/applicationstorage\">ApplicationStorage<\/a><\/noindex> \u2013 onder deze link vind je een korte handleiding over het gebruik ervan, welkom!<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Je hebt nodig<\/h2>\n<p><\/p>\n<ul>\n<li>een Voximplant-account. Als je er geen hebt, <noindex><a rel=\"nofollow\" href=\"https:\/\/voximplant.com\/sign-up\/\">de registratie is hier.<\/a><\/noindex>;<\/li>\n<li>een Voximplant-applicatie, evenals een scenario, regel en \u00e9\u00e9n gebruiker. Dit alles zullen we in deze tutorial cre\u00ebren;<\/li>\n<li>een webclient om te bellen \u2013 laten we onze webphone gebruiken. <noindex><a rel=\"nofollow\" href=\"https:\/\/phone.voximplant.com\/\">phone.voximplant.com<\/a><\/noindex>.<\/li>\n<\/ul>\n<p><\/p>\n<h2>Voximplant-instellingen<\/h2>\n<p>\nLog eerst in op je account: <noindex><a rel=\"nofollow\" href=\"https:\/\/manage.voximplant.com\/auth\">manage.voximplant.com\/auth<\/a><\/noindex>. Klik in het menu aan de linkerkant op \"Applicaties\", daarna op \"Nieuwe applicatie\" en maak een applicatie met de naam storage. Ga naar de nieuwe applicatie, schakel over naar het tabblad \"Scenario's\" om het scenario countingCalls te maken met de volgende code:<\/p>\n<pre><code class=\"javascript\">require(Modules.ApplicationStorage);\n\nVoxEngine.addEventListener(AppEvents.CallAlerting, async (e) =&gt; {\nlet r = {value: -1};\n\n    try {\n        r = await ApplicationStorage.get('totalCalls');\n        if (r === null) {\n            r = await ApplicationStorage.put('totalCalls', 0);\n        }\n    } catch(e) {\n        Logger.write('Fout bij het ophalen van de totalCalls waarde');\n    }\n\n    try {\n        await ApplicationStorage.put('totalCalls', (r.value | 0) + 1);\n    } catch(e) {\n        Logger.write('Fout bij het bijwerken van de totalCalls waarde');\n    }\n    \n    e.call.answer();\n    e.call.say(`Welkom. Aantal eerdere oproepen: ${r.value}. `, Language.RU_RUSSIAN_MALE);\n\n    e.call.addEventListener(CallEvents.PlaybackFinished, VoxEngine.terminate);\n\n});<\/code><\/pre>\n<p>\nDe eerste regel laadt de ApplicationStorage-module, de rest van de logica is opgenomen in de gebeurtenishandler. <noindex><a rel=\"nofollow\" href=\"https:\/\/voximplant.com\/docs\/references\/voxengine\/appevents#callalerting\">CallAlerting<\/a><\/noindex>.<\/p>\n<p>Eerst defini\u00ebren we een variabele zodat we de initi\u00eble waarde kunnen vergelijken met de belwaarde. Vervolgens proberen we de waarde van de sleutel totalCalls uit de opslag te halen. Als zo'n sleutel nog niet bestaat, maken we deze aan:<\/p>\n<pre><code class=\"javascript\">try {\n    r = await ApplicationStorage.get('totalCalls');\n    if (r === null) {\n        r = await ApplicationStorage.put('totalCalls', 0);\n    }\n}<\/code><\/pre>\n<p>\nDaarna moeten we de waarde van de sleutel in de opslag verhogen:<\/p>\n<pre><code class=\"javascript\">try {\n        await ApplicationStorage.put('totalCalls', (r.value | 0) + 1);\n    }<\/code><\/pre>\n<p><\/p>\n<blockquote><p>LET OP<\/p>\n<p>Voor elke belofte moet u expliciet omgaan met fouten, zoals weergegeven in de bovenstaande listing \u2013 anders wordt de uitvoering van het script gestopt en ziet u een fout in de logs. Details <noindex><a rel=\"nofollow\" href=\"https:\/\/voximplant.com\/blog\/cloud-side-javascript-promise-handling-update\">here<\/a><\/noindex>.<\/p><\/blockquote>\n<p> Na interactie met de opslag beantwoordt het script een binnenkomende oproep met spraaksynthese en vertelt het u hoeveel keer u eerder heeft gebeld. Na dit bericht be\u00ebindigt het script de sessie.<\/p>\n<p>Nadat u het script heeft opgeslagen, gaat u naar het tabblad 'Routing' van uw applicatie en klikt u op 'Nieuwe regel'. Geef het de naam startCounting, geef het script countingCalls op en laat het patroon op de standaardwaarde (.*).<\/p>\n<p><img decoding=\"async\" alt=\"Key-value opslag, of hoe onze applicaties gebruiksvriendelijker werden\" src=\"\/wp-content\/uploads\/2019\/11\/5f7452211a61dd98ccbdcbfac3f7ccd9.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nTen slotte \u2013 maak een gebruiker aan. Ga naar 'Gebruikers', klik op 'Gebruiker aanmaken', geef een naam op (bijvoorbeeld user1) en een wachtwoord, en klik vervolgens op 'Aanmaken'. Dit paar gebruikersnaam-wachtwoord hebben we nodig voor authenticatie in de webtelefoon.<\/p>\n<h2>Controleer<\/h2>\n<p>\nOpen de webtelefoon via de link <noindex><a rel=\"nofollow\" href=\"https:\/\/phone.voximplant.com\/\">phone.voximplant.com<\/a><\/noindex> en log in met de accountnaam, de naam van de applicatie en het paar gebruikersnaam-wachtwoord van de gebruiker uit de applicatie. Na succesvolle aanmelding typt u een willekeurige reeks tekens in het invoerveld en drukt u op Call. Als alles goed is gedaan, hoort u de gesynthetiseerde begroeting!<\/p>\n<p>We wensen u veel plezier met de ontwikkeling op Voximplant en blijf op de hoogte van het nieuws \u2013 er komt nog veel meer! \ud83d\ude09<br \/>\n<br \/>Bron: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/Voximplant\/blog\/476452\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0422\u043e\u0442, \u043a\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 Voximplant, \u0437\u043d\u0430\u0435\u0442 \u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 \u00ab\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0442 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0432\u043e\u043d\u043a\u043e\u0432. \u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2013 \u044d\u0442\u043e \u043a\u0440\u0430\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u043c\u0435\u043d\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 \u043d\u0430\u0448\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435, \u0432\u0445\u043e\u0434\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432 \u043b\u044e\u0431\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Voximplant, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0441\u0435 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f. \u0420\u0430\u043d\u044c\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u00ab\u043d\u0435 \u043f\u043e\u043c\u043d\u0438\u043b\u0438\u00bb [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-53015","post","type-post","status-publish","format-standard","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/nl\/blog\/administrirovanie\/hranilishhe-key-value-ili-kak-nashi-prilozheniya-stali-udobnee\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"nl_NL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 key-value, \u0438\u043b\u0438 \u043a\u0430\u043a \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043b\u0438 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 | ProHoster\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/nl\/blog\/administrirovanie\/hranilishhe-key-value-ili-kak-nashi-prilozheniya-stali-udobnee\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-11-20T21:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-02-18T11:00:51+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Key-value opslag, of hoe onze applicaties handiger zijn geworden | ProHoster","description":"","canonical_url":"https:\/\/prohoster.info\/nl\/blog\/administrirovanie\/hranilishhe-key-value-ili-kak-nashi-prilozheniya-stali-udobnee","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"nl_NL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 key-value, \u0438\u043b\u0438 \u043a\u0430\u043a \u043d\u0430\u0448\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043b\u0438 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 | ProHoster","og:url":"https:\/\/prohoster.info\/nl\/blog\/administrirovanie\/hranilishhe-key-value-ili-kak-nashi-prilozheniya-stali-udobnee","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-11-20T21:00:00+00:00","article:modified_time":"2020-02-18T11:00:51+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"53015","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-24 05:45:21","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 20:32:32","updated":"2026-01-24 05:45:21","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/posts\/53015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/comments?post=53015"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/posts\/53015\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/media?parent=53015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/categories?post=53015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/tags?post=53015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}