diff --git a/.github/workflows/NetFx.yml b/.github/workflows/NetFx.yml new file mode 100644 index 0000000..b505f92 --- /dev/null +++ b/.github/workflows/NetFx.yml @@ -0,0 +1,30 @@ +name: NetFx + +on: + push: + branches: [ master, next ] + pull_request: + branches: [ master, next ] + +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/.mergify.yml b/.mergify.yml new file mode 100644 index 0000000..07e551b --- /dev/null +++ b/.mergify.yml @@ -0,0 +1,8 @@ +pull_request_rules: + - name: automatic merge for Dependabot pull requests + conditions: + - author=dependabot-preview[bot] + - status-success=build + 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..681c207 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,84 @@ + +Twilio + + # 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 | -| :------------- |:------------- | -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) +| 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, create a new file in `ClientQuickstart` -(at the same level as `ClientQuickstart\Web.config`) called `Local.config`. +After the above requirements have been met: -2. Next, open up `ClientQuickstart.sln` in Visual Studio. Edit `Local.config` -with the four values we obtained above: +1. Clone this repository and `cd` into it - ```xml - - - - - - - ``` +```bash +git clone git@github.com:TwilioDevEd/client-quickstart-csharp.git +cd client-quickstart-csharp +``` -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. +2. Set your configuration variables -4. [Download and install ngrok](https://ngrok.com/download) +```bash +copy ClientQuickstart/Local.config.example ClientQuickstart/Local.config +``` -> [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). +See [Twilio Account Settings](#twilio-account-settings) to locate the necessary environment variables. -5. Run ngrok, replacing the two occurrences of `XXXX` in the following -command with the port number of your app: +3. Build the solution - ```bash - ngrok http -host-header="localhost:XXXX" XXXX - ``` +4. Run the application -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. +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: -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: +```bash +ngrok http -host-header="localhost:XXXX" XXXX +``` - ![screenshot of twiml app](https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/TwilioClientRequestUrl.original.png) +> [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. @@ -62,6 +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) +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 +[MIT](http://www.opensource.org/licenses/mit-license.html) + +## Disclaimer + +No warranty expressed or implied. Software is as is. + +[twilio]: https://www.twilio.com