Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Offline history

Metoda dostępna pod adresem: /ch.ashx . 

This method allows you to download the history of conversations and messages for a given user. This method contains two parameters: cm and pm. The cm parameter describes the name of the method, while the pm parameter describes the parameters of a given method. The following methods are available within conversation history: setRead, setDownloaded, delRecord, getList.

Authorization

The method requires authorization using basic authentication. Please use your SIP account login and password.

Method description:

Mark the list of records as read

Each record in the history has a field called "new" with values 0 or 1. All new records are set to "new" = 1. To change the status of a given message or group of messages to 0, i.e. read, you need to call the ch.ashx method with the parameters:

...

Parameter

...

Description

...

cm

...

parameter specifies the name of the method. If the status changes, set the "setRead" value

...

Download the conversation list

curl --location --request POST 'https://xxxxxxxxx/emcd/ch.ashx?cm=getList' \
--header 'User-Agent: vippie;ios;1.2.3' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic cGlvdHI6d21od3JzMmpmbw==' \
--header 'X-VIPPIE-DEVICE-ID: ff66fc693846285d' \
--header 'X-VIPPIE-DEVICE-NAME: iPhone8,1'

...

Offline history

Metoda dostępna pod adresem: /ch.ashx . 

This method allows you to download the history of conversations and messages for a given user. This method contains two parameters: cm and pm. The cm parameter describes the name of the method, while the pm parameter describes the parameters of a given method. The following methods are available within conversation history: setRead, setDownloaded, delRecord, getList.

Authorization

The method requires authorization using basic authentication. Please use your SIP account login and password.

Method description:

Mark the list of records as read

Each record in the history has a field called "new" with values 0 or 1. All new records are set to "new" = 1. To change the status of a given message or group of messages to 0, i.e. read, you need to call the ch.ashx method with the parameters:

Parameter

Description

cm

parameter specifies the name of the method. If the status changes, set the "setRead" value

pma JSON object containing an array of identifiers which messages should have their status changed to read. Example {"id":[1000685,1192075]} where 1000685 and 1192075 are the record IDs


Downloading history for the first time:

(remember to send empty If-Modified-Since this parameter will be used in all the next request to ch.ashx)



curl --location --request POST 'https://xxxxxxxxxx/emcd/ch.ashx?cm=getList' \
--header 'User-Agent: vippie;ios;1.2.3' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic NDg2MDAzNTUzNjE6cGlvdHJJT1M=' \
--header 'X-VIPPIE-DEVICE-ID: 637' \
--header 'X-VIPPIE-DEVICE-NAME: iPhone8,1' \
--header 'If-Modified-Since;' \
--header 'Range: records=0-10000' \
--header 'X-Check-Threads;' \

Response :

Code Block
[
    {
        "id": 1405573,
        "new": 1,
        "rs": "1000225",
        "dn": "48130313058",
        "s": "v",
        "sn": "on",
        "sb": "in",
        "dts": "2014-02-21T09:46:14",
        "dte": "",
        "mid": "",
        "mb": "",
        "cd": 0
    },
    {
        "id": 14055731174223,
        "new": 1,
        "rs": "10002251317111",
        "dn": "48130313058vippie ID",
        "s": "vm",
        "sn": "on",
        "sb": "out",
        "dts": "2014-03-05T14:24:34",
           "sb": "in",
        "dts": "2014-02-21T09:46:14",
        "dte": "",
        "mid": "",
        "mb": "",
        "cd": 0
    }, "dte": "2014-03-05T14:24:35",
        "mid": "35635",
        "mb": "Message content",
        "cd": 0
    },
....
]

where:

id - identifier of a given message in the conversation history

new - message status: 1 - unread, 0 - read

rs - resource - in the case of source onnet it is the sip login, in the case of offnet it is the caller ID of the caller.

dn - display name

s - source, available values: c - call, f - call failed, m - message, v - voicemail, s - SIPLINK_COMMAND

sn - source network, available values: on -> on-net or off -> off-net

sb - source box, available values: in or out

sdt - event date - in the case of calls, this is the date the call ended.

mid - message id - message ID sent by dialer in the sip message body

mb - message body -Message content

ms - message status - available values s - sent, d - delivered, r - read, c - deleted

cd - call duration - connection length in seconds.

cid - Call Id

fa - FlagArchive
fs - FlagStarred
fd - FlagDeleted

Retrieving the conversation list by modification date

To download the history, call the ch.ashx method with the cm=getList parameter and additionally set the If-Modified-Since and Range headers.

  • The If-Modified-Since header instructs the server to send records only if they have been modified since a given date. If the data has not changed, the server should send the response code 304 - HTTP STATUS: 304 Not Modified, otherwise the server will return a list of records in the form of a JSON array.
  • The Range header specifies what part of the data the dialer expects. This header should be provided in the format records=start_position-end_position. If the dialer does not send the Range header, the server will default to records=0-99, i.e. it will return the first 100 records.

Example - retrieving records without specifying If-Modified-Since and Range:

Code Block
titleRequest
Request body
cm=getList


Code Block
titleResponse
Content-Range: records 0-99/5124
Last-Modified: Tue, 21 Nov 2014 12:45:26 GMT
 
Response body
[
    {
        "id": 11742231405573,
        "new": 1,
        "rs": "13171111000225",
        "dn": "vippie ID48130313058",
        "s": "mv",
        "sn": "on",
        "sb": "outin",
        "dts": "2014-0302-05T1421T09:2446:3414",
        "dte": "2014-03-05T14:24:35",
        "mid": "35635",
        "mb": "Message content",
        "cd": 0
    },
....
]

where:

id - identifier of a given message in the conversation history

new - message status: 1 - unread, 0 - read

rs - resource - in the case of source onnet it is the sip login, in the case of offnet it is the caller ID of the caller.

dn - display name

s - source, available values: c - call, f - call failed, m - message, v - voicemail, s - SIPLINK_COMMAND

sn - source network, available values: on -> on-net or off -> off-net

sb - source box, available values: in or out

sdt - event date - in the case of calls, this is the date the call ended.

mid - message id - message ID sent by dialer in the sip message body

mb - message body -Message content

ms - message status - available values s - sent, d - delivered, r - read, c - deleted

cd - call duration - connection length in seconds.

Retrieving the conversation list by modification date

...


    {
        "id": 1174223,
        "new": 1,
        "rs": "1317111",
        "dn": "vippie ID",
        "s": "m",
        "sn": "on",
        "sb": "out",
        "dts": "2014-03-05T14:24:34",
        "dte": "2014-03-05T14:24:35",
        "mid": "35635",
        "mb": "tre?? wiadomo?ci",
        "cd": 0
    },
....
]
 


If-Modified-Since and Range

...

  • The If-Modified-Since header instructs the server to send records only if they have been modified since a given date. If the data has not changed, the server should send the response code 304 - HTTP STATUS: 304 Not Modified, otherwise the server will return a list of records in the form of a JSON array.
  • The Range header specifies what part of the data the dialer expects. This header should be provided in the format records=start_position-end_position. If the dialer does not send the Range header, the server will default to records=0-99, i.e. it will return the first 100 records.

Example - retrieving records without specifying If-Modified-Since and Range:

Code Block
titleRequest
Request body
cm=getList

...

titleResponse

...

Everytime when the app is started you have to send the request to ch.ashx to check if nothing has changed in the history and for this use header If-Modified-Since :

You have to remember when the previous request was sent to check is something has changed on the account since the last hitory check.

The previous request was sent by the app 2025-01-28 09:40:46 on the server we see 1 milisecond later time as those are server logs (2025-01-28 09:40:47,342)

Now in the next request take remembered time of last request and put it in If-Modified-Since header in this format:

day of a week, date GMT

Tue, 28 Jan 2025 09:40:46 GMT


curl --location --request POST 'https://xxxxxxx/emcd/ch.ashx?cm=getList' \
--header 'User-Agent: vippie;ios;1.2.3' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic NDg2MDAzNTUzNjE6cGlvdHJJT1M=' \
--header 'X-VIPPIE-DEVICE-ID: 637' \
--header 'X-VIPPIE-DEVICE-NAME: iPhone8,1' \
--header 'If-Modified-Since: Tue, 28 Jan 2025 09:40:46 GMT' \
--header 'Range: records=0-10000' \
--header 'X-Check-Threads;' \


logs from EMCD API
2025-01-28 09:56:58,912 46.205.197.141 48666777888 3F96B4B5BB50B603575AAA6B INFO HistoryHandler > [gzip, deflate, br]|POST|/emcd/ch.ashx|cm=getList
2025-01-28 09:56:58,913 46.205.197.141 48666777888 3F96B4B5BB50B603575AAA6B DEBUG HistoryHandler - X-VIPPIE-DEVICE-ID:637, X-VIPPIE-DEVICE-NAME:iPhone9,3
2025-01-28 09:56:58,913 46.205.197.141 48666777888 3F96B4B5BB50B603575AAA6B DEBUG HistoryHandler - If-Modified-Since:Tue, 28 Jan 2025 09:40:46 GMT, Range:records=0-10000, X-Check-Threads:
2025-01-28 09:56:59,052 46.205.197.141 48666777888 3F96B4B5BB50B603575AAA6B DEBUG HistoryHandler - Response header(s):Last-modified:Tue, 28 Jan 2025 09:40:46 GMT
2025-01-28 09:56:59,053 46.205.197.141 48666777888 3F96B4B5BB50B603575AAA6B INFO HistoryHandler < 200|application/json|[]


If nothing has changed on the account you will get an empty response , if something has changed you will get the history


POST /history

Description

Download the conversation list.

Parameters

NameLocated inDescriptionRequiredExample
AuthorizationheaderBasic authorization. SIP login and SIP password requiredyesBasic aHR0cHdhdGNoOmY=
User-AgentheaderDialer identifier in the form custom-name,operating-system,application-versionnovippie;ios;2.1.9
If-Modified-SinceheaderNagłówek The If-Modified-Since nakazuje serwerowi przesłać rekordy tylko jeżeli zostać zmodyfikowany od danej daty. Jeżeli dane się nie zmieniły serwer powinien wysłać kod odpowiedzi 304 - HTTP STATUS: 304 Not header tells the server to send records only if they have been modified since a given date. If the data has not changed, the server should send a response code of 304 - HTTP STATUS: 304 Not Modifiedno
RangeheaderThe Range header specifies what portion of the data the dialer expects. This header should be in the format records=start_position-end_position. If the dialer does not send the Range header, the server will default to records=0-99, i.e. it will return the first 100 records.no
X-Check-Threadsheader
no
cmbodymethod name - getListyes
pmbody

method parameters - JSON object

Code Block
languagejs
{
 "th" : true,
 "rs" : "sip_login",
 "gid": 123,
 "sn" : "on",
 "sdt": "2018-03-02T18:00:20"
}
 

where:

NameTypeDescription
thboolthread - events grouped by threads
rsstringresource - in the case of source onnet it is the sip login, in the case of offnet it is the caller ID of the caller
snstringsource network, available values: on -> on-net or off -> off-net
gidnumbergroup id
sdtstringevent date


no


Code Block
languagejs
titleThread list
{
 "th":true 
}
 


Code Block
languagejs
titleevent list (for a login)
{
 "rs":"sip_login",
 "sn":"on"
}


Code Block
languagejs
titleevent list (for a login) older than 2018-01-20 20:20:11
{
 "rs":"sip_login",
 "sn":"on",
 "sdt":"2018-01-20T20:20:11"
}


Code Block
languagejs
titleEvent list (for a group)
{
 "gid":123
}


Code Block
languagejs
titleGetting a list of events in a thread (for a group)
{
 "gid":123,
 "sdt":"2018-01-20T20:20:11"
}



Responses

CodeContent-TypeDescriptionSchema
200


304


200


200


200



...