-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a11fa64
commit cb958a4
Showing
8 changed files
with
116 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...ation/azure-communication-phonenumbers/samples/update_phone_number_capabilities_sample.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# coding: utf-8 | ||
|
||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# -------------------------------------------------------------------------- | ||
|
||
""" | ||
FILE: update_phone_number_capabilities_sample.py | ||
DESCRIPTION: | ||
This sample demonstrates how to updtae the capabilities of a phone number using your connection string. | ||
USAGE: | ||
python update_phone_number_capabilities_sample.py | ||
Set the environment variables with your own values before running the sample: | ||
1) AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING - The endpoint of your Azure Communication Service | ||
2) AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER_TO_UPDATE - The phone number you want to update | ||
""" | ||
|
||
import os | ||
from azure.communication.phonenumbers import ( | ||
PhoneNumbersClient, | ||
PhoneNumberCapabilityValue | ||
) | ||
|
||
connection_str = os.getenv('AZURE_COMMUNICATION_SERVICE_CONNECTION_STRING') | ||
phone_number_to_release = os.getenv( | ||
"AZURE_COMMUNICATION_SERVICE_PHONE_NUMBER_TO_UPDATE" # e.g. "+18001234567" | ||
) | ||
phone_numbers_client = PhoneNumbersClient.from_connection_string(connection_str) | ||
|
||
def update_phone_number_capabilities(): | ||
poller = phone_numbers_client.begin_update_phone_number_capabilities( | ||
"+18335260208", | ||
PhoneNumberCapabilityValue.OUTBOUND, | ||
PhoneNumberCapabilityValue.INBOUND_OUTBOUND, | ||
polling = True | ||
) | ||
poller.result() | ||
print('Status of the operation:') | ||
print(poller.status()) | ||
|
||
if __name__ == '__main__': | ||
update_phone_number_capabilities() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters