Project

General

Profile

SipSettingsApi » History » Revision 64

Revision 63 (Adrian Georgescu, 09/20/2012 04:33 PM) → Revision 64/68 (Adrian Georgescu, 10/19/2012 11:35 AM)

h1. 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. 

 h2. LDAP server 

  * LDAP server address: tls://ldap.sipthor.net:636 
  * LDAP search base: ou=addressbook, dc=sip2sip, dc=info 


 h2. 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":http://json.org. 

 h2. API Functions 

 The following actions are supported: 

 h3. Identity 

 Returns identity information: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_identity 
 </pre> 

 h3. SIP aliases 

 Return the SIP aliases: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_aliases 
 </pre> 

 Add an alias to our own account 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=add_alias&username=alice 
 </pre> 

 h3. ENUM numbers 

 Return the ENUM numbers: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_enum 
 </pre> 

 h3. Call history 

 Returns call history: 

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

 h3. Registered devices 

 Return the list of registered devices 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_devices 
 </pre> 

 h3. Prepaid 

 Return the prepaid balance and active calls: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_prepaid 
 </pre> 

 Return the history of prepaid balance: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_balance_history 
 </pre> 

 Return the curent monthly usage: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_monthly_usage 
 </pre> 

 h3. Call forwarding 

 Return the call forwarding settings: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_call_forwarding 
 </pre> 

 Set call forwarding 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=set_call_forwarding&FUNC=target&FBUS=target&... 
 </pre> 
 <pre> 
 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> 

 </pre> 

 h3. Call filtering 
 
 Return the list of accept rules: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_accept_rules 
 </pre> 

 Return the list of reject rules: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_reject_rules 
 </pre> 

 h3. Voicemail settings 

 Return the voicemail settings: 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_voicemail 
 </pre> 

 h3. Do not disturb 

 Enabled Do Not Disturb 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=set_dnd_on 
 </pre> 

 Disable Do Not Disturb 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=set_dnd_off 
 </pre> 

 Enable Do Not Disturb for 60 minutes 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=set_dnd_on&duration=60 
 </pre> 

 h3. Privacy 

 Enabled privacy (hide Caller Id for outgoing calls) 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=set_privacy_on 
 </pre> 

 Disable privacy 
 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=set_privacy_off 
 </pre> 

 h3. 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 

 <pre> 
 https://enrollment.sipthor.net/settings.phtml?action=get_journal_entries&except_uuid=UUID&after_id=ID 
 </pre> 

 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. 

 Put journal entries 

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

 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.