from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Add the 92.255.220.0/24 network to the white list. AUTHORIZED_IP = "92.255.220.0/24" try: res = voxapi.add_authorized_account_ip(AUTHORIZED_IP) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Change the queue name. ACD_QUEUE_ID = 1 NEW_ACD_QUEUE_NAME = "support" try: res = voxapi.set_queue_info(acd_queue_id=ACD_QUEUE_ID, new_acd_queue_name=NEW_ACD_QUEUE_NAME) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Bind a Dialogflow key to the application. DIALOGFLOW_KEY_ID = 1 APPLICATION_ID = 1 try: res = voxapi.bind_dialogflow_keys(DIALOGFLOW_KEY_ID, APPLICATION_ID) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Send the SMS message with the text "Test message" from the phone # number 447443332211 to the phone number 447443332212. SOURCE = "447443332211" DESTINATION = "447443332212" SMS_BODY = "Test message" try: res = voxapi.send_sms_message(SOURCE, DESTINATION, SMS_BODY) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
module = GetParams("module") if module == "voximplant": credentials = GetParams("credentials") source = GetParams("source") destination = GetParams("destination") message = GetParams("message") if "+" in source: source = source.split('+')[1] if "+" in destination: destination = destination.split('+')[1] try: api = VoximplantAPI(credentials) # Send the SMS with the "Test message" text from the phone number 447443332211 to the phone number 447443332212 SOURCE = source DESTINATION = destination SMS_BODY = message try: res = api.send_sms_message(SOURCE, DESTINATION, SMS_BODY) print(res) except VoximplantException as e: print("Error: {}".format(e.message)) except Exception as e: PrintException()
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Disable work with SMS for phone number 447443332211. PHONE_NUMBER = "447443332211" COMMAND = "disable" try: res = voxapi.control_sms(PHONE_NUMBER, COMMAND) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Set the rule selection order: 1, 7, 3 RULE_ID = [1, 7, 3] try: res = voxapi.reorder_rules(RULE_ID) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get the all subscription template prices. try: res = voxapi.get_subscription_price() print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Set the notification settings. LANGUAGE_CODE = "en" LOCATION = "GMT-8" MIN_BALANCE_TO_NOTIFY = "1.50" TARIFF_CHANGING_NOTIFICATIONS = True NEWS_NOTIFICATIONS = True try: res = voxapi.set_account_info(language_code=LANGUAGE_CODE, location=LOCATION, min_balance_to_notify=MIN_BALANCE_TO_NOTIFY, tariff_changing_notifications=TARIFF_CHANGING_NOTIFICATIONS, news_notifications=NEWS_NOTIFICATIONS) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get all the reports. HISTORY_TYPE = "all" try: res = voxapi.get_history_reports(history_type=HISTORY_TYPE) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get the phone number categories in Russia. COUNTRY_CODE = "RU" try: res = voxapi.get_phone_number_categories(country_code=COUNTRY_CODE) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Bind SIP registration with id 1 to application with id 123. APPLICATION_ID = 123 SIP_REGISTRATION_ID = 1 BIND = True try: res = voxapi.bind_sip_registration( application_id=APPLICATION_ID, sip_registration_id=SIP_REGISTRATION_ID, bind=BIND) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Bind the skills 1, 5 to the users 5, 6, 10. SKILL_ID = [1, 3] USER_ID = [5, 6, 10] try: res = voxapi.bind_skill(skill_id=SKILL_ID, user_id=USER_ID) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Remove the roles 1, 2, 3 from the key. KEY_ID = "ab81c90e-543e-4446-9af9-105269dfafca" ROLE_ID = 1 try: res = voxapi.remove_key_roles(KEY_ID, role_id=ROLE_ID) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get the all available admin role entries. try: res = voxapi.get_available_admin_role_entries() print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Disable the child account. CHILD_ACCOUNT_ID = 1321 ACTIVE = False try: res = voxapi.set_child_account_info(child_account_id=CHILD_ACCOUNT_ID, active=ACTIVE) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Allow the all permissions except the DelUser and DelApplication. ADMIN_ROLE_ID = 1 ENTRY_MODIFICATION_MODE = "set" ALLOWED_ENTRIES = "all" DENIED_ENTRIES = ["DelUser", "DelApplication"] try: res = voxapi.set_admin_role_info( admin_role_id=ADMIN_ROLE_ID, entry_modification_mode=ENTRY_MODIFICATION_MODE, allowed_entries=ALLOWED_ENTRIES, denied_entries=DENIED_ENTRIES) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Add a new rule. RULE_NAME = "allowall" RULE_PATTERN = ".*" APPLICATION_ID = 1 try: res = voxapi.add_rule(RULE_NAME, RULE_PATTERN, application_id=APPLICATION_ID) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get two first identities. APPLICATION_ID = 1 COUNT = 2 try: res = voxapi.get_users(application_id=APPLICATION_ID, count=COUNT) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # try: res = voxapi.get_resource_price() print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get the two queues. COUNT = 2 try: res = voxapi.get_queues(count=COUNT) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get all lists registered by user LIST_ID = 1 OUTPUT = "json" try: res = voxapi.get_call_list_details(LIST_ID, output=OUTPUT) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get the all children. try: res = voxapi.get_children_accounts() print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Charge the all frozen phone numbers. PHONE_NUMBER = "all" try: res = voxapi.charge_account(phone_number=PHONE_NUMBER) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException import pytz import datetime if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get the three transactions record from the 2012-01-01 00:00:00 UTC to the 2014-01-01 00:00:00 UTC with the 'gift' or 'money_distribution' types. FROM_DATE = datetime.datetime(2012, 1, 1, 0, 0, 0, pytz.utc) TO_DATE = datetime.datetime(2014, 1, 1, 0, 0, 0, pytz.utc) COUNT = 3 TRANSACTION_TYPE = ["gift", "money_distribution"] try: res = voxapi.get_transaction_history(FROM_DATE, TO_DATE, count=COUNT, transaction_type=TRANSACTION_TYPE) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get two first admin users. WITH_ACCESS_ENTRIES = True COUNT = 2 try: res = voxapi.get_admin_users(with_access_entries=WITH_ACCESS_ENTRIES, count=COUNT) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Change the skill name. NEW_SKILL_NAME = "Support" SKILL_ID = 1 try: res = voxapi.set_skill_info(NEW_SKILL_NAME, skill_id=SKILL_ID) print(res) except VoximplantException as e: print("Error: {}".format(e.message))
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") SIP_WHITELIST_ID = 1 SIP_WHITELIST_NETWORK = "192.168.1.5/16" try: res = voxapi.set_sip_white_list_item(SIP_WHITELIST_ID, SIP_WHITELIST_NETWORK) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get two admin roles attached to the admin_user_id=22. WITH_ENTRIES = True SHOWING_ADMIN_USER_ID = 11 INCLUDED_ADMIN_USER_ID = 22 COUNT = 2 try: res = voxapi.get_admin_roles( with_entries=WITH_ENTRIES, showing_admin_user_id=SHOWING_ADMIN_USER_ID, included_admin_user_id=INCLUDED_ADMIN_USER_ID, count=COUNT) except VoximplantException as e: print("Error: {}".format(e.message)) print(res)
from voximplant.apiclient import VoximplantAPI, VoximplantException if __name__ == "__main__": voxapi = VoximplantAPI("credentials.json") # Get push credentials. PUSH_CREDENTIAL_ID = 1 try: res = voxapi.get_push_credential(push_credential_id=PUSH_CREDENTIAL_ID) print(res) except VoximplantException as e: print("Error: {}".format(e.message))