fix: Update call summary dialog
diff --git a/erpnext/crm/call_summary/call_summary_utils.py b/erpnext/crm/call_summary/call_summary_utils.py
index 5814e2b..49491d5 100644
--- a/erpnext/crm/call_summary/call_summary_utils.py
+++ b/erpnext/crm/call_summary/call_summary_utils.py
@@ -6,10 +6,10 @@
 	contacts = frappe.get_all('Contact', or_filters={
 		'phone': ['like', '%{}'.format(phone_number)],
 		'mobile_no': ['like', '%{}'.format(phone_number)]
-	}, fields=['*'])
+	}, fields=['name'])
 
 	if contacts:
-		return contacts[0]
+		return frappe.get_doc(contacts[0].name)
 
 @frappe.whitelist()
 def get_last_communication(phone_number, customer=None):
diff --git a/erpnext/crm/call_summary/exotel_call_handler.py b/erpnext/crm/call_summary/exotel_call_handler.py
index 82c925d..a0c3b7d 100644
--- a/erpnext/crm/call_summary/exotel_call_handler.py
+++ b/erpnext/crm/call_summary/exotel_call_handler.py
@@ -2,11 +2,42 @@
 
 @frappe.whitelist(allow_guest=True)
 def handle_request(*args, **kwargs):
-	r = frappe.request
+	# r = frappe.request
 
-	payload = r.get_data()
+	# print(r.args.to_dict(), args, kwargs)
 
-	print(r.args.to_dict())
-	print(payload)
+	incoming_phone_number = kwargs.get('CallFrom')
+	contact = get_contact_doc(incoming_phone_number)
+	last_communication = get_last_communication(incoming_phone_number, contact)
 
-	frappe.publish_realtime('incoming_call', r.args.to_dict())
\ No newline at end of file
+	data = {
+		'contact': contact,
+		'call_payload': kwargs,
+		'last_communication': last_communication
+	}
+
+	frappe.publish_realtime('incoming_call', data)
+
+
+def get_contact_doc(phone_number):
+	phone_number = phone_number[-10:]
+	number_filter = {
+		'phone': ['like', '%{}'.format(phone_number)],
+		'mobile_no': ['like', '%{}'.format(phone_number)]
+	}
+	contacts = frappe.get_all('Contact', or_filters=number_filter,
+		fields=['name'], limit=1)
+
+	if contacts:
+		return frappe.get_doc('Contact', contacts[0].name)
+
+	leads = frappe.get_all('Leads', or_filters=number_filter,
+		fields=['name'], limit=1)
+
+	if leads:
+		return frappe.get_doc('Lead', leads[0].name)
+
+
+def get_last_communication(phone_number, contact):
+	# frappe.get_all('Communication', filter={})
+	return {}
diff --git a/erpnext/public/js/call_popup/call_summary_dialog.js b/erpnext/public/js/call_popup/call_summary_dialog.js
index 9909b70..e9823ee 100644
--- a/erpnext/public/js/call_popup/call_summary_dialog.js
+++ b/erpnext/public/js/call_popup/call_summary_dialog.js
@@ -1,42 +1,46 @@
 class CallSummaryDialog {
-	constructor(opts) {
-		this.number = opts.number;
+	constructor({ contact, call_payload, last_communication }) {
+		this.number = call_payload.CallFrom;
+		this.contact = contact;
+		this.last_communication = last_communication;
 		this.make();
 	}
 
 	make() {
-		var d = new frappe.ui.Dialog({
-			'title': `Incoming Call: ${this.number}`,
+		this.dialog = new frappe.ui.Dialog({
+			'title': __(`Incoming call from ${this.contact ? this.contact.name : 'Unknown Number'}`),
+			'static': true,
+			'minimizable': true,
 			'fields': [{
 				'fieldname': 'customer_info',
 				'fieldtype': 'HTML'
 			}, {
 				'fieldtype': 'Section Break'
 			}, {
-				'fieldtype': 'Text',
+				'fieldtype': 'Small Text',
 				'label': "Last Communication",
 				'fieldname': 'last_communication',
-				'default': 'This is not working please helpppp',
-				'placeholder': __("Select or add new customer"),
-				'readonly': true
+				'read_only': true
 			}, {
 				'fieldtype': 'Column Break'
 			}, {
-				'fieldtype': 'Text',
+				'fieldtype': 'Small Text',
 				'label': 'Call Summary',
 				'fieldname': 'call_communication',
 				'default': 'This is not working please helpppp',
 				"placeholder": __("Select or add new customer")
+			}, {
+				'fieldtype': 'Button',
+				'label': 'Submit',
+				'click': () => {
+					frappe.xcall()
+				}
 			}]
 		});
-		// this.body.html(this.get_dialog_skeleton());
-		frappe.xcall('erpnext.crm.call_summary.call_summary_utils.get_contact_doc', {
-			phone_number: this.number
-		}).then(res => {
-			this.make_customer_contact(res, d.fields_dict["customer_info"].$wrapper);
-			// this.make_last_communication_section();
-		});
-		d.show();
+		this.make_customer_contact();
+		this.dialog.show();
+		this.dialog.get_close_btn().show();
+		this.dialog.header.find('.indicator').removeClass('hidden').addClass('blue');
 	}
 
 	get_dialog_skeleton() {
@@ -56,16 +60,23 @@
 			</div>
 		`;
 	}
-	make_customer_contact(res, wrapper) {
-		if (!res) {
+
+	make_customer_contact() {
+		const wrapper = this.dialog.fields_dict["customer_info"].$wrapper;
+		const contact = this.contact;
+		const customer = this.contact.links ? this.contact.links[0] : null;
+		const customer_link = customer ? frappe.utils.get_form_link(customer.link_doctype, customer.link_name, true): '';
+		if (!contact) {
 			wrapper.append('<b>Unknown Contact</b>');
 		} else {
 			wrapper.append(`
-				<img src="${res.image}">
-				<div class='flex-column'>
-					<span>${res.first_name} ${res.last_name}</span>
-					<span>${res.mobile_no}</span>
-					<span>Customer: <b>Some Enterprise</b></span>
+				<div class="customer-info flex">
+					<img src="${contact.image}">
+					<div class='flex-column'>
+						<span>${contact.first_name} ${contact.last_name}</span>
+						<span>${contact.mobile_no}</span>
+						${customer_link}
+					</div>
 				</div>
 			`);
 		}
@@ -91,11 +102,8 @@
 	}
 }
 
-$(document).on('app_ready', function() {
+$(document).on('app_ready', function () {
 	frappe.realtime.on('incoming_call', data => {
-		const number = data.CallFrom;
-		frappe.call_summary_dialog = new CallSummaryDialog({
-			number
-		});
+		frappe.call_summary_dialog = new CallSummaryDialog(data);
 	});
 });
diff --git a/erpnext/public/less/call_summary.less b/erpnext/public/less/call_summary.less
index 73f6fd4..0ec2066 100644
--- a/erpnext/public/less/call_summary.less
+++ b/erpnext/public/less/call_summary.less
@@ -2,5 +2,6 @@
 	img {
 		width: auto;
 		height: 100px;
+		margin-right: 15px;
 	}
 }
\ No newline at end of file