Skip to content

Instantly share code, notes, and snippets.

@dozzman
Created January 23, 2015 16:12
Show Gist options
  • Save dozzman/4fd1d10effc1ee65db56 to your computer and use it in GitHub Desktop.
Save dozzman/4fd1d10effc1ee65db56 to your computer and use it in GitHub Desktop.
Working Nexmo Number Callback Change
using System;
using System.Net;
public class HelloWorld
{
static public void Main ()
{
string api_key = "xxxxx";
string api_secret = "xxxxx";
string country = "xx";
string nexmo_number = "xxxxxxxxx";
string callback_number = "xxxxxxxxxxx";
Console.WriteLine("Attempting to change callback for number " + nexmo_number + " using..." );
Console.WriteLine();
Console.WriteLine("api_key = " + api_key);
Console.WriteLine("api_secret = " + api_secret);
Console.WriteLine("country = " + country);
Console.WriteLine("callback_number = " + callback_number);
Console.WriteLine();
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(
"http://rest.nexmo.com/number/update/" + api_key
+ "/" + api_secret + "/" + country + "/" + nexmo_number
+ "?voiceCallbackType=tel&voiceCallbackValue=" + callback_number );
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
Console.WriteLine("Status " + httpResponse.StatusCode );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment