SIP Account Management API

This API can be used from third party applications running in and end-point that wish to interact with the SIP account data stored on the server. Data can be read or modified by calling various functions.

Directory Services

SIP2SIP uses LDAP for directory services:

Server address

tls://ldap.sipthor.net:636

Search base

ou=addressbook, dc=sip2sip, dc=info

Server Address

To access the API, a client must connect using HTTP protocol to the following address:

https://enrollment.sipthor.net/settings.phtml

The return is encoded using json.

Authentication

To login you must append &realm=sip2sip.info to the query string, then in the HTTP digest authentication form enter the username part without @sip2sip.info and the password.

API Functions

The following actions are supported:

Identity

Returns identity information:

https://enrollment.sipthor.net/settings.phtml?action=get_identity

SIP aliases

Return the SIP aliases:

https://enrollment.sipthor.net/settings.phtml?action=get_aliases

Add an alias to our own account

https://enrollment.sipthor.net/settings.phtml?action=add_alias&username=alice

ENUM numbers

Return the ENUM numbers:

https://enrollment.sipthor.net/settings.phtml?action=get_enum

Call history

Returns call history:

https://enrollment.sipthor.net/settings.phtml?action=get_history

Registered devices

Return the list of registered devices

https://enrollment.sipthor.net/settings.phtml?action=get_devices

Prepaid

Return the prepaid balance and active calls:

https://enrollment.sipthor.net/settings.phtml?action=get_prepaid

Return the history of prepaid balance:

https://enrollment.sipthor.net/settings.phtml?action=get_balance_history

Return the curent monthly usage:

https://enrollment.sipthor.net/settings.phtml?action=get_monthly_usage

Call forwarding

Return the call forwarding settings:

https://enrollment.sipthor.net/settings.phtml?action=get_call_forwarding

Set call forwarding

https://enrollment.sipthor.net/settings.phtml?action=set_call_forwarding&FUNC=target&FBUS=target&...

FUNC = Forward unconditional all calls
FBUS = Forward on Busy
FNOL = Forward on Not Online
FNOA = Forward on No Answer
FUNV = Forward when Not Available based on Accept rules

Pre-defined keywords for diversion targets:

<voice-mailbox>
<mobile-number>

Call filtering

Return the list of accept rules:

https://enrollment.sipthor.net/settings.phtml?action=get_accept_rules

Return the list of reject rules:

https://enrollment.sipthor.net/settings.phtml?action=get_reject_rules

Voicemail settings

Return the voicemail settings:

https://enrollment.sipthor.net/settings.phtml?action=get_voicemail

Do not disturb

Enabled Do Not Disturb

https://enrollment.sipthor.net/settings.phtml?action=set_dnd_on

Disable Do Not Disturb

https://enrollment.sipthor.net/settings.phtml?action=set_dnd_off

Enable Do Not Disturb for 60 minutes

https://enrollment.sipthor.net/settings.phtml?action=set_dnd_on&duration=60

Privacy

Enabled privacy (hide Caller Id for outgoing calls)

https://enrollment.sipthor.net/settings.phtml?action=set_privacy_on

Disable privacy

https://enrollment.sipthor.net/settings.phtml?action=set_privacy_off

Data replication

These function can be used by multiple client instances to replicate arbitrary data among themselves. An example of such application is bidirectional replication of chat messages between multiple clients configured for the same account.

Get journal entries

https://enrollment.sipthor.net/settings.phtml?action=get_journal_entries&except_uuid=UUID&after_timestamp=UNIX_TIMESTAMP

UUID is the GRUU identifier of the SIP client. ID must be replaced with the last replicated journal_id received from a previous get_journal_entries call. The return contains an array with 'data' entities that were put using the 'put_journal_entries' call. Optionally after_timestamp can be used to retrieve entries recent than the given timestamp.

Put journal entries

https://enrollment.sipthor.net/settings.phtml?action=put_journal_entries

The request must be done using POST method by passing two variables uuid=UUID and data=DATA.

UUID is the GRUU identifier of the SIP client.

DATA must be a json encoded associative array containing the 'id' and 'data' keys. 'id' value must be client own identifier corresponding to the replicated data.

'data' value can be anything the client understands when reading it back using a get_journal_entries call. Is recommended that 'data' values are encrypted using a key known only by the client.

The response from the server contains a json encoded array with mappings between client id and server journal id that can be saved by the client for further reference that can be used for 'get_journal_entries' calls.