Skip to content

Commit

Permalink
Completed voice/ringout, voice/supervision, and voice/finding-active-…
Browse files Browse the repository at this point in the history
…calls
  • Loading branch information
leodewang committed Jul 17, 2020
1 parent 78ae5e1 commit a76feac
Show file tree
Hide file tree
Showing 5 changed files with 23,940 additions and 432 deletions.
50 changes: 26 additions & 24 deletions docs/basics/uris.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,31 @@ In the RingCentral API, as in any REST API, the resources are accessible by stan

Let's consider a simple example of a `GET` method — retrieving the version of the RingCentral REST API.

```http tab="Request"
GET /restapi/v1.0 HTTP/1.1
Accept: application/json
Authorization: Bearer UExxxxxxxxMnzpdvtYYNWMSJ7CL8h0zM6q6a9ntw
```

```http tab="Response"
HTTP/1.1 200 OK
Content-Type: application/json
{
"uri" : "https.../restapi/",
"apiVersions" : [ {
"uri" : "https.../restapi/v1.0",
"versionString" : "1.0.9",
"releaseDate" : "2013-12-01T00:00:00.000Z",
"uriString" : "v1.0"
} ],
"serverVersion" : "6.1.0.846",
"serverRevision" : "294476"
}
```

=== "Request"
```http
GET /restapi/v1.0 HTTP/1.1
Accept: application/json
Authorization: Bearer UExxxxxxxxMnzpdvtYYNWMSJ7CL8h0zM6q6a9ntw
```

=== "Response"
```http
HTTP/1.1 200 OK
Content-Type: application/json

{
"uri" : "https.../restapi/",
"apiVersions" : [ {
"uri" : "https.../restapi/v1.0",
"versionString" : "1.0.9",
"releaseDate" : "2013-12-01T00:00:00.000Z",
"uriString" : "v1.0"
} ],
"serverVersion" : "6.1.0.846",
"serverRevision" : "294476"
}
```
!!! alert "FYI"
Most RingCentral API resources do not support all of the four methods. In order to find out which resources support a particular method, please refer to the API Reference.

Expand Down Expand Up @@ -165,4 +167,4 @@ For example:
* `RCMobile/3.6.1 (OfficeAtHand; iOS/6.0; rev.987654)`
* `Softphone/6.2.0.11632`

The `User-Agent` string format is described in <a target="_new" href="https://tools.ietf.org/html/rfc1945">RFC 1945</a> and <a target="_new" href="https://tools.ietf.org/html/rfc2068">RFC 2068</a>.
The `User-Agent` string format is described in <a target="_new" href="https://tools.ietf.org/html/rfc1945">RFC 1945</a> and <a target="_new" href="https://tools.ietf.org/html/rfc2068">RFC 2068</a>.
266 changes: 136 additions & 130 deletions docs/voice/finding-active-calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,133 +41,139 @@ The response format for active calls mirrors that of Call Log responses exactly.

## Sample Code to Get Started with reading user active calls

```javascript tab="JavaScript"
const RC = require('ringcentral');

var rcsdk = new RC( {server: "server_url", appKey: "client_id", appSecret: "client_secret"} );
var platform = rcsdk.platform();

platform.login( {username: "username", password: "password", extension: "extension_number"} )
.then(function(resp) {
read_active_calls()
});

function read_active_calls(){
platform.get('/account/~/extension/~/active-calls', {
view: 'Simple'
})
.then(function (resp) {
for (var record of resp.json().records)
console.log("Call result: " + record.result)
});
}
```

```python tab="Python"
from ringcentral import SDK

sdk = SDK( "client_id", "client_secret", "server_url" )
platform = sdk.platform()
platform.login( "username", "extension", "password" )

params = {
'view' : 'Simple'
}
resp = platform.get('/restapi/v1.0/account/~/extension/~/active-calls', params)
for record in resp.json().records:
print "Call result: " + record.result
```

```php tab="PHP"
<?php
require('vendor/autoload.php');

$rcsdk = new RingCentral\SDK\SDK( "client_id", "client_secret", "server_url" );

$platform = $rcsdk->platform();
$platform->login( "username", "extension_number", "password" );

$params = array(
'view' => 'Simple'
);
$resp = $platform->get('/account/~/extension/~/active-calls', $params);
foreach ($resp->json()->records as $record) {
print_r ("Call result: ".$record->result);
}
?>
```

```c# tab="C#"
using System;
using System.Threading.Tasks;
using RingCentral;

namespace Read_User_ActiveCalls
{
class Program
{
static void Main(string[] args)
{
read_user_active_calls().Wait();
}
static private async Task read_user_active_calls()
{
RestClient rc = new RestClient("client_id", "client_secret", false);
await rc.Authorize("username", "extension_number", "password");
var parameters = new ListExtensionActiveCallsParameters();
parameters.view = "Simple";
var resp = await rc.Restapi().Account().Extension().ActiveCalls().Get(parameters);
foreach (CallLogRecord record in resp.records)
{
Console.WriteLine("Call result: " + record.result);
}
}
}
}
```

