totalvoice csharp
Versão 1.2.1
Cliente C# para la API de TotalVoice
Funcionalidad
Requisitos previos
Usar
Para usar esta biblioteca, primero debe registrarse en el sitio web de Total Voice. Después de la creación del registro, estará disponible un accessostoken para acceder a la API.
Con AccessSstoken en la mano, será posible hacer las consultas/registros de acuerdo con la documentación de la API
Instalación con Nuget Package Manager
PM> Install-Package TotalVoice -Version 1.0.1
o .net cli
dotnet add package TotalVoice --version 1.0.1
Aquí hay algunos ejemplos de cómo se puede usar esta biblioteca.
Haga una llamada telefónica entre dos números: A y B
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Chamada chamada = new Chamada ( client ) ;
var json = new {
numero_origem = "48988888888" ,
numero_destino = "48999999999"
} ;
string response = chamada . Ligar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Consulta de llamadas por identificación
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Chamada chamada = new Chamada ( client ) ;
string response = chamada . Buscar ( 123 ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Enviar un SMS
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Sms sms = new Sms ( client ) ;
var json = new {
numero_destino = "48999999999" ,
mensagem = "Mensagem de teste"
} ;
string response = sms . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Busque los datos de un SMS por ID
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Sms sms = new Sms ( client ) ;
string response = sms . Buscar ( 123 ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Envía un TTS
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Tts tts = new Tts ( client ) ;
var json = new {
numero_destino = "48999999999" ,
mensagem = "Mensagem de TTS"
} ;
string response = tts . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Validación de números
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
ValidaNumero validacao = new ValidaNumero ( client ) ;
var json = new {
numero_destino = "48999999999" ,
gravar_audio = true ,
bina = "48808880804" ,
max_tentativas = 1
} ;
string response = validacao . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
} Enviar un compuesto
namespace Teste
{
class Program
{
static void Main ( string [ ] args )
{
TotalVoiceClient client = new TotalVoiceClient ( "access-token" ) ;
Composto composto = new Composto ( client ) ;
var json = new {
numero_destino = "48988888888" ,
dados = new [ ] {
new {
acao = "tts" ,
acao_dados = new {
mensagem = "O número digitado não consta em nosso cadastro. Por gentileza, tente novamente" ,
tipo_voz = "br-Ricardo"
}
} ,
new {
acao = "audio" ,
acao_dados = new {
url_audio = "https://minhaurl.com.br/audio.mp3"
}
}
} ,
gravar_audio = false ,
bina = "48988888888" ,
tags = "clienteX" ,
detecta_caixa = false
} ;
string response = composto . Enviar ( json ) ;
System . Diagnostics . Debug . WriteLine ( response ) ;
}
}
}Licencia
Esta biblioteca sigue los términos de uso del MIT