Project

General

Profile

SipSettingsApi » History » Version 67

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