0

In the all samples I see usage of Twilio VIdeo only on node.js as a web server.

Is it possible to run it on IIS and the both, server and client part written on C#?

Igor
  • 281
  • 4
  • 12

1 Answers1

1

Twilio evangelist here.

This page has code for generating Access Tokens in C#:

using System;
using Twilio.Jwt.AccessToken;

class Example
{
  static void Main(string[] args)
  {
    // Substitute your Twilio AccountSid and ApiKey details
    var AccountSid = "accountSid";
    var ApiKeySid = "apiKeySid;
    var ApiKeySecret = "apiKeySecret";

    var identity = "example-user";

    // Create a video grant for the token
    var grant = new VideoGrant();
    grant.Room = "cool room";
    var grants = new HashSet { grant };

    // Create an Access Token generator
    var token = new Token(accountSid, apiKey, apiSecret, identity: identity, grants: grants);

    // Serialize the token as a JWT
    Console.WriteLine(token.ToJwt());
  }
}

There is also a Github repo with a full token server sample in C#.

Hope that helps.

Devin Rader
  • 10,260
  • 1
  • 20
  • 32
  • Thank you Devin. I am just starting to develop POC for my company and trying to understand how can I run Twilio video with IIS and C#. So I have to deploy a server with the code you noted and then? Do you have also a client sample for C# and ASP.NET? – Igor May 11 '18 at 17:43
  • You can use a Twilio Function if you don't want to stand up your own server or deploy to one that can publicly expose the URL. Functions like you write and host Javascripton Twilio servers and expose that code via a URL: https://www.twilio.com/console/runtime/functions You could also use ngrok (www.ngrok.com) to expose a route running on your local IISExpress instance if you just want to test the code. – Devin Rader May 14 '18 at 21:01