﻿<a id="call_survey"></a>

# Call Survey

## Overview

This web service allows the app to post the call quality survey based on the quality parameter selected by the user.

## Parameters

Parameter templates for Call Survey can use any variables from [global](../reporting/intro.md#global-params) and [account](../reporting/intro.md#account-params)
scopes. There are three service-specific parameters defined for call survey.

### `callId` { .reference-entry }

Contains the unique identifier for the call, whose survey report is being posted.

### `stars` { .reference-entry }

Contains the quality parameter ranging from 1-5, 1 being the lowest and 5 as best quality.

### `customMessage` { .reference-entry }

Contains the message from the user about improvement or suggestion.

## Configuration

The following preference keys are relevant for call survey configuration:

### `callSurveyUrl` { .reference-entry }

Contains the URL, including URL scheme, of the web service, possibly also with query string.

Example:

```xml
<callsurveyurl>https://example.com/callSurvey</callsurveyurl>
```

### `callSurveyMethod` { .reference-entry }

Contains the HTTP Method (Get/Post). Call Survey web service uses POST as the Method.

Example:

```xml
<callsurveymethod>POST</callsurveymethod>
```

### `callSurveyPostData` { .reference-entry }

Call Survey webservice require the call quality information, the Post Data includes call Identifier, Call Quality Param and Custom Message for Improvement

Example (for application/x-www-form-urlencoded):

```xml
<callsurveypostdata>callId=%callId%&stars=%stars%&customMessage=%customMessage%</callsurveypostdata>
```

### `callSurveyContentType` { .reference-entry }

Specifies the value of Content-Type header to be sent in the request. If not specified, the app will default to
`application/x-www-form-urlencoded`

### `callSurveyCustomHeaders` { .reference-entry }

Specify custom headers to be added into request.

### `callSurveyAuthUsername` { .reference-entry }

If the Service is accessible from behind the proxy, you can configure the user name for the Call Survey Service via configuring callSurveyAuthUsername.

Example:

```xml
<callsurveyauthusername>%AuthUserName%</callsurveyauthusername>
```

### `callSurveyAuthPassword` { .reference-entry }

If the Service is accessible from behind the proxy, you can configure the password for the Call Survey Service via configuring callSurveyAuthPassword.

Example:

```xml
<callsurveyauthpassword>%AuthUserName%</callsurveyauthpassword>
```

### `callSurveyTimeout` { .reference-entry }

The default timeout for the Service is 30 seconds, but if you want to configure your custom timeout you can do so by setting the value in seconds for callSurveyTimeout.

Example:

```xml
<callsurveytimeout>20</callsurveytimeout>
```

## Response

The response will be considered successful if the HTTP response code is 2xx. Any responses which have other
response code, or whose body can't be parsed, are erroneous response.

## Examples

### POST method

request:

```http
POST /callSurvey/?callId=234242342342&stars=5&customMessage=Thanks HTTP/1.1
Host: example.com
Connection: close
Cache-Control: max-age=0
User-Agent: CloudSoftphone/1.5.6
```

response:

```http
HTTP/1.1 200 OK
Date: Sun, 15 Mar 2015 00:46:17 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 183
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/xml
```