```java tab="Java"
package Read_User_ActiveCalls;

import java.io.IOException;
import com.ringcentral.*;
import com.ringcentral.definitions.*;

public class Read_User_ActiveCalls {
public static void main(String[] args) {
try {
read_user_activecals();
} catch (RestException | IOException e) {
e.printStackTrace();
}
}

public static void read_user_activecals() throws RestException, IOException{
RestClient rc = new RestClient("client_id", "client_secret", "server_url");
rc.authorize("username", "extension_number", "password");

var getParameters = new ListExtensionActiveCallsParameters();
parameters.view = "Simple"

var response = rc.restapi().account().extension().activecalls().list(parameters);
for (CallLogRecord record : response.records) {
System.out.println("Call result: " + record.result);
}
}
}
```

```ruby tab="Ruby"
require 'ringcentral'

rc = RingCentral.new( 'client_id', 'client_secret', 'server_url')
rc.authorize( username: 'username', extension: 'extension_number', password: 'password')

resp = rc.get('/restapi/v1.0/account/~/extension/~/active-calls', {
view: 'Simple'
})

for record in resp.body['records'] do
puts "Call result: " + record['result']
end
```
=== "JavaScript"
```javascript
const RC = require('ringcentral');

var rcsdk = new RC( {server: "server_url", appKey: "client_id", appSecret: "client_secret"} );
var platform = rcsdk.platform();

platform.login( {username: "username", password: "password", extension: "extension_number"} )
.then(function(resp) {
read_active_calls()
});

function read_active_calls(){
platform.get('/account/~/extension/~/active-calls', {
view: 'Simple'
})
.then(function (resp) {
for (var record of resp.json().records)
console.log("Call result: " + record.result)
});
}
```

=== "Python"
```python
from ringcentral import SDK

sdk = SDK( "client_id", "client_secret", "server_url" )
platform = sdk.platform()
platform.login( "username", "extension", "password" )

params = {
'view' : 'Simple'
}
resp = platform.get('/restapi/v1.0/account/~/extension/~/active-calls', params)
for record in resp.json().records:
print "Call result: " + record.result
```

=== "PHP"
```php
<?php
require('vendor/autoload.php');

$rcsdk = new RingCentral\SDK\SDK( "client_id", "client_secret", "server_url" );

$platform = $rcsdk->platform();
$platform->login( "username", "extension_number", "password" );

$params = array(
'view' => 'Simple'
);
$resp = $platform->get('/account/~/extension/~/active-calls', $params);
foreach ($resp->json()->records as $record) {
print_r ("Call result: ".$record->result);
}
?>
```

=== "C#"
```c#
using System;
using System.Threading.Tasks;
using RingCentral;

namespace Read_User_ActiveCalls
{
class Program
{
static void Main(string[] args)
{
read_user_active_calls().Wait();
}
static private async Task read_user_active_calls()
{
RestClient rc = new RestClient("client_id", "client_secret", false);
await rc.Authorize("username", "extension_number", "password");
var parameters = new ListExtensionActiveCallsParameters();
parameters.view = "Simple";
var resp = await rc.Restapi().Account().Extension().ActiveCalls().Get(parameters);
foreach (CallLogRecord record in resp.records)
{
Console.WriteLine("Call result: " + record.result);
}
}
}
}
```

=== "Java"
```java
package Read_User_ActiveCalls;

import java.io.IOException;
import com.ringcentral.*;
import com.ringcentral.definitions.*;

public class Read_User_ActiveCalls {
public static void main(String[] args) {
try {
read_user_activecals();
} catch (RestException | IOException e) {
e.printStackTrace();
}
}

public static void read_user_activecals() throws RestException, IOException{
RestClient rc = new RestClient("client_id", "client_secret", "server_url");
rc.authorize("username", "extension_number", "password");

var getParameters = new ListExtensionActiveCallsParameters();
parameters.view = "Simple"

var response = rc.restapi().account().extension().activecalls().list(parameters);
for (CallLogRecord record : response.records) {
System.out.println("Call result: " + record.result);
}
}
}
```

=== "Ruby"
```ruby
require 'ringcentral'

rc = RingCentral.new( 'client_id', 'client_secret', 'server_url')
rc.authorize( username: 'username', extension: 'extension_number', password: 'password')

resp = rc.get('/restapi/v1.0/account/~/extension/~/active-calls', {
view: 'Simple'
})

for record in resp.body['records'] do
puts "Call result: " + record['result']
end
```
Loading

0 comments on commit a76feac

Please sign in to comment.