How to create a duplicate number warning message when creating a new customer from POS?

This week I tried a custom script from doctype Customer regarding warning messages when mobile_no are duplicates, but it still failed.

frappe.ui.form.on('Customer', {
    before_save: function(frm) {
        let mobile_numbers = frm.doc.phone_nos || [];

        // Periksa setiap nomor telepon di Contact Numbers
        for (let row of mobile_numbers) {
            if (row.mobile_no) {
                frappe.call({
                    method: "frappe.client.get_list",
                    args: {
                        doctype: "Contact",
                        filters: {
                            phone: row.phone,  // Cek nomor telepon di field phone
                            customer: ["!=", frm.doc.name]  // Abaikan customer saat ini
                        },
                        fields: ["name", "customer"],
                        limit_page_length: 1
                    },
                    async: false,  // Synchronous untuk menghentikan penyimpanan jika duplikat
                    callback: function(response) {
                        if (response.message && response.message.length > 0) {
                            frappe.throw(__('The Mobile Number "{0}" in Contact Numbers is already associated with Customer: {1}', 
                                [row.phone, response.message[0].customer]));
                        }
                    }
                });
            }
        }
    }
});

Reference: How to check duplicate record? - #2 by NCP