From adedaefd5d3357ce9c93279f46ed52f5827d90c8 Mon Sep 17 00:00:00 2001 From: Carlos Villavicencio Date: Wed, 22 Apr 2020 16:28:43 -0500 Subject: [PATCH 1/4] Code Exchange Upgrade --- .mergify.yml | 13 ++ CODE_OF_CONDUCT.md | 73 +++++++++ CONTRIBUTING.md | 3 + ClientQuickstart/ClientQuickstart.csproj | 49 +++--- .../Controllers/TokenController.cs | 35 ++-- .../Controllers/VoiceController.cs | 2 +- ClientQuickstart/Local.config.example | 7 + ClientQuickstart/Scripts/quickstart.js | 151 +++++++++++------- ClientQuickstart/Views/Shared/_Layout.cshtml | 4 +- ClientQuickstart/Web.config | 17 +- ClientQuickstart/packages.config | 21 +-- LICENSE | 21 +++ README.md | 38 ++--- 13 files changed, 305 insertions(+), 129 deletions(-) create mode 100644 .mergify.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 ClientQuickstart/Local.config.example diff --git a/.mergify.yml b/.mergify.yml new file mode 100644 index 0000000..0433495 --- /dev/null +++ b/.mergify.yml @@ -0,0 +1,13 @@ +pull_request_rules: + - name: automatic merge for Dependabot pull requests + conditions: + - author=dependabot-preview[bot] + - status-success=build (macos-latest, 10) + - status-success=build (macos-latest, 12) + - status-success=build (windows-latest, 10) + - status-success=build (windows-latest, 12) + - status-success=build (ubuntu-latest, 10) + - status-success=build (ubuntu-latest, 12) + actions: + merge: + method: squash diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..2f0727e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,73 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at open-source@twilio.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ad3257e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing to Twilio + +All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under. diff --git a/ClientQuickstart/ClientQuickstart.csproj b/ClientQuickstart/ClientQuickstart.csproj index ee2fb66..c7d6ad1 100644 --- a/ClientQuickstart/ClientQuickstart.csproj +++ b/ClientQuickstart/ClientQuickstart.csproj @@ -1,6 +1,5 @@  - @@ -15,7 +14,7 @@ Properties ClientQuickstart ClientQuickstart - v4.5.2 + v4.7.2 false true @@ -26,6 +25,7 @@ + true @@ -49,44 +49,45 @@ ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll True - - ..\packages\Faker.Net.1.1.1\lib\net452\Faker.NET45.dll + + ..\packages\Faker.Net.1.3.77\lib\net472\Faker.Net.4.7.dll - - ..\packages\JWT.1.3.4\lib\3.5\JWT.dll + + ..\packages\JWT.6.1.4\lib\net472\JWT.dll ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll - - ..\packages\Microsoft.IdentityModel.JsonWebTokens.5.6.0\lib\net451\Microsoft.IdentityModel.JsonWebTokens.dll + + ..\packages\Microsoft.IdentityModel.JsonWebTokens.6.5.0\lib\net461\Microsoft.IdentityModel.JsonWebTokens.dll - - ..\packages\Microsoft.IdentityModel.Logging.5.6.0\lib\net451\Microsoft.IdentityModel.Logging.dll + + ..\packages\Microsoft.IdentityModel.Logging.6.5.0\lib\net461\Microsoft.IdentityModel.Logging.dll - - ..\packages\Microsoft.IdentityModel.Tokens.5.6.0\lib\net451\Microsoft.IdentityModel.Tokens.dll + + ..\packages\Microsoft.IdentityModel.Tokens.6.5.0\lib\net461\Microsoft.IdentityModel.Tokens.dll - ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll - - ..\packages\RestSharp.106.6.10\lib\net452\RestSharp.dll + + ..\packages\RestSharp.106.10.1\lib\net452\RestSharp.dll - - ..\packages\System.IdentityModel.Tokens.Jwt.5.6.0\lib\net451\System.IdentityModel.Tokens.Jwt.dll + + ..\packages\System.IdentityModel.Tokens.Jwt.6.5.0\lib\net461\System.IdentityModel.Tokens.Jwt.dll + + + - - ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll @@ -105,9 +106,7 @@ ..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll - - @@ -125,8 +124,9 @@ ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll - - ..\packages\Twilio.5.35.0\lib\net451\Twilio.dll + + + ..\packages\Twilio.5.39.1\lib\net451\Twilio.dll ..\packages\WebGrease.1.6.0\lib\WebGrease.dll @@ -214,8 +214,9 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + + + - + @@ -52,11 +59,11 @@ - + - + @@ -66,4 +73,4 @@ - + \ No newline at end of file diff --git a/ClientQuickstart/packages.config b/ClientQuickstart/packages.config index c8fbf0b..996a794 100644 --- a/ClientQuickstart/packages.config +++ b/ClientQuickstart/packages.config @@ -1,21 +1,22 @@  - - + + - - - - + + + + - - - - + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE index e69de29..2c3cf9d 100644 --- a/LICENSE +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Twilio Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 254d23b..540c4d7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ + + Twilio + + # Twilio Client Quickstart for C# (ASP.NET MVC) > We are currently in the process of updating this sample template. If you are encountering any issues with the sample, please open an issue at [github.com/twilio-labs/code-exchange/issues](https://github.com/twilio-labs/code-exchange/issues) and we'll try to help you. @@ -6,29 +10,21 @@ This application should give you a ready-made starting point for writing your own voice apps with Twilio Client. Before we begin, we need to collect all the config values we need to run the application: -| Config Value | Description | +| Config Value | Description | | :------------- |:------------- | -Account SID | Your primary Twilio account identifier - find this [in the console here](https://www.twilio.com/console). -Auth Token | Used to authenticate - [just like the above, you'll find this here](https://www.twilio.com/console). -TwiML App SID | The TwiML application with a voice URL configured to access your server running this app - create one [in the console here](https://www.twilio.com//console/phone-numbers/dev-tools/twiml-apps). Also, you will need to configure the Voice "REQUEST URL" on the TwiML app once you've got your server up and running. -Twilio Phone # | A Twilio phone number in [E.164 format](https://en.wikipedia.org/wiki/E.164) - you can [get one here](https://www.twilio.com/console/phone-numbers/incoming) +`TwilioAccountSid` | Your primary Twilio account identifier - find this [in the console here](https://www.twilio.com/console). +`TwilioTwimlAppSid` | The TwiML application with a voice URL configured to access your server running this app - create one [in the console here](https://www.twilio.com/console/voice/twiml/apps). Also, you will need to configure the Voice "REQUEST URL" on the TwiML app once you've got your server up and running. +`TwilioCallerId` | A Twilio phone number in [E.164 format](https://en.wikipedia.org/wiki/E.164) - you can [get one here](https://www.twilio.com/console/phone-numbers/incoming) +`TwilioApiKey` / `TwilioApiSecret` | Your REST API Key information needed to create an [Access Token](https://www.twilio.com/docs/iam/access-tokens) - create [one here](https://www.twilio.com/console/project/api-keys). ## Setting Up The Application -1. After downloading or cloning this application, create a new file in `ClientQuickstart` -(at the same level as `ClientQuickstart\Web.config`) called `Local.config`. +1. After downloading or cloning this application, In the `ClientQuickstart` +directory (at the same level as `ClientQuickstart\Web.config`) duplicate the file +called `Local.config.example` and rename it as `Local.config`. 2. Next, open up `ClientQuickstart.sln` in Visual Studio. Edit `Local.config` -with the four values we obtained above: - - ```xml - - - - - - - ``` +with the five values we obtained above. 3. Hit `F5` or the Play button, and you should land on the home page of our basic voice application. The URL in your browser should be `localhost:XXXX`, @@ -62,6 +58,10 @@ We'd recommend Google Chrome or Mozilla Firefox instead. ![screenshot of phone app](https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/TwilioClientQuickstart.original.png) -## License +## Meta + +* No warranty expressed or implied. Software is as is. Diggity. +* The CodeExchange repository can be found [here](https://github.com/twilio-labs/code-exchange/). +* [MIT License](http://www.opensource.org/licenses/mit-license.html) +* Lovingly crafted by Twilio Developer Education. -MIT From 831923ab5c4b6e5450737f682cbe1822164edb0a Mon Sep 17 00:00:00 2001 From: Carlos Villavicencio Date: Fri, 24 Apr 2020 15:57:36 -0500 Subject: [PATCH 2/4] Add Github actions --- .github/workflows/NetFx.yml | 30 ++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/NetFx.yml diff --git a/.github/workflows/NetFx.yml b/.github/workflows/NetFx.yml new file mode 100644 index 0000000..90e7459 --- /dev/null +++ b/.github/workflows/NetFx.yml @@ -0,0 +1,30 @@ +name: NetFx + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + name: Checkout Code + + - name: Setup MSBuild Path + uses: microsoft/setup-msbuild@v1 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.0.2 + + - name: Restore NuGet Packages + run: nuget restore ClientQuickstart.sln + + - name: Set up local configuration + run: copy ClientQuickstart\Local.config.example ClientQuickstart\Local.config + + - name: Build Web App + run: msbuild ClientQuickstart.sln /p:Configuration=Release diff --git a/README.md b/README.md index 540c4d7..e073681 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Twilio +![](https://github.com/TwilioDevEd/client-quickstart-csharp/workflows/NetFx/badge.svg) + # Twilio Client Quickstart for C# (ASP.NET MVC) > We are currently in the process of updating this sample template. If you are encountering any issues with the sample, please open an issue at [github.com/twilio-labs/code-exchange/issues](https://github.com/twilio-labs/code-exchange/issues) and we'll try to help you. From e0a72a18ccaaae2992350dfe87b8c058bf1dadb3 Mon Sep 17 00:00:00 2001 From: Carlos Villavicencio Date: Tue, 19 May 2020 10:33:08 -0500 Subject: [PATCH 3/4] Update readme template --- .github/workflows/NetFx.yml | 4 +- README.md | 109 +++++++++++++++++++++++++----------- 2 files changed, 78 insertions(+), 35 deletions(-) diff --git a/.github/workflows/NetFx.yml b/.github/workflows/NetFx.yml index 90e7459..b505f92 100644 --- a/.github/workflows/NetFx.yml +++ b/.github/workflows/NetFx.yml @@ -2,9 +2,9 @@ name: NetFx on: push: - branches: [ master ] + branches: [ master, next ] pull_request: - branches: [ master ] + branches: [ master, next ] jobs: build: diff --git a/README.md b/README.md index e073681..681c207 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,84 @@ - - Twilio + +Twilio -![](https://github.com/TwilioDevEd/client-quickstart-csharp/workflows/NetFx/badge.svg) - # Twilio Client Quickstart for C# (ASP.NET MVC) +![](https://github.com/TwilioDevEd/client-quickstart-csharp/workflows/NetFx/badge.svg) + > We are currently in the process of updating this sample template. If you are encountering any issues with the sample, please open an issue at [github.com/twilio-labs/code-exchange/issues](https://github.com/twilio-labs/code-exchange/issues) and we'll try to help you. +## About + +Implementations in other languages: + +| Ruby | Java | Python | PHP | Node | +| :--- | :--- | :----- | :-- | :--- | +| [Done](https://github.com/TwilioDevEd/client-quickstart-ruby) | [Done](https://github.com/TwilioDevEd/client-quickstart-java) | [Done](https://github.com/TwilioDevEd/client-quickstart-python) | [Done](https://github.com/TwilioDevEd/client-quickstart-php) | [Done](https://github.com/TwilioDevEd/client-quickstart-node) | + + + +## Set up + +### Requirements + +- [.NET Framework](https://dotnet.microsoft.com/download/dotnet-framework/net472) +- A Twilio account - [sign up](https://www.twilio.com/try-twilio) +- [ngrok](https://ngrok.com) + +### Twilio Account Settings + This application should give you a ready-made starting point for writing your -own voice apps with Twilio Client. Before we begin, we need to collect +own application. Before we begin, we need to collect all the config values we need to run the application: -| Config Value | Description | -| :------------- |:------------- | +| Config Value | Description | +| :---------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------- | `TwilioAccountSid` | Your primary Twilio account identifier - find this [in the console here](https://www.twilio.com/console). `TwilioTwimlAppSid` | The TwiML application with a voice URL configured to access your server running this app - create one [in the console here](https://www.twilio.com/console/voice/twiml/apps). Also, you will need to configure the Voice "REQUEST URL" on the TwiML app once you've got your server up and running. `TwilioCallerId` | A Twilio phone number in [E.164 format](https://en.wikipedia.org/wiki/E.164) - you can [get one here](https://www.twilio.com/console/phone-numbers/incoming) `TwilioApiKey` / `TwilioApiSecret` | Your REST API Key information needed to create an [Access Token](https://www.twilio.com/docs/iam/access-tokens) - create [one here](https://www.twilio.com/console/project/api-keys). -## Setting Up The Application +### Local development -1. After downloading or cloning this application, In the `ClientQuickstart` -directory (at the same level as `ClientQuickstart\Web.config`) duplicate the file -called `Local.config.example` and rename it as `Local.config`. +After the above requirements have been met: -2. Next, open up `ClientQuickstart.sln` in Visual Studio. Edit `Local.config` -with the five values we obtained above. +1. Clone this repository and `cd` into it -3. Hit `F5` or the Play button, and you should land on the home page of our -basic voice application. The URL in your browser should be `localhost:XXXX`, -where `XXXX` is the port number of your app. Take note of this port number. +```bash +git clone git@github.com:TwilioDevEd/client-quickstart-csharp.git +cd client-quickstart-csharp +``` -4. [Download and install ngrok](https://ngrok.com/download) +2. Set your configuration variables -> [Learn 6 awesome reasons why to use ngrok](https://www.twilio.com/blog/2015/09/6-awesome-reasons-to-use-ngrok-when-testing-webhooks.html). +```bash +copy ClientQuickstart/Local.config.example ClientQuickstart/Local.config +``` -5. Run ngrok, replacing the two occurrences of `XXXX` in the following -command with the port number of your app: +See [Twilio Account Settings](#twilio-account-settings) to locate the necessary environment variables. - ```bash - ngrok http -host-header="localhost:XXXX" XXXX - ``` +3. Build the solution -6. When ngrok starts up, it will assign a unique URL to your tunnel. -It might be something like `https://asdf456.ngrok.io`. Take note of this. +4. Run the application -7. [Configure your TwiML app](https://www.twilio.com/console/voice/twiml/apps)'s -Voice "REQUEST URL" to be your ngrok URL plus `/voice`. For example: +5. Run ngrok (or use the [ngrok Visual Studio extension](https://marketplace.visualstudio.com/items?itemName=DavidProthero.NgrokExtensions)), replacing the two occurrences of `XXXX` in the following command with the port number of your app: - ![screenshot of twiml app](https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/TwilioClientRequestUrl.original.png) +```bash +ngrok http -host-header="localhost:XXXX" XXXX +``` + +> [Learn 6 awesome reasons why to use ngrok](https://www.twilio.com/blog/2015/09/6-awesome-reasons-to-use-ngrok-when-testing-webhooks.html). + +6. When ngrok starts up, it will assign a unique URL to your tunnel. It might be something like `https://asdf456.ngrok.io`. Take note of this. + +7. [Configure your TwiML app](https://www.twilio.com/console/voice/twiml/apps)'s Voice "REQUEST URL" to be your ngrok URL plus `/voice`. For example: + + ![screenshot of twiml app](https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/TwilioClientRequestUrl.original.png) > **Note:** You must set your webhook urls to the `https` ngrok tunnel created. @@ -60,10 +89,24 @@ We'd recommend Google Chrome or Mozilla Firefox instead. ![screenshot of phone app](https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/TwilioClientQuickstart.original.png) -## Meta +That's it! + +## Resources + +- The CodeExchange repository can be found [here](https://github.com/twilio-labs/code-exchange/). + +## Contributing + +This template is open source and welcomes contributions. All contributions are subject to our [Code of Conduct](https://github.com/twilio-labs/.github/blob/master/CODE_OF_CONDUCT.md). + +[Visit the project on GitHub](https://github.com/twilio-labs/sample-template-dotnet) + +## License + +[MIT](http://www.opensource.org/licenses/mit-license.html) + +## Disclaimer -* No warranty expressed or implied. Software is as is. Diggity. -* The CodeExchange repository can be found [here](https://github.com/twilio-labs/code-exchange/). -* [MIT License](http://www.opensource.org/licenses/mit-license.html) -* Lovingly crafted by Twilio Developer Education. +No warranty expressed or implied. Software is as is. +[twilio]: https://www.twilio.com From 55945d7be5f469757704800745a4e2161832aa7b Mon Sep 17 00:00:00 2001 From: Carlos Villavicencio Date: Thu, 25 Jun 2020 15:08:17 -0500 Subject: [PATCH 4/4] Update .mergify.yml --- .mergify.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.mergify.yml b/.mergify.yml index 0433495..07e551b 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -2,12 +2,7 @@ pull_request_rules: - name: automatic merge for Dependabot pull requests conditions: - author=dependabot-preview[bot] - - status-success=build (macos-latest, 10) - - status-success=build (macos-latest, 12) - - status-success=build (windows-latest, 10) - - status-success=build (windows-latest, 12) - - status-success=build (ubuntu-latest, 10) - - status-success=build (ubuntu-latest, 12) + - status-success=build actions: merge: method: squash