Caller ID

As people recognize names more than numbers, it’s a good thing if your integration retrieves the caller identity, which can be implemented either when adding the notification about the call using the call event method. This method performs a search for the caller ID and creates a notification connected to the card with this phone number if it exists, or using the search by phone method if another way were used for notifications.

Each way uses a different algorithm to perform the search, and each one considers a different number of digits from the phone number as an input to the search process. The call event uses the last 8 digits and searches first for a contact then for a company. It may return a lead/customer according to the case. While the search by phone method uses the last 7 digits and searches first for a company then for a contact. It also may return a lead/customer according to different considerations.

All details about both methods are clearly explained in the call event from the call notification API and the caller ID API.

Here is an example about applying the search by phone method in the UI.

search: function (phone, callbacks) {
  callbacks = callbacks || {};
  callbacks.success = callbacks.success || function () {
	};
  phone = phone ? phone.toString() : '';
  if (phone.length > 0) {
	$.ajax(
	  '/api/v2/search/by_phone',
	  {
		method: 'GET',
		data: {
		  query: phone,
		  type: 'all'
		},
		timeout: 1000 * 5,
		complete: function (data, status) {
		  if (status != 'timeout') {
			data = data.responseJSON || false;
			if (typeof data == 'object') {
			  data = data.response.contacts[0];
			} else {
			  data = false;
			}
			callbacks.success(data);
		  }
		}
	  }
	);
  }
}

Next assign extensions to managers use case.