Interfacing with CallReplay
CallReplay uses an embedded Postgres 9.0 database. To connect to it you can use PgAdmin III (Start / Programs / CallReplay / Support / PgAdmin III). It is also accesible from Java, C# and all programming languages which can access Postgres.
Port: Set during setup process, default 5432
User name: callreplay
Password: set during setup process, default CallReplay_2005
- Automatic Login URL {#InterfacingwithCallReplay-2.AutomaticLoginURL}
http://SERVER:PORT/CallRecorder/?user=USER&password=PASSWORD&tenant=TENANT&lang=LANGUAGE
where SERVER is the call recorder ip/address, PORT is the configured server port ( see CallReplay Site Configuration ), TENANT is the registered name of the tenant ( if not provided, the "default" tenant will be considered ), USER is the login name and PASSWORD is the password in clear text.
If you do not want to provide clear password, you may discard &password=, in that case CallReplay will ask you for password and use provided TENANT and USER.
Also, you can use the base URL with POST method, using the same keys and values as in normal URL:
- Call Details {#InterfacingwithCallReplay-3.CallDetails}
http://SERVER:PORT/CallRecorder/?callDetails=CALL_UUID&user=USER&password=PASSWORD&tenant=TENANT
where call_uuid is the uuid of the call, found in Advanced tab of Call Details.
Example:
Sometimes you may want to show only the Call Details dialog, in this case use the following url (note 'nomenu'):
http://< server : port >/CallRecorder/?callDetails=< call uuid > &user=< user_name >&password=< clear_password >&tenant=< tenant_name >&nomenu
Observation: this is best used inside of an IFRAME
Example:
- Call Playback {#InterfacingwithCallReplay-4.CallPlayback}
http://SERVER:PORT/CallRecorder/?player=CALL_UUID&user=USER&password=PASSWORD&tenant=TENANT
Observation: this is best used inside of an IFRAME
- File Storage URL
http://HOST:PORT/CallRecorder/Storage/STORAGE_VOLUME_ID/CALL_PATH
where STORAGE_VOLUME_ID is the volume index number in the table storage_volumes and CALL_PATH is the path to the required file relative to storage volume, which can be found in the **Call **detail dialog.
The storage web URL is protected by a password which is random by default but can be configured from the Storage > Advanced > Player Access Password. The user name is "player".
If you need to, you may construct and send HTTP Basic Authorization Header yourself. To do this you need to perform the following steps:
- Build a string of the form username:password{.external-link}, e.g. "player:123"
- Base64 encode the string, e.g. "cGxheWVyOjEyMw=="
- Supply an "Authorization" header with content "Basic " followed by the encoded string, e.g. "Basic cGxheWVyOjEyMw==" so the header will look like "Authorization: Basic cGxheWVyOjEyMw==".
Note: HTTP error code 401 is sent when the password is missing or incorrect, letting the browser prompt you for user/password. User name is 'player'.
- Transcoding URL {#InterfacingwithCallReplay-6.TranscodingURL}
Searches the call in the database, then transcode it to the desired output format, and send a redirect response to the temporary URL. If there is more than one call matching the query, the first one is used.
Parameters below are optional, that is searches can be made using any subset of parameters, so there is no longer any need to connect directly to the CallReplay database:
http://host:port/CallRecorder/Transcoder?callId=GUID&wireCallId=x{.external-link}
&beginTime=yyyy.mm.dd-hh.mm{.external-link}.ss&endTime=yyyy.mm.dd-hh.mm{.external-link}.ss
&callerIP=x&callerPort=x&callerMAC=x&callerNumber=x&callerName=x
&calledIP=x&calledPort=x&calledMAC=x&calledNumber=x&calledName=x
&format=x&password=x&lang=x
Parameters:
- Format:
- spx or wav - redirects to audio files; when multiple callIds were requested, their audio files are concatenated and the response redirects to the resulted file
- png - redirects to an image of audio file
- json - returns a list of details for all calls matching the query, in json format
- beginTime and endTime - calls will be searched for start time between these values (if provided).
- pbxCallId is the SKINNY call ID or SIP call ID
- callId is the database call GUID; multiple callIds may be requested
- numbers and names are searched for text [containing]{.underline} provided values
- IPs, ports and MACs are searched for exact match
- password is the password set in Storage > Advanced > Player Access Password. Instead of using this parameter, you can send a HTTP Basic Authorization Header instead.
- lang - one of the 2 char language identifier supported by CallReplay (see login dialog in administration site); used to display error messages; can be omitted for english
Notes:
- if the requested format is the same as storage format (see Storage > Advanced), you will receive a redirect to a File Storage URL for the file to be delivered straight from the storage. You need to supply a HTTP Basic Authorization Header in order to successfully download the file, as described in paragraph 5 File Storage URL.
- since the same user/password is used for Transcoding URL and File Storage URL, you may prefer sending HTTP Basic Authorization Header to the Transcoding URL instead of 'password' parameter.
- HTTP error code 401 is sent when the password is missing or incorrect, letting the browser prompt you for user/password. User name is 'player'.
- HTTP error code 412 is sent when other errors occur, along with an error message.
- External Replication API {#InterfacingwithCallReplay-7.ExternalReplicationAPI}
Downloads call details using HTTP requests.
Prerequsites:
To use this feature, you must add a replication branch and configure it
for Replication API. This means go to the HQ/Branch Replication page,
then to the Branch tab, where you add a new HQ. That is, add here the IP
address of the computer from which you want to download calls.
This is necessary for two reasons:
- CallReplay has to maintain a replication queue for this HQ like it does for all HQ-s. This is, in fact, a real HQ, more precisely, a 3rd party HQ (a computer where the calls will finally arrive).
- This allows you to have multiple 3rd party HQ-s as well as CallReplay HQ-s.
URL Format:
Parameters:
- tenant - the tenant id from which to download call details; can be omitted for default tenant
- replicationQueueName - must contain the exact HQ name (case sensitive) or the IP address entered for this HQ; it may be anything, even a fake IP - it is used just to find the queue with the not-replicated calls for this HQ.
- lastReplicationId - the last confirmed replication id - first time should be 0, the subsequent invocations should contain the last received replication id in order to be deleted from the database and advance to next operations; these IDs are in ascending order, but not necessarily contiguous;
- chunkSize - how many operations to return; can be omitted for default which currently is 50
- deletePrevious - whether to delete the row with lastReplicationId or not; when false, it will be retrieved again and again until deleted
- password - connection password set in the HQ dialog. Please configure CallReplay server to use HTTPS in order to hide the clear text password from a network analyzer. Instead of using this parameter, you can send a HTTP Basic Authorization Header, similar to the one in paragraph 5 File Storage URL. The user name is "replicator".
- lang - one of the 2 char language identifier supported by CallReplay (see login dialog in administration site); used to display error messages; can be omitted for english
Response for new call:
http://HOST:PORT/CallRecorder/Replicator?...&lastReplicationId=5
<!-- sample respone for a Cisco SIP call -->
<CallRecording>
<ReplicationId>3711</ReplicationId>
<Action>Create</Action>
<origLegcallIdentifier>17083749</origLegcallIdentifier>
<destLegIdentifier>17083750</destLegIdentifier>
<origLegSipCallId>0017e014-1e45000b-9d89d8c8-883d5c8c@10.1.0.61</origLegSipCallId>
<destLegSipCallId>38fe6b00-44510457-27e-6900010a@10.1.0.105</destLegSipCallId>
<globalCallID_callId>8062</globalCallID_callId>
<globalCallID_callManagerId>1</globalCallID_callManagerId>
<CallRecordingId>95a21ee8-adb5-2d5e-c208-6727e663e65f</CallRecordingId>
<StartTime>2014-10-22 16:35:36.746 +0300</StartTime>
<DurationMS>7300</DurationMS>
</CallRecording>
<!-- sample respone is for a Cisco SCCP call -->
<CallRecording>
<ReplicationId>3721</ReplicationId>
<Action>Create</Action>
<origLegcallIdentifier>17083687</origLegcallIdentifier>
<destLegIdentifier>17083688</destLegIdentifier>
<origLegSipCallId/>
<destLegSipCallId/>
<globalCallID_callId/>
<globalCallID_callManagerId/>
<CallRecordingId>3a07f1fb-9dd5-c60f-c2fc-5b14a3597a50</CallRecordingId>
<StartTime>2014-10-22 16:41:30.146 +0300</StartTime>
<DurationMS>6000</DurationMS>
</CallRecording>
<!-- sample response for a deleted call -->
<[CallRecording]{.start-tag}>
<[ReplicationId]{.start-tag}>24</[ReplicationId>]{.end-tag}
<[Action]{.start-tag}>Delete</[Action]{.end-tag}>
<[CallRecordingId]{.start-tag}>ed29894d-4a34-2944-b827-a76e00bd6b6a</[CallRecordingId]{.end-tag}>
</[CallRecording]{.end-tag}>
</[CallRecordings]{.end-tag}>
Response when there are no more operations at this moment:
http://HOST:PORT/CallRecorder/Replicator?…&lastReplicationId=654 <CallRecordings>
</CallRecordings>
Response in case of error:
<Error>
<Code>errorCode
<Message>error message
</Error>
Possible error codes:
1 - unknown error
2 - 'replicationQueueName' parameter was not set
3 - password parameter is missing or the password is wrong
4 - specified replication queue name was not found
5 - specified replication queue name was not configured for replication API - please go to HQ/Branch Replication page, edit HQ and check 'Only for Replication API'.
Notes:
- HTTP error code 401 is sent when the password is missing or incorrect, letting the browser prompt you for user/password. User name is 'replicator'.
- HTTP error code 412 is sent when other errors occur, along with an error message.
- Error messages will be returned in the chosen supported language (default is English).
Deleting Calls
The Replicaton API can also be used to delete calls. You will need to follow the steps from the Prerequsites section of the *External Replication API
URL Format:
Parameters:
- command - use the value 'delete' to delete calls
- replicationQueueName - must contain the exact HQ name (case sensitive) or the IP address entered for this HQ; it may be anything, even a fake IP - it is used just to find the queue with the not-replicated calls for this HQ.
- callGuid - the GUID(Globally Unique Identifier) of the call to delete
- recursive - if true, the call will be deleted from any replication branches it is found on. The default value is false.
- password - connection password set in the HQ dialog. Please configure CallReplay server to use HTTPS in order to hide the clear text password from a network analyzer. Instead of using this parameter, you can send a HTTP Basic Authorization Header, similar to the one in paragraph 5 File Storage URL. The user name is "replicator".
Response in case of successfully deleting a call (non-recursively):
http://HOST:PORT/CallRecorder/Replicator?command=delete&replicationQueueName=Replication&password=PWD&callGuid=7d0b6426-ceaa-9012-4106-2d25f25dccfa
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CallRecording>
<LocalServerStatus>Call not found.</LocalServerStatus>
<LocalServerMessage>Call not found.</LocalServerMessage>
<Status>Call not found.</Status>
<Action>Delete</Action>
<CallRecordingId>7d0b6426-ceaa-9012-4106-2d25f25dccfa</CallRecordingId>
<Servers/>
</CallRecording>
Response in case the call doesn't exist or has already been deleted (non-recursively):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CallRecording>
<LocalServerStatus>Call not found.</LocalServerStatus>
<LocalServerMessage>Call not found.</LocalServerMessage>
<Status>Call not found.</Status>
<Action>Delete</Action>
<CallRecordingId>7d0b6426-ceaa-9012-4106-2d25f25dccfa</CallRecordingId>
<Servers/>
</CallRecording>
Response in case the call exists on the main server and on two other replication branches
http://10.1.0.131:80/CallRecorder/Replicator?command=delete&replicationQueueName=Replication&password=PWD&callGuid=835f6c9a-bca9-8b82-05e6-76b1d9b2a7d9&recursive=true
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CallRecording>
<LocalServerStatus>Success</LocalServerStatus>
<LocalServerMessage>Success</LocalServerMessage>
<Status>Success</Status>
<Action>Delete</Action>
<CallRecordingId>835f6c9a-bca9-8b82-05e6-76b1d9b2a7d9</CallRecordingId>
<Servers>
<ServerStatus>
<Status>Success</Status>
<IpPort>10.1.0.117:80</IpPort>
<Msg>Success</Msg>
</ServerStatus>
<ServerStatus>
<Status>Success</Status>
<IpPort>10.1.0.113:80</IpPort>
<Msg>Success</Msg>
</ServerStatus>
</Servers>
</CallRecording>