From d4f1a5f7a0889f5f96fd3c790215d9eec11e9aa8 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 13 Dec 2010 21:29:02 +0100 Subject: [PATCH] Check that the user has a callerID. Thanks to Bernat Brunet from NaN for pointing this out. --- asterisk_click2dial/asterisk_click2dial.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/asterisk_click2dial/asterisk_click2dial.py b/asterisk_click2dial/asterisk_click2dial.py index da7988c..0897ffd 100644 --- a/asterisk_click2dial/asterisk_click2dial.py +++ b/asterisk_click2dial/asterisk_click2dial.py @@ -218,6 +218,10 @@ class asterisk_server(osv.osv): if not user.internal_number: raise osv.except_osv(_('Error :'), _('No internal phone number configured for the current user')) + # The user should also have a CallerID + if not user.callerid: + raise osv.except_osv(_('Error :'), _('No callerID configured for the current user')) + # Convert the phone number in the format that will be sent to Asterisk ast_number = self.reformat_number(cr, uid, ids, erp_number, ast_server, context=context) logger.notifyChannel('asterisk_click2dial', netsvc.LOG_DEBUG, 'User dialing : channel = ' + user.asterisk_chan_type + '/' + user.internal_number + ' - Callerid = ' + user.callerid)