private static Number26 PurchaseDid(FlowrouteNumbersAndMessagingClient client, string did) { NumbersController numbers = client.Numbers; try { Number26 data = numbers.CreatePurchaseAPhoneNumber(did); return(data); } catch (FlowrouteNumbersAndMessaging.Standard.Exceptions.ErrorException e) { Console.WriteLine(e); return(null); } }
private static void Main(string[] args) { // Create Basic Authentication Object - client - from our Configuration Settings FlowrouteNumbersAndMessagingClient client = new FlowrouteNumbersAndMessagingClient(FlowrouteNumbersAndMessaging.Standard.Configuration.BasicAuthUserName, FlowrouteNumbersAndMessaging.Standard.Configuration.BasicAuthPassword); // List all our numbers ArrayList our_numbers = GetNumbers(client); // Find details for a specific number dynamic number_details = GetNumberDetails(client, (string)our_numbers[0]); // Find purchasable numbers ArrayList available_numbers = GetAvailableNumbers(client); // Purchase a DID Number26 did_detail = PurchaseDid(client, (string)available_numbers[0]); // Release a DID if (did_detail != null) { ReleaseDid(client, did_detail.Data.Id); } // List Available Area Codes ArrayList available_areacodes = GetAvailableAreaCodes(client); // List available Exchange Codes ArrayList available_exchange_codes = GetAvailableExchangeCodes(client); // List Inbound Routes ArrayList inbound_routes = GetInboundRoutes(client); // List available Edge Strategies ArrayList edge_strategies = GetEdgeStrategies(client); // Create an Inbound Route CreateInboundRoute(client); // Update Primary Route for a DID string route_id = ""; foreach (JObject item in inbound_routes) { route_id = (string)item.GetValue("id"); break; } UpdatePrimaryRoute(client, (string)our_numbers[0], (string)route_id); // Update the Failover Route for a DID for (int i = 1; i < inbound_routes.Count;) { JObject item = (JObject)inbound_routes[i]; route_id = (string)item.GetValue("id"); break; } UpdateFailoverRoute(client, (string)our_numbers[0], route_id); // Set an Alias for a DID SetDidAlias(client, (string)our_numbers[0], "Our DID"); // Set DID Callback SetDidCallback(client, (string)our_numbers[0], "http://www.example.com/callback"); //-------------------- E911 -------------------------- // List E911 Records ArrayList our_e911s = GetE911Records(client); // Show E911 Details //ListE911Details(client, (string)our_e911s[0]); // Validate an E911 Address ValidateE911(client); // Create an E911 Address CreateE911Address(client); // Update an E911 Address UpdateE911Address(client, (string)our_e911s[0], "New Address"); // Associate an E911 Address with a DID AssociateE911(client, (string)our_numbers[0], (string)our_e911s[0]); // List all DIDs associated with a specific E911 Record ListE911Associations(client, (string)our_e911s[0]); // Unassociate an E911 Address from a DID UnassociateE911(client, (string)our_numbers[0]); // Remove an E911 Record DeleteE911(client, (string)our_e911s[0]); //----------------- Messaging -------------------------- // List all our SMS Messages ArrayList our_messages = GetMessages(client); string target_number = "YOUR MOBILE NUMBER HERE"; // Send an SMS Message from our account SendSMS(client, (string)our_numbers[0], target_number); // Send an MMS Message from our account SendMMS(client, (string)our_numbers[0], target_number); // Look up a specific MDR GetMDRDetail(client, (string)our_messages[0]); // Set Account Level Callback URL for SMS SetAccountLevelCallback(client, "SMS_callback", "http://www.example/com/sms"); // Set Account Level Callback URL for MMS SetAccountLevelCallback(client, "MMS_callback", "http://www.example/com/sms"); // Set Account Level DLR Callback URL SetAccountLevelCallback(client, "DLR_callback", "http://www.example/com/sms"); // Send an SMS Message and specify a custom DLR URL SendSMS(client, (string)our_numbers[0], target_number, "http://httpbin.org/status/:code"); //----------------- CNAM -------------------------- // Get all CNAM Records ArrayList our_cnams = GetCNAMRecords(client); // Get details about a single CNAM Record GetCNAMDetail(client, (string)our_cnams[0]); // Create a CNAM Record CreateCNAM(client, "Flowroute"); // Associate a CNAM Record AssociateCNAM(client, (string)our_numbers[0], (string)our_cnams[0]); // Unassociate a CNAM UnassociateCNAM(client, (string)our_numbers[0]); // Delete a CNAM record DeleteCNAM(client, (string)our_cnams[0]); //----------------- Portability ----------------------- // Check number portability List <string> numbers_to_check = new List <string>(); numbers_to_check.Add("+14254664444"); numbers_to_check.Add("+18827833439"); var result = CheckPortability(client, numbers_to_check); }