Endpoints

list_domain_endpoints

Client.list_domain_endpoints(domain_id, size=None, **kwargs)

Get a list of domain’s endpoints

Parameters:
  • domain_id (str) – id of a domain
  • size (int) – Used for pagination to indicate the size of each page requested for querying a list of items. If no value is specified the default value is 25. (Maximum value 1000)
Return type:

types.GeneratorType

Returns:

list of endpoints

Example: List and iterate over:

endpoint_list = api.list_domain_endpoints('rd-domainId', size=1000)

for endpoint in endpoint_list:
    print(endpoint['id'])
##re-endpointId1
##re-endpointId2

Example: List and print all:

endpoint_list = api.list_domain_endpoints('rd-domainId', size=1000)

print(list(endpoint_list))

## [
##     {
##         'application_id':'a-appId',
##         'credentials'  :{
##             'realm'    :'creds.bwapp.bwsip.io',
##             'username' :'user1'
##         },
##         'description'  :"Your SIP Account",
##         'domain_id'     :'rd-domainId',
##         'enabled'      :True,
##         'id'           :'re-endpointId1',
##         'name'         :'User1_endpoint',
##         'sip_uri'       :'sip:user1@creds.bwapp.bwsip.io'
##     },
##     {
##         'application_id':'a-appId',
##         'credentials'  :{
##             'realm'    :'creds1.bwapp.bwsip.io',
##             'username' :'user2'
##         },
##         'description'  :"Your SIP Account",
##         'domain_id'     :'rd-domainId',
##         'enabled'      :True,
##         'id'           :'re-endpointId2',
##         'name'         :'User2_endpoint',
##         'sip_uri'       :'sip:user2@creds.bwapp.bwsip.io'
##     }
## ]

create_domain_endpoint

Client.create_domain_endpoint(domain_id, name, password, description=None, application_id=None, enabled=True, **kwargs)

Create a domain endpoint

Parameters:
  • domain_id (str) – id of a domain
  • name (str) – The name of endpoint
  • description (str) – String to describe the endpoint
  • application_id (str) – Id of application which will handle calls and messages of this endpoint
  • enabled (bool) – When set to true, SIP clients can register as this device to receive and make calls. When set to false, registration, inbound, and outbound calling will not succeed.
  • password (str) – Password of created SIP account
Return type:

str

Returns:

id of endpoint

Example: Create Endpoint on Domain ‘rd-domainId’:

endpoint_id = api.create_domain_endpoint('rd-domainId',
                                         endpoint_name='User3_endpoint',
                                         password='AtLeast6Chars')
print(endpoint_id)
# re-endpointId3

my_endpoint = api.get_domain_endpoint(endpoint_id)
print(my_endpoint)

## {
##     'credentials' :{
##         'realm'   :'qwerty.bwapp.bwsip.io',
##         'username':'User3_endpoint'
##     },
##     'domain_id'    :'rd-domainId',
##     'enabled'     :True,
##     'id'          :'re-endpointId3',
##     'name'        :'User3_endpoint',
##     'sip_uri'      :'sip:user5@qwerty.bwapp.bwsip.io'
## }

get_domain_endpoint

Client.get_domain_endpoint(domain_id, endpoint_id)

Get information about an endpoint

Parameters:
  • domain_id (str) – id of a domain
  • endpoint_id (str) – id of a endpoint
Return type:

dict

Returns:

call information

Example: Create Endpoint on Domain ‘rd-domainId’ then fetch the endpoint:

endpoint_id = api.create_domain_endpoint('rd-domainId',
                                         endpoint_name='User3_endpoint',
                                         password='AtLeast6Chars')
print(endpoint_id)
# re-endpointId3

my_endpoint = api.get_domain_endpoint(endpoint_id)
print(my_endpoint)

## {
##     'credentials' :{
##         'realm'   :'qwerty.bwapp.bwsip.io',
##         'username':'User3_endpoint'
##     },
##     'domain_id'    :'rd-domainId',
##     'enabled'     :True,
##     'id'          :'re-endpointId3',
##     'name'        :'User3_endpoint',
##     'sip_uri'      :'sip:user5@qwerty.bwapp.bwsip.io'
## }

update_domain_endpoint

Client.update_domain_endpoint(domain_id, endpoint_id, password=None, description=None, application_id=None, enabled=None, **kwargs)

Update information about an endpoint

Parameters:
  • domain_id (str) – id of a domain
  • endpoint_id (str) – id of a endpoint
  • description (str) – String to describe the endpoint
  • application_id (str) – Id of application which will handle calls and messages of this endpoint
  • enabled (bool) – When set to true, SIP clients can register as this device to receive and make calls. When set to false, registration, inbound, and outbound calling will not succeed.
  • password (str) – Password of created SIP account

Example: Update password and disable the endpoint:

my_endpoint = api.get_domain_endpoint('rd-domainId', 're-endpointId')
print(my_endpoint)

## {
##     'credentials' :{
##         'realm'   :'qwerty.bwapp.bwsip.io',
##         'username':'user5'
##     },
##     'domain_id'    :'rd-domainId',
##     'enabled'     :True,
##     'id'          :'re-endpointId',
##     'name'        :'user3',
##     'sip_uri'      :'sip:user5@qwerty.bwapp.bwsip.io'
## }

api.update_domain_endpoint('rd-domainId', 're-endpointId', enabled=False, password='abc123')
my_endpoint = api.get_domain_endpoint('rd-domainId', 're-endpointId')
print(my_endpoint)

## {
##     'credentials' :{
##         'realm'   :'qwerty.bwapp.bwsip.io',
##         'username':'user5'
##     },
##     'domain_id'    :'rd-domainId',
##     'enabled'     :False,
##     'id'          :'re-endpointId',
##     'name'        :'user3',
##     'sip_uri'      :'sip:user5@qwerty.bwapp.bwsip.io'
## }

delete_domain_endpoint

Client.delete_domain_endpoint(domain_id, endpoint_id)

Remove an endpoint

Parameters:
  • domain_id (str) – id of a domain
  • endpoint_id (str) – id of a endpoint

Example: Delete and try to fetch endpoint:

my_endpoint = api.get_domain_endpoint('rd-domainId', 're-endpointId')
print(my_endpoint)
## {
##     'credentials' :{
##         'realm'   :'qwerty.bwapp.bwsip.io',
##         'username':'user5'
##     },
##     'domain_id'    :'rd-domainId',
##     'enabled'     :False,
##     'id'          :'re-endpointId3ndpointId',
##     'name'        :'user3',
##     'sip_uri'      :'sip:user5@qwerty.bwapp.bwsip.io'
## }
api.delete_domain_endpoint(d, e)

try:
    my_endpoint = api.get_domain_endpoint(d, e)
except Exception as e:
    print(e)
## CatapultException(404, "The endpoint 're-endpointId' could not be found")

create_domain_endpoint_auth_token

Client.create_domain_endpoint_auth_token(domain_id, endpoint_id, expires=3600, **kwargs)

Create auth token for an endpoint

Parameters:
  • domain_id (str) – id of a domain
  • endpoint_id (str) – id of a endpoint
  • expires (int) – Duration of valid token.

Example: Create token:

token = api.create_domain_endpoint_auth_token('domainId', 'endpointId', 5000)