From 38fe86a33372842526f457bb6f0fc3b5fb202de3 Mon Sep 17 00:00:00 2001 From: vdlima <67575271+vdlima@users.noreply.github.com> Date: Wed, 30 Oct 2024 09:07:59 -0700 Subject: [PATCH] Create ES agent in global region (#273) --- ...L_commands_with_SIP_TRUNK_management.ipynb | 340 +++++++++--------- 1 file changed, 170 insertions(+), 170 deletions(-) diff --git a/tools/SIP_SIPREC_integration_Dialogflow_CURL_commands_with_SIP_TRUNK_management.ipynb b/tools/SIP_SIPREC_integration_Dialogflow_CURL_commands_with_SIP_TRUNK_management.ipynb index ce07ddcb..d3333e04 100644 --- a/tools/SIP_SIPREC_integration_Dialogflow_CURL_commands_with_SIP_TRUNK_management.ipynb +++ b/tools/SIP_SIPREC_integration_Dialogflow_CURL_commands_with_SIP_TRUNK_management.ipynb @@ -1,27 +1,10 @@ { - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [], - "name": "SIP_SIPREC_integration_Dialogflow_CURL_commands_with_SIP_TRUNK_management.ipynb", - "collapsed_sections": [ - "o5wTWF_HowQf", - "ZVWKweSromS1", - "TYmxJhBo2RDm" - ] - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, "cells": [ { "cell_type": "markdown", + "metadata": { + "id": "A-itjGDAUFy9" + }, "source": [ "# README\n", "\n", @@ -42,22 +25,34 @@ "4. Utility functions :\n", " - Get and List methods to view resources created.\n", " - Delete method to delete resources created." - ], - "metadata": { - "id": "A-itjGDAUFy9" - } + ] }, { "cell_type": "markdown", - "source": [ - "# Project setup" - ], "metadata": { "id": "nSAtlvmuagBQ" - } + }, + "source": [ + "# Project setup" + ] }, { "cell_type": "code", + "execution_count": 1, + "metadata": { + "executionInfo": { + "elapsed": 3008, + "status": "ok", + "timestamp": 1728504494188, + "user": { + "displayName": "", + "userId": "" + }, + "user_tz": 420 + }, + "id": "BDe-MhXg2U7C" + }, + "outputs": [], "source": [ "import json\n", "import os\n", @@ -83,34 +78,25 @@ " LOCATION_ID = \"\"\n", "else:\n", " LOCATION_ID = REGION + \"-\"" - ], - "metadata": { - "id": "BDe-MhXg2U7C", - "executionInfo": { - "status": "ok", - "timestamp": 1728504494188, - "user_tz": 420, - "elapsed": 3008, - "user": { - "displayName": "", - "userId": "" - } - } - }, - "execution_count": 1, - "outputs": [] + ] }, { "cell_type": "markdown", - "source": [ - "# Configuring CCAI for SIP/SIPREC" - ], "metadata": { "id": "o5wTWF_HowQf" - } + }, + "source": [ + "# Configuring CCAI for SIP/SIPREC" + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "UmNL7NISdGgp" + }, + "outputs": [], "source": [ "# @title Create a dummy Dialogflow ES agent and set the tier to Enterprise in order to remove the Trial quota limits and permit making additional quota requests\n", "\n", @@ -124,7 +110,7 @@ " \"timeZone\": \"America/Los_Angeles\",\n", " \"tier\": \"TIER_ENTERPRISE\"\n", " }}' \\\n", - "https://{LOCATION_ID}dialogflow.googleapis.com/v2beta1/projects/{PROJECT_ID}/locations/{REGION}/agent\n", + "https://dialogflow.googleapis.com/v2beta1/projects/{PROJECT_ID}/locations/global/agent\n", "\"\"\"\n", "\n", "request = os.popen(create_dummy_agent).read()\n", @@ -134,16 +120,16 @@ " print(response)\n", "else:\n", " print(request)" - ], - "metadata": { - "id": "UmNL7NISdGgp", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "s2lzeQoq3i3X" + }, + "outputs": [], "source": [ "# @title Script to create a ConversationProfile with GTP integration and export to Insights enabled\n", "\n", @@ -279,25 +265,24 @@ " print(response)\n", "\n", "print(\"\\nDone!\")" - ], - "metadata": { - "id": "s2lzeQoq3i3X", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "markdown", - "source": [ - "# SIP Trunk Creation" - ], "metadata": { "id": "ZVWKweSromS1" - } + }, + "source": [ + "# SIP Trunk Creation" + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "bDz5RHChPzKK" + }, + "outputs": [], "source": [ "# @title CreateSipTrunk\n", "\n", @@ -327,24 +312,25 @@ " print(response)\n", "else:\n", " print(request)" - ], - "metadata": { - "id": "bDz5RHChPzKK" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "markdown", - "source": [ - "# Utility functions (List/Get/Delete methods for resources created)" - ], "metadata": { "id": "TYmxJhBo2RDm" - } + }, + "source": [ + "# Utility functions (List/Get/Delete methods for resources created)" + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "1xPq_CC72bPq" + }, + "outputs": [], "source": [ "# @title View ConversationProfile and PhoneNumber details\n", "\n", @@ -410,16 +396,16 @@ " print(\"\\n\")\n", " else:\n", " print(\"No phone numbers present\")" - ], - "metadata": { - "id": "1xPq_CC72bPq", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "eLSdPEMWcGhf" + }, + "outputs": [], "source": [ "# @title GetConversation\n", "\n", @@ -439,16 +425,16 @@ " print(response)\n", "else:\n", " print(request)" - ], - "metadata": { - "id": "eLSdPEMWcGhf", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "W-wa4CZGwVJL" + }, + "outputs": [], "source": [ "# @title ListSecuritySettings\n", "\n", @@ -466,16 +452,16 @@ " print(response)\n", "else:\n", " print(request)" - ], - "metadata": { - "id": "W-wa4CZGwVJL", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "s7MfoE_IRyce" + }, + "outputs": [], "source": [ "# @title ListConversationProfiles\n", "\n", @@ -493,16 +479,16 @@ " print(response)\n", "else:\n", " print(request)" - ], - "metadata": { - "id": "s7MfoE_IRyce", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "jcL-Vtz5evzX" + }, + "outputs": [], "source": [ "# @title ListPhoneNumbers\n", "\n", @@ -520,16 +506,25 @@ " print(response)\n", "else:\n", " print(request)" - ], - "metadata": { - "id": "jcL-Vtz5evzX", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": 15, + "metadata": { + "executionInfo": { + "elapsed": 10, + "status": "ok", + "timestamp": 1728507630448, + "user": { + "displayName": "", + "userId": "" + }, + "user_tz": 420 + }, + "id": "y6UmqCDL6UB_" + }, + "outputs": [], "source": [ "# @title Delete resource objects\n", "\n", @@ -570,25 +565,16 @@ " \"\"\"\n", " response = json.loads(os.popen(curl).read())\n", " print(response)" - ], - "metadata": { - "id": "y6UmqCDL6UB_", - "executionInfo": { - "status": "ok", - "timestamp": 1728507630448, - "user_tz": 420, - "elapsed": 10, - "user": { - "displayName": "", - "userId": "" - } - } - }, - "execution_count": 15, - "outputs": [] + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "wreAsBY3L3Lk" + }, + "outputs": [], "source": [ "# @title ListSipTrunks\n", "\n", @@ -606,68 +592,68 @@ " print(response)\n", "else:\n", " print(request)" - ], - "metadata": { - "id": "wreAsBY3L3Lk", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "code", - "source": [ - "# @title GetSipTrunk\n", - "\n", - "RESOURCE_NAME = \"projects//locations//sipTrunks/\" # @param {type:\"string\"}\n", - "# eg. value projects/project_name/locations/global/sipTrunks/JxN1ndLCR9OJvgrDlc32_Q\n", - "\n", - "curl = f\"\"\"\n", - "curl -X GET \\\n", - "-H \"Authorization: Bearer {JWT}\" \\\n", - "-H \"X-Goog-User-Project: {PROJECT_ID}\" \\\n", - "-H \"Content-Type: application/json; charset=utf-8\" \\\n", - "https://{LOCATION_ID}dialogflow.googleapis.com/v2beta1/{RESOURCE_NAME}\n", - "\"\"\"\n", - "\n", - "request = os.popen(curl).read()\n", - "if isinstance(request, dict):\n", - " response = json.loads(request)\n", - " print(response)\n", - "else:\n", - " print(request)" - ], + "execution_count": 17, "metadata": { - "id": "L9ixrCWimlqB", "cellView": "form", "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { + "elapsed": 6, "status": "ok", "timestamp": 1728507630448, - "user_tz": 420, - "elapsed": 6, "user": { "displayName": "", "userId": "" - } + }, + "user_tz": 420 }, + "id": "L9ixrCWimlqB", "outputId": "7a0ae3ea-61e7-4068-fe84-b4f8724c1cff" }, - "execution_count": 17, "outputs": [ { - "output_type": "stream", "name": "stdout", + "output_type": "stream", "text": [ "\n" ] } + ], + "source": [ + "# @title GetSipTrunk\n", + "\n", + "RESOURCE_NAME = \"projects//locations//sipTrunks/\" # @param {type:\"string\"}\n", + "# eg. value projects/project_name/locations/global/sipTrunks/JxN1ndLCR9OJvgrDlc32_Q\n", + "\n", + "curl = f\"\"\"\n", + "curl -X GET \\\n", + "-H \"Authorization: Bearer {JWT}\" \\\n", + "-H \"X-Goog-User-Project: {PROJECT_ID}\" \\\n", + "-H \"Content-Type: application/json; charset=utf-8\" \\\n", + "https://{LOCATION_ID}dialogflow.googleapis.com/v2beta1/{RESOURCE_NAME}\n", + "\"\"\"\n", + "\n", + "request = os.popen(curl).read()\n", + "if isinstance(request, dict):\n", + " response = json.loads(request)\n", + " print(response)\n", + "else:\n", + " print(request)" ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "id": "-a-pAFZEQ6Jl" + }, + "outputs": [], "source": [ "# @title DeleteSipTrunk\n", "\n", @@ -689,13 +675,27 @@ " print(response)\n", "else:\n", " print(request)" + ] + } + ], + "metadata": { + "colab": { + "collapsed_sections": [ + "o5wTWF_HowQf", + "ZVWKweSromS1", + "TYmxJhBo2RDm" ], - "metadata": { - "id": "-a-pAFZEQ6Jl", - "cellView": "form" - }, - "execution_count": null, - "outputs": [] + "name": "SIP_SIPREC_integration_Dialogflow_CURL_commands_with_SIP_TRUNK_management.ipynb", + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python" } - ] -} \ No newline at end of file + }, + "nbformat": 4, + "nbformat_minor": 0 +}