Project

General

Profile

SipSettingsApi » History » Version 68

Adrian Georgescu, 12/08/2015 01:20 PM

1 61 Adrian Georgescu
h1. SIP Account Management API
2 46 Adrian Georgescu
3 63 Adrian Georgescu
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.
4 46 Adrian Georgescu
5 65 Adrian Georgescu
h2. Directory Services
6 1 Adrian Georgescu
7 65 Adrian Georgescu
SIP2SIP uses LDAP for directory services:
8 64 Adrian Georgescu
9 66 Adrian Georgescu
h3. Server address
10
11
tls://ldap.sipthor.net:636
12
13
h3. Search base
14
15
ou=addressbook, dc=sip2sip, dc=info
16 64 Adrian Georgescu
17 62 Adrian Georgescu
h2. Server Address
18 46 Adrian Georgescu
19 1 Adrian Georgescu
To access the API, a client must connect using HTTP protocol to the following address: 
20
21
https://enrollment.sipthor.net/settings.phtml
22
23
The return is encoded using "json":http://json.org.
24
25 68 Adrian Georgescu
h3. Authentication
26
27
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. 
28
29 1 Adrian Georgescu
h2. API Functions
30 46 Adrian Georgescu
31 50 Adrian Georgescu
The following actions are supported:
32 49 Adrian Georgescu
33
h3. Identity
34 1 Adrian Georgescu
35 51 Adrian Georgescu
Returns identity information:
36 1 Adrian Georgescu
<pre>
37
https://enrollment.sipthor.net/settings.phtml?action=get_identity
38 46 Adrian Georgescu
</pre>
39 50 Adrian Georgescu
40
h3. SIP aliases
41
42 51 Adrian Georgescu
Return the SIP aliases:
43 1 Adrian Georgescu
<pre>
44
https://enrollment.sipthor.net/settings.phtml?action=get_aliases
45
</pre>
46 50 Adrian Georgescu
47 51 Adrian Georgescu
Add an alias to our own account
48 50 Adrian Georgescu
<pre>
49
https://enrollment.sipthor.net/settings.phtml?action=add_alias&username=alice
50
</pre>
51
52
h3. ENUM numbers
53
54 51 Adrian Georgescu
Return the ENUM numbers:
55 1 Adrian Georgescu
<pre>
56 46 Adrian Georgescu
https://enrollment.sipthor.net/settings.phtml?action=get_enum
57 1 Adrian Georgescu
</pre>
58 46 Adrian Georgescu
59 50 Adrian Georgescu
h3. Call history
60
61 51 Adrian Georgescu
Returns call history:
62
63 1 Adrian Georgescu
<pre>
64
https://enrollment.sipthor.net/settings.phtml?action=get_history
65 48 Adrian Georgescu
</pre>
66 50 Adrian Georgescu
67
h3. Registered devices
68
69 51 Adrian Georgescu
Return the list of registered devices
70 47 Adrian Georgescu
<pre>
71 46 Adrian Georgescu
https://enrollment.sipthor.net/settings.phtml?action=get_devices
72 1 Adrian Georgescu
</pre>
73
74 50 Adrian Georgescu
h3. Prepaid
75
76 51 Adrian Georgescu
Return the prepaid balance and active calls:
77 1 Adrian Georgescu
<pre>
78 46 Adrian Georgescu
https://enrollment.sipthor.net/settings.phtml?action=get_prepaid
79
</pre>
80 51 Adrian Georgescu
81
Return the history of prepaid balance:
82 1 Adrian Georgescu
<pre>
83
https://enrollment.sipthor.net/settings.phtml?action=get_balance_history
84
</pre>
85 51 Adrian Georgescu
86
Return the curent monthly usage:
87 1 Adrian Georgescu
<pre>
88 46 Adrian Georgescu
https://enrollment.sipthor.net/settings.phtml?action=get_monthly_usage
89
</pre>
90 50 Adrian Georgescu
91
h3. Call forwarding
92
93 51 Adrian Georgescu
Return the call forwarding settings:
94 1 Adrian Georgescu
<pre>
95
https://enrollment.sipthor.net/settings.phtml?action=get_call_forwarding
96
</pre>
97 50 Adrian Georgescu
98 51 Adrian Georgescu
Set call forwarding
99 50 Adrian Georgescu
<pre>
100
https://enrollment.sipthor.net/settings.phtml?action=set_call_forwarding&FUNC=target&FBUS=target&...
101
</pre>
102
<pre>
103
FUNC = Forward unconditional all calls
104
FBUS = Forward on Busy
105
FNOL = Forward on Not Online
106 1 Adrian Georgescu
FNOA = Forward on No Answer
107 50 Adrian Georgescu
FUNV = Forward when Not Available based on Accept rules
108
109 1 Adrian Georgescu
Pre-defined keywords for diversion targets:
110
111 50 Adrian Georgescu
<voice-mailbox>
112
<mobile-number>
113
114
</pre>
115
116 1 Adrian Georgescu
h3. Call filtering
117 50 Adrian Georgescu
 
118 51 Adrian Georgescu
Return the list of accept rules:
119 1 Adrian Georgescu
<pre>
120
https://enrollment.sipthor.net/settings.phtml?action=get_accept_rules
121
</pre>
122 51 Adrian Georgescu
123
Return the list of reject rules:
124 46 Adrian Georgescu
<pre>
125 1 Adrian Georgescu
https://enrollment.sipthor.net/settings.phtml?action=get_reject_rules
126
</pre>
127 50 Adrian Georgescu
128
h3. Voicemail settings
129 1 Adrian Georgescu
130 51 Adrian Georgescu
Return the voicemail settings:
131 1 Adrian Georgescu
<pre>
132 46 Adrian Georgescu
https://enrollment.sipthor.net/settings.phtml?action=get_voicemail
133
</pre>
134 50 Adrian Georgescu
135
h3. Do not disturb
136 1 Adrian Georgescu
137 51 Adrian Georgescu
Enabled Do Not Disturb
138 46 Adrian Georgescu
<pre>
139 1 Adrian Georgescu
https://enrollment.sipthor.net/settings.phtml?action=set_dnd_on
140
</pre>
141 51 Adrian Georgescu
142
Disable Do Not Disturb
143 46 Adrian Georgescu
<pre>
144
https://enrollment.sipthor.net/settings.phtml?action=set_dnd_off
145 1 Adrian Georgescu
</pre>
146 51 Adrian Georgescu
147
Enable Do Not Disturb for 60 minutes
148 1 Adrian Georgescu
<pre>
149 46 Adrian Georgescu
https://enrollment.sipthor.net/settings.phtml?action=set_dnd_on&duration=60
150
</pre>
151 1 Adrian Georgescu
152 50 Adrian Georgescu
h3. Privacy
153
154 51 Adrian Georgescu
Enabled privacy (hide Caller Id for outgoing calls)
155 1 Adrian Georgescu
<pre>
156
https://enrollment.sipthor.net/settings.phtml?action=set_privacy_on
157
</pre>
158 51 Adrian Georgescu
159
Disable privacy
160 1 Adrian Georgescu
<pre>
161
https://enrollment.sipthor.net/settings.phtml?action=set_privacy_off
162 46 Adrian Georgescu
</pre>
163 52 Adrian Georgescu
164 57 Adrian Georgescu
h3. Data replication
165 1 Adrian Georgescu
166 57 Adrian Georgescu
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. 
167
168 58 Adrian Georgescu
Get journal entries
169 52 Adrian Georgescu
170
<pre>
171 67 Adrian Georgescu
https://enrollment.sipthor.net/settings.phtml?action=get_journal_entries&except_uuid=UUID&after_timestamp=UNIX_TIMESTAMP
172 52 Adrian Georgescu
</pre>
173
174 67 Adrian Georgescu
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.
175 52 Adrian Georgescu
176 58 Adrian Georgescu
Put journal entries
177 52 Adrian Georgescu
178
<pre>
179
https://enrollment.sipthor.net/settings.phtml?action=put_journal_entries
180 1 Adrian Georgescu
</pre>
181
182 59 Adrian Georgescu
The request must be done using POST method by passing two variables uuid=UUID and data=DATA. 
183
184
UUID is the GRUU identifier of the SIP client.  
185
186
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. 
187
188
'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.
189 58 Adrian Georgescu
190 60 Adrian Georgescu
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.