Author Topic: CAM XML Interface for 3rd party software  (Read 8760 times)

sergey

  • Moderator
  • Sr. Member
  • *****
  • Offline Offline
  • Posts: 48
    • View Profile
CAM XML Interface for 3rd party software
« on: August 24, 2005, 08:32:21 AM »
Communication between CAM and 3rd party software is done by sending HTTP POST requests and getting responses containing requested data in XML format.

Request
The 3rd party software issues the HTTP request with the following pieces of information:
1) LastID - Unique CDR ID indicating the LAST ID that the software already has captured. This assumes that the IDs are sequential for ALL CDR regardless of the extension. If the software sends LastID as 0, this means that CAM will need to return ALL CDRs generated/created after TimeStamp (see below).
2) Extension - The Extension for which the software is requesting ALL CDRs whose unique CDR ID is greater than LastID (as described above)
3) TimeStamp - the software ONLY wants CDRs for the given Extension whose CDR is later than the given timestamp. If LastID is NOT 0,then the query will  return ALL CDRs whose creation date is later than TimeStamp and whose UniqueID is greater than LastID (see the above).

Response
The response will be an XML return where each CDR has the following data:
1) Extension - The originating extension
2) CO - the CO that was used to deliver the call
3) Destination - The number that was dialed
4) UniqueID - the unique ID of this specific CDR (Call detail record)
5) TimeOfCall (date/time)
6) Duration (in seconds)
7) CostofCall - the cost of this call as calculated per rate tables; this assumes that we can have different rates calculated based on which CO was used

Note: CAM returns a MAX of 500 records and the 3rd party software should make a second request if CAM maxed out at 500


Implementation of the interface
There are 2 pages in HTML folder related to the XML interface:
 - getXML.html page, this page is XML generator itself
 - testXML.htm page, this page is used to test the generator and get familiar with it's parameters
 
Use testXML.htm page to issue test POST requests to the XML generator. To access testXML.htm page enter http://localhost:<port>/testXML.htm in browser address field. Here <port> is placeholder for IP port, which CAM service listens on.

CAM accepts HTTP requests only from IE 5.5 or above
There are 2 workarounds for this issue:
1. Emulate User-Agent header sent by IE 5.5 and higher
2. Disable checking of user agent header in CAM:
 - open Configuration/Web Config page
 - mark/unmark Check User Agent on the page


Below are the examples of HTTP POST requests to the getXML.html page
POST /getXML.html HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
Referer: http://localhost:2265/testXML.htm
Accept-Language: english
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Host: localhost:2265
Content-Length: 46
Connection: Keep-Alive
Cache-Control: no-cache

LastID=123&Extension=200&TimeStamp=19+May+2005

POST /getXML.html HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*
Referer: http://localhost:2265/testXML.htm
Accept-Language: english
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Host: localhost:2265
Content-Length: 29
Connection: Keep-Alive
Cache-Control: no-cache

LastID=&Extension=&TimeStamp=
« Last Edit: August 25, 2005, 11:58:53 AM by Administrator »