From 232fefac7935aee0d648c6cbf581f7e3463cf11e Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 26 Aug 2014 00:25:27 +0200 Subject: [PATCH] Feature "Open Calling Partner" replaced by "Open Caller", with a completely new behavior As a consequence, the modules asterisk_click2dial_event and asterisk_click2dial_crm_claim have been dropped New wizard "Number not found" (inspired by the old "Open Calling Partner" with many enhancements), which is called by base_phone_popup and Open Caller Formatting of number for click2dial is now handled by the phonenumbers lib: as a consequence, 3 fields have been dropped from asterisk.server (national_prefix, international_prefix, country_prefix) New option 'dial_button_invisible' in the phone widget New sample script asterisk_click2dial/scripts/openerp_popup_timeout.sh Update translations and some module descriptions All the modules are now PEP8 compliant --- asterisk_click2dial/__init__.py | 2 +- asterisk_click2dial/__openerp__.py | 60 ++- asterisk_click2dial/asterisk_click2dial.py | 476 ++++++++++-------- .../asterisk_click2dial_demo.xml | 1 - asterisk_click2dial/asterisk_server_view.xml | 4 - .../controller.py | 18 +- .../i18n/asterisk_click2dial.pot | 367 +++++--------- asterisk_click2dial/i18n/fr.po | 413 +++++---------- .../scripts/openerp_popup_timeout.sh | 27 + asterisk_click2dial/scripts/set_name_agi.py | 77 ++- .../static/src/css/asterisk_click2dial.css | 4 +- .../static/src/js/asterisk_click2dial.js | 58 ++- .../static/src/xml/asterisk_click2dial.xml | 8 +- asterisk_click2dial/wizard/__init__.py | 22 - .../wizard/open_calling_partner.py | 223 -------- .../wizard/open_calling_partner_view.xml | 51 -- asterisk_click2dial_crm/__openerp__.py | 1 - .../asterisk_click2dial_crm.py | 11 +- .../i18n/asterisk_click2dial_crm.pot | 7 +- asterisk_click2dial_crm/i18n/fr.po | 7 +- .../wizard/create_crm_phonecall.py | 12 - .../wizard/open_calling_partner_view.xml | 24 - asterisk_click2dial_crm_claim/__openerp__.py | 46 -- .../wizard/__init__.py | 23 - .../wizard/open_calling_partner.py | 32 -- .../wizard/open_calling_partner_view.xml | 24 - asterisk_click2dial_event/__openerp__.py | 43 -- asterisk_click2dial_event/wizard/__init__.py | 22 - .../wizard/open_calling_partner.py | 31 -- .../wizard/open_calling_partner_view.xml | 23 - base_phone/__openerp__.py | 1 + base_phone/base_phone.py | 7 +- base_phone/i18n/base_phone.pot | 115 ++++- base_phone/i18n/fr.po | 121 ++++- base_phone/static/src/js/phone_widget.js | 88 ++-- base_phone/wizard/__init__.py | 1 + base_phone/wizard/number_not_found.py | 130 +++++ base_phone/wizard/number_not_found_view.xml | 55 ++ ...sterisk_popup.pot => base_phone_popup.pot} | 25 +- base_phone_popup/i18n/fr.po | 32 +- base_phone_popup/popup.py | 11 + crm_phone/__init__.py | 1 + crm_phone/__openerp__.py | 1 + crm_phone/i18n/crm_phone.pot | 112 +++++ crm_phone/i18n/fr.po | 112 +++++ .../wizard}/__init__.py | 6 +- crm_phone/wizard/number_not_found.py | 105 ++++ crm_phone/wizard/number_not_found_view.xml | 36 ++ 48 files changed, 1596 insertions(+), 1480 deletions(-) rename asterisk_click2dial_crm_claim/__init__.py => asterisk_click2dial/controller.py (65%) create mode 100755 asterisk_click2dial/scripts/openerp_popup_timeout.sh delete mode 100644 asterisk_click2dial/wizard/__init__.py delete mode 100644 asterisk_click2dial/wizard/open_calling_partner.py delete mode 100644 asterisk_click2dial/wizard/open_calling_partner_view.xml delete mode 100644 asterisk_click2dial_crm/wizard/open_calling_partner_view.xml delete mode 100644 asterisk_click2dial_crm_claim/__openerp__.py delete mode 100644 asterisk_click2dial_crm_claim/wizard/__init__.py delete mode 100644 asterisk_click2dial_crm_claim/wizard/open_calling_partner.py delete mode 100644 asterisk_click2dial_crm_claim/wizard/open_calling_partner_view.xml delete mode 100644 asterisk_click2dial_event/__openerp__.py delete mode 100644 asterisk_click2dial_event/wizard/__init__.py delete mode 100644 asterisk_click2dial_event/wizard/open_calling_partner.py delete mode 100644 asterisk_click2dial_event/wizard/open_calling_partner_view.xml create mode 100644 base_phone/wizard/number_not_found.py create mode 100644 base_phone/wizard/number_not_found_view.xml rename base_phone_popup/i18n/{asterisk_popup.pot => base_phone_popup.pot} (52%) create mode 100644 crm_phone/i18n/crm_phone.pot create mode 100644 crm_phone/i18n/fr.po rename {asterisk_click2dial_event => crm_phone/wizard}/__init__.py (86%) create mode 100644 crm_phone/wizard/number_not_found.py create mode 100644 crm_phone/wizard/number_not_found_view.xml diff --git a/asterisk_click2dial/__init__.py b/asterisk_click2dial/__init__.py index 0b6064f..11a14a7 100644 --- a/asterisk_click2dial/__init__.py +++ b/asterisk_click2dial/__init__.py @@ -20,4 +20,4 @@ ############################################################################## from . import asterisk_click2dial -from . import wizard +from . import controller diff --git a/asterisk_click2dial/__openerp__.py b/asterisk_click2dial/__openerp__.py index 9e88d11..332e8bf 100644 --- a/asterisk_click2dial/__openerp__.py +++ b/asterisk_click2dial/__openerp__.py @@ -26,30 +26,49 @@ 'category': 'Phone', 'license': 'AGPL-3', 'summary': 'Asterisk-OpenERP connector', - 'description': """This module adds 3 functionalities : + 'description': """ +Asterisk-OpenERP connector +========================== -1) It adds a 'dial' button in the partner form view so that users can directly dial a phone number through Asterisk. This feature is usually known as 'click2dial'. Here is how it works : -. In OpenERP, the user clicks on the 'dial' button next to a phone number field in the partner view. -. OpenERP connects to the Asterisk Manager Interface and Asterisk makes the user's phone ring. -. The user answers his own phone (if he doesn't, the process stops here). -. Asterisk dials the phone number found in OpenERP in place of the user. -. If the remote party answers, the user can talk to his correspondent. +The technical name of this module is *asterisk_click2dial*, but this module implements much more than a simple *click2dial* ! This module adds 3 functionalities: + +1) It adds a *Dial* button in the partner form view so that users can directly dial a phone number through Asterisk. This feature is usually known as *click2dial*. Here is how it works : + + * In OpenERP, the user clicks on the *Dial* button next to a phone number field in the partner view. + + * OpenERP connects to the Asterisk Manager Interface and Asterisk makes the user's phone ring. + + * The user answers his own phone (if he doesn't, the process stops here). + + * Asterisk dials the phone number found in OpenERP in place of the user. + + * If the remote party answers, the user can talk to his correspondent. 2) It adds the ability to show the name of the calling party on the screen of your IP phone on incoming phone calls if the presented phone number is present in the partner/leads/employees/... of OpenERP. Here is how it works : -. On incoming phone calls, the Asterisk dialplan executes an AGI script "set_name_incoming_timeout.sh". -. The "set_name_incoming_timeout.sh" script calls the "set_name_agi.py" script with a short timeout. -. The "set_name_agi.py" script will make an XML-RPC request on the OpenERP server to try to find the name of the person corresponding to the phone number presented by the calling party. -. If it finds the name, it is set as the CallerID name of the call, so as to be presented on the IP phone of the user. -It also works on outgoing calls, so as to display the name of the callee on the SIP phone of the caller. For that, you should use the script "set_name_outgoing_timeout.sh". - -3) It adds a button "Open calling partner" in the menu "Sales > Address book" to get the partner corresponding to the calling party in one click. Here is how it works : -. When the user clicks on the "Open calling partner" button, OpenERP sends a query to the Asterisk Manager Interface to get a list of the current phone calls -. If it finds a phone call involving the user's phone, it gets the phone number of the calling party -. It searches the phone number of the calling party in the Partners of OpenERP. If a record matches, it shows the name of the related Partner and proposes to open it, or open its related sale orders or invoices. If no record matches, it proposes to create a new Contact with the presented phone number as 'Phone' or 'Mobile' number or update an existing Contact. -It is possible to get a pop-up of the partner corresponding to the calling party without any action from the user via the module *asterisk_popup*. - -A detailed documentation for this module is available on the Akretion Web site : http://www.akretion.com/en/products-and-services/openerp-asterisk-voip-connector """, + + * On incoming phone calls, the Asterisk dialplan executes an AGI script "set_name_incoming_timeout.sh". + + * The "set_name_incoming_timeout.sh" script calls the "set_name_agi.py" script with a short timeout. + + * The "set_name_agi.py" script will make an XML-RPC request on the OpenERP server to try to find the name of the person corresponding to the phone number presented by the calling party. + + * If it finds the name, it is set as the CallerID name of the call, so as to be presented on the IP phone of the user. + + It also works on outgoing calls, so as to display the name of the callee on the SIP phone of the caller. For that, you should use the script "set_name_outgoing_timeout.sh". + +3) It adds a phone icon (*Open Caller*) in the top menu bar (next to the Preferences) to get the partner/lead/candidate/registrations corresponding to the calling party in one click. Here is how it works : + + * When the user clicks on the phone icon, OpenERP sends a query to the Asterisk Manager Interface to get a list of the current phone calls + + * If it finds a phone call involving the user's phone, it gets the phone number of the calling party + + * It searches the phone number of the calling party in the Partners/Leads/Candidates/Registrations of OpenERP. If a record matches, it takes you to the form view of this record. If no record matchs, it opens a wizard which proposes to create a new Partner with the presented phone number as *Phone* or *Mobile* number or update an existing Partner. + + It is possible to get a pop-up of the record corresponding to the calling party without any action from the user via the module *base_phone_popup*. + +A detailed documentation for this module is available on the Akretion Web site : http://www.akretion.com/en/products-and-services/openerp-asterisk-voip-connector +""", 'author': 'Akretion', 'website': 'http://www.akretion.com/', 'depends': ['base_phone'], @@ -57,7 +76,6 @@ A detailed documentation for this module is available on the Akretion Web site : 'data': [ 'asterisk_server_view.xml', 'res_users_view.xml', - 'wizard/open_calling_partner_view.xml', 'security/ir.model.access.csv', ], 'demo': ['asterisk_click2dial_demo.xml'], diff --git a/asterisk_click2dial/asterisk_click2dial.py b/asterisk_click2dial/asterisk_click2dial.py index 950a905..fbb8250 100644 --- a/asterisk_click2dial/asterisk_click2dial.py +++ b/asterisk_click2dial/asterisk_click2dial.py @@ -25,88 +25,127 @@ import logging # Lib for phone number reformating -> pip install phonenumbers import phonenumbers # Lib py-asterisk from http://code.google.com/p/py-asterisk/ -# We need a version which has this commit : http://code.google.com/p/py-asterisk/source/detail?r=8d0e1c941cce727c702582f3c9fcd49beb4eeaa4 -# so a version after Nov 20th, 2012 +# -> pip install py-Asterisk from Asterisk import Manager _logger = logging.getLogger(__name__) + class asterisk_server(orm.Model): - '''Asterisk server object, to store all the parameters of the Asterisk IPBXs''' + '''Asterisk server object, stores the parameters of the Asterisk IPBXs''' _name = "asterisk.server" _description = "Asterisk Servers" _columns = { - 'name': fields.char('Asterisk server name', size=50, required=True, help="Asterisk server name."), - 'active': fields.boolean('Active', help="The active field allows you to hide the Asterisk server without deleting it."), - 'ip_address': fields.char('Asterisk IP addr. or DNS', size=50, required=True, help="IP address or DNS name of the Asterisk server."), - 'port': fields.integer('Port', required=True, help="TCP port on which the Asterisk Manager Interface listens. Defined in /etc/asterisk/manager.conf on Asterisk."), - 'out_prefix': fields.char('Out prefix', size=4, help="Prefix to dial to place outgoing calls. If you don't use a prefix to place outgoing calls, leave empty."), - 'national_prefix': fields.char('National prefix', size=4, help="Prefix for national phone calls (don't include the 'out prefix'). For e.g., in France, the phone numbers look like '01 41 98 12 42' : the National prefix is '0'."), - 'international_prefix': fields.char('International prefix', required=True, size=4, help="Prefix to add to make international phone calls (don't include the 'out prefix'). For e.g., in France, the International prefix is '00'."), - 'country_prefix': fields.char('My country prefix', required=True, size=4, help="Phone prefix of the country where the Asterisk server is located. For e.g. the phone prefix for France is '33'. If the phone number to dial starts with the 'My country prefix', OpenERP will remove the country prefix from the phone number and add the 'out prefix' followed by the 'national prefix'. If the phone number to dial doesn't start with the 'My country prefix', OpenERP will add the 'out prefix' followed by the 'international prefix'."), - 'login': fields.char('AMI login', size=30, required=True, help="Login that OpenERP will use to communicate with the Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf on your Asterisk server."), - 'password': fields.char('AMI password', size=30, required=True, help="Password that OpenERP will use to communicate with the Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf on your Asterisk server."), - 'context': fields.char('Dialplan context', size=50, required=True, help="Asterisk dialplan context from which the calls will be made. Refer to /etc/asterisk/extensions.conf on your Asterisk server."), - 'wait_time': fields.integer('Wait time (sec)', required=True, help="Amount of time (in seconds) Asterisk will try to reach the user's phone before hanging up."), - 'extension_priority': fields.integer('Extension priority', required=True, help="Priority of the extension in the Asterisk dialplan. Refer to /etc/asterisk/extensions.conf on your Asterisk server."), - 'alert_info': fields.char('Alert-Info SIP header', size=255, help="Set Alert-Info header in SIP request to user's IP Phone for the click2dial feature. If empty, the Alert-Info header will not be added. You can use it to have a special ring tone for click2dial (a silent one !) or to activate auto-answer for example."), - 'company_id': fields.many2one('res.company', 'Company', help="Company who uses the Asterisk server."), + 'name': fields.char('Asterisk Server Name', size=50, required=True), + 'active': fields.boolean( + 'Active', help="The active field allows you to hide the Asterisk " + "server without deleting it."), + 'ip_address': fields.char( + 'Asterisk IP address or DNS', size=50, required=True, + help="IP address or DNS name of the Asterisk server."), + 'port': fields.integer( + 'Port', required=True, + help="TCP port on which the Asterisk Manager Interface listens. " + "Defined in /etc/asterisk/manager.conf on Asterisk."), + 'out_prefix': fields.char( + 'Out Prefix', size=4, help="Prefix to dial to make outgoing " + "calls. If you don't use a prefix to make outgoing calls, " + "leave empty."), + 'login': fields.char( + 'AMI Login', size=30, required=True, + help="Login that OpenERP will use to communicate with the " + "Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf " + "on your Asterisk server."), + 'password': fields.char( + 'AMI Password', size=30, required=True, + help="Password that OpenERP will use to communicate with the " + "Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf " + "on your Asterisk server."), + 'context': fields.char( + 'Dialplan Context', size=50, required=True, + help="Asterisk dialplan context from which the calls will be " + "made. Refer to /etc/asterisk/extensions.conf on your Asterisk " + "server."), + 'wait_time': fields.integer( + 'Wait Time (sec)', required=True, + help="Amount of time (in seconds) Asterisk will try to reach " + "the user's phone before hanging up."), + 'extension_priority': fields.integer( + 'Extension Priority', required=True, + help="Priority of the extension in the Asterisk dialplan. Refer " + "to /etc/asterisk/extensions.conf on your Asterisk server."), + 'alert_info': fields.char( + 'Alert-Info SIP Header', size=255, + help="Set Alert-Info header in SIP request to user's IP Phone " + "for the click2dial feature. If empty, the Alert-Info header " + "will not be added. You can use it to have a special ring tone " + "for click2dial (a silent one !) or to activate auto-answer " + "for example."), + 'company_id': fields.many2one( + 'res.company', 'Company', + help="Company who uses the Asterisk server."), } - def _get_prefix_from_country(self, cr, uid, context=None): - user = self.pool['res.users'].browse(cr, uid, uid, context=context) - country_code = user.company_id and user.company_id.partner_id and user.company_id.partner_id.country_id and user.company_id.partner_id.country_id.code or False - default_country_prefix = False - if country_code: - default_country_prefix = phonenumbers.country_code_for_region(country_code) - return default_country_prefix - _defaults = { 'active': True, 'port': 5038, # Default AMI port - 'national_prefix': '0', - 'international_prefix': '00', - 'country_prefix': _get_prefix_from_country, 'extension_priority': 1, 'wait_time': 15, - 'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'asterisk.server', context=context), + 'company_id': lambda self, cr, uid, context: + self.pool['res.company']._company_default_get( + cr, uid, 'asterisk.server', context=context), } def _check_validity(self, cr, uid, ids): for server in self.browse(cr, uid, ids): - country_prefix = ('Country prefix', server.country_prefix) - international_prefix = ('International prefix', server.international_prefix) out_prefix = ('Out prefix', server.out_prefix) - national_prefix = ('National prefix', server.national_prefix) dialplan_context = ('Dialplan context', server.context) alert_info = ('Alert-Info SIP header', server.alert_info) login = ('AMI login', server.login) password = ('AMI password', server.password) - for digit_prefix in [country_prefix, international_prefix, out_prefix, national_prefix]: - if digit_prefix[1] and not digit_prefix[1].isdigit(): - raise orm.except_orm(_('Error :'), _("Only use digits for the '%s' on the Asterisk server '%s'" % (digit_prefix[0], server.name))) + if out_prefix[1] and not out_prefix[1].isdigit(): + raise orm.except_orm( + _('Error:'), + _("Only use digits for the '%s' on the Asterisk server " + "'%s'" % (out_prefix[0], server.name))) if server.wait_time < 1 or server.wait_time > 120: - raise orm.except_orm(_('Error :'), _("You should set a 'Wait time' value between 1 and 120 seconds for the Asterisk server '%s'" % server.name)) + raise orm.except_orm( + _('Error:'), + _("You should set a 'Wait time' value between 1 and 120 " + "seconds for the Asterisk server '%s'" % server.name)) if server.extension_priority < 1: - raise orm.except_orm(_('Error :'), _("The 'extension priority' must be a positive value for the Asterisk server '%s'" % server.name)) + raise orm.except_orm( + _('Error:'), + _("The 'extension priority' must be a positive value for " + "the Asterisk server '%s'" % server.name)) if server.port > 65535 or server.port < 1: - raise orm.except_orm(_('Error :'), _("You should set a TCP port between 1 and 65535 for the Asterisk server '%s'" % server.name)) - for check_string in [dialplan_context, alert_info, login, password]: - if check_string[1]: + raise orm.except_orm( + _('Error:'), + _("You should set a TCP port between 1 and 65535 for the " + "Asterisk server '%s'" % server.name)) + for check_str in [dialplan_context, alert_info, login, password]: + if check_str[1]: try: - string = check_string[1].encode('ascii') + check_str[1].encode('ascii') except UnicodeEncodeError: - raise orm.except_orm(_('Error :'), _("The '%s' should only have ASCII caracters for the Asterisk server '%s'" % (check_string[0], server.name))) + raise orm.except_orm( + _('Error:'), + _("The '%s' should only have ASCII caracters for " + "the Asterisk server '%s'" + % (check_str[0], server.name))) return True + _constraints = [( + _check_validity, + "Error message in raise", + [ + 'out_prefix', 'wait_time', 'extension_priority', 'port', + 'context', 'alert_info', 'login', 'password'] + )] - _constraints = [ - (_check_validity, "Error message in raise", ['out_prefix', 'country_prefix', 'national_prefix', 'international_prefix', 'wait_time', 'extension_priority', 'port', 'context', 'alert_info', 'login', 'password']), - ] - - - def _reformat_number(self, cr, uid, erp_number, ast_server, context=None): + def _reformat_number( + self, cr, uid, erp_number, ast_server=None, context=None): ''' This function is dedicated to the transformation of the number available in OpenERP to the number that Asterisk should dial. @@ -114,76 +153,26 @@ class asterisk_server(orm.Model): for your company if you are not happy with the way I reformat the OpenERP numbers. ''' - - error_title_msg = _("Invalid phone number") - invalid_international_format_msg = _("The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42") - invalid_national_format_msg = _("The phone number is not written in valid national format.") - invalid_format_msg = _("The phone number is not written in valid format.") - - # Let's call the variable tmp_number now - tmp_number = erp_number - _logger.debug('Number before reformat = %s' % tmp_number) - - # Check if empty - if not tmp_number: - raise orm.except_orm(error_title_msg, invalid_format_msg) - - # Before starting to use prefix, we convert empty prefix whose value - # is False to an empty string - country_prefix = ast_server.country_prefix or '' - national_prefix = ast_server.national_prefix or '' - international_prefix = ast_server.international_prefix or '' - out_prefix = ast_server.out_prefix or '' - - # Maybe one day we will use - # phonenumbers.format_out_of_country_calling_number(phonenumbers.parse(' 5: - if ast_server.international_prefix and number[0:len(ast_server.international_prefix)] == ast_server.international_prefix: - number = number[len(ast_server.international_prefix):] - number = '+' + number - elif ast_server.national_prefix and number[0:len(ast_server.national_prefix)] == ast_server.national_prefix: - number = number[len(ast_server.national_prefix):] - number = '+' + ast_server.country_prefix + number - return number - + if ast_server.out_prefix: + _logger.debug('Out prefix = %s' % ast_server.out_prefix) + to_dial_number = '%s%s' % (ast_server.out_prefix, to_dial_number) + _logger.debug('Number to be sent to Asterisk = %s' % to_dial_number) + return to_dial_number def _get_asterisk_server_from_user(self, cr, uid, context=None): '''Returns an asterisk.server browse object''' @@ -192,12 +181,19 @@ class asterisk_server(orm.Model): if user.asterisk_server_id.id: ast_server = user.asterisk_server_id else: - asterisk_server_ids = self.search(cr, uid, [('company_id', '=', user.company_id.id)], context=context) - # If no asterisk server is configured on the user, we take the first one + asterisk_server_ids = self.search( + cr, uid, [('company_id', '=', user.company_id.id)], + context=context) + # If the user doesn't have an asterisk server, + # we take the first one of the user's company if not asterisk_server_ids: - raise orm.except_orm(_('Error :'), _("No Asterisk server configured for the company '%s'.") % user.company_id.name) + raise orm.except_orm( + _('Error:'), + _("No Asterisk server configured for the company '%s'.") + % user.company_id.name) else: - ast_server = self.browse(cr, uid, asterisk_server_ids[0], context=context) + ast_server = self.browse( + cr, uid, asterisk_server_ids[0], context=context) return ast_server def _connect_to_asterisk(self, cr, uid, context=None): @@ -208,29 +204,40 @@ class asterisk_server(orm.Model): ''' user = self.pool['res.users'].browse(cr, uid, uid, context=context) - # Note : if I write 'Error' without ' :', it won't get translated... - # I don't understand why ! - - ast_server = self._get_asterisk_server_from_user(cr, uid, context=context) + ast_server = self._get_asterisk_server_from_user( + cr, uid, context=context) # We check if the current user has a chan type if not user.asterisk_chan_type: - raise orm.except_orm(_('Error :'), _('No channel type configured for the current user.')) + raise orm.except_orm( + _('Error:'), + _('No channel type configured for the current user.')) # We check if the current user has an internal number if not user.resource: - raise orm.except_orm(_('Error :'), _('No resource name configured for the current user')) - + raise orm.except_orm( + _('Error:'), + _('No resource name configured for the current user')) - _logger.debug("User's phone : %s/%s" % (user.asterisk_chan_type, user.resource)) - _logger.debug("Asterisk server = %s:%d" % (ast_server.ip_address, ast_server.port)) + _logger.debug( + "User's phone: %s/%s" % (user.asterisk_chan_type, user.resource)) + _logger.debug( + "Asterisk server: %s:%d" + % (ast_server.ip_address, ast_server.port)) # Connect to the Asterisk Manager Interface try: - ast_manager = Manager.Manager((ast_server.ip_address, ast_server.port), ast_server.login, ast_server.password) + ast_manager = Manager.Manager( + (ast_server.ip_address, ast_server.port), + ast_server.login, ast_server.password) except Exception, e: - _logger.error("Error in the request to the Asterisk Manager Interface %s" % ast_server.ip_address) + _logger.error( + "Error in the request to the Asterisk Manager Interface %s" + % ast_server.ip_address) _logger.error("Here is the error message: %s" % e) - raise orm.except_orm(_('Error :'), _("Problem in the request from OpenERP to Asterisk. Here is the error message: %s" % e)) + raise orm.except_orm( + _('Error:'), + _("Problem in the request from OpenERP to Asterisk. " + "Here is the error message: %s" % e)) return False return (user, ast_server, ast_manager) @@ -260,57 +267,90 @@ class asterisk_server(orm.Model): def _get_calling_number(self, cr, uid, context=None): - user, ast_server, ast_manager = self._connect_to_asterisk(cr, uid, context=context) + user, ast_server, ast_manager = self._connect_to_asterisk( + cr, uid, context=context) calling_party_number = False try: list_chan = ast_manager.Status() - #from pprint import pprint - #pprint(list_chan) + # from pprint import pprint + # pprint(list_chan) _logger.debug("Result of Status AMI request: %s", list_chan) for chan in list_chan.values(): sip_account = user.asterisk_chan_type + '/' + user.resource - if chan.get('ChannelState') == '4' and chan.get('ConnectedLineNum') == user.internal_number: # 4 = Ring + # 4 = Ring + if ( + chan.get('ChannelState') == '4' and + chan.get('ConnectedLineNum') == user.internal_number): _logger.debug("Found a matching Event in 'Ring' state") calling_party_number = chan.get('CallerIDNum') break - if chan.get('ChannelState') == '6' and sip_account in chan.get('BridgedChannel', ''): # 6 = Up + # 6 = Up + if ( + chan.get('ChannelState') == '6' + and sip_account in chan.get('BridgedChannel', '')): _logger.debug("Found a matching Event in 'Up' state") calling_party_number = chan.get('CallerIDNum') break # Compatibility with Asterisk 1.4 - if chan.get('State') == 'Up' and sip_account in chan.get('Link', ''): + if ( + chan.get('State') == 'Up' + and sip_account in chan.get('Link', '')): _logger.debug("Found a matching Event in 'Up' state") calling_party_number = chan.get('CallerIDNum') break except Exception, e: - _logger.error("Error in the Status request to Asterisk server %s" % ast_server.ip_address) - _logger.error("Here is the detail of the error : '%s'" % unicode(e)) - raise orm.except_orm(_('Error :'), _("Can't get calling number from Asterisk.\nHere is the error: '%s'" % unicode(e))) + _logger.error( + "Error in the Status request to Asterisk server %s" + % ast_server.ip_address) + _logger.error( + "Here are the details of the error: '%s'" % unicode(e)) + raise orm.except_orm( + _('Error:'), + _("Can't get calling number from Asterisk.\nHere is the " + "error: '%s'" % unicode(e))) finally: ast_manager.Logoff() - _logger.debug("The calling party number is '%s'" % calling_party_number) - + _logger.debug("Calling party number: '%s'" % calling_party_number) return calling_party_number + def get_record_from_my_channel(self, cr, uid, context=None): + calling_number = self.pool['asterisk.server']._get_calling_number( + cr, uid, context=context) + # calling_number = "0641981246" + if calling_number: + record = self.pool['phone.common'].get_record_from_phone_number( + cr, uid, calling_number, context=context) + if record: + return record + else: + return calling_number + else: + return False -# Parameters specific for each user class res_users(orm.Model): _inherit = "res.users" _columns = { - 'internal_number': fields.char('Internal number', size=15, + 'internal_number': fields.char( + 'Internal Number', size=15, help="User's internal phone number."), - 'dial_suffix': fields.char('User-specific dial suffix', size=15, - help="User-specific dial suffix such as aa=2wb for SCCP auto answer."), - 'callerid': fields.char('Caller ID', size=50, + 'dial_suffix': fields.char( + 'User-specific Dial Suffix', size=15, + help="User-specific dial suffix such as aa=2wb for SCCP " + "auto answer."), + 'callerid': fields.char( + 'Caller ID', size=50, help="Caller ID used for the calls initiated by this user."), - # You'd probably think : Asterisk should reuse the callerID of sip.conf ! - # But it cannot, cf http://lists.digium.com/pipermail/asterisk-users/2012-January/269787.html - 'cdraccount': fields.char('CDR Account', size=50, - help="Call Detail Record (CDR) account used for billing this user."), + # You'd probably think: Asterisk should reuse the callerID of sip.conf! + # But it cannot, cf + # http://lists.digium.com/pipermail/asterisk-users/2012-January/269787.html + 'cdraccount': fields.char( + 'CDR Account', size=50, + help="Call Detail Record (CDR) account used for billing this " + "user."), 'asterisk_chan_type': fields.selection([ ('SIP', 'SIP'), ('IAX2', 'IAX2'), @@ -322,15 +362,35 @@ class res_users(orm.Model): ('H323', 'H323'), ('SCCP', 'SCCP'), ('Local', 'Local'), - ], 'Asterisk channel type', - help="Asterisk channel type, as used in the Asterisk dialplan. If the user has a regular IP phone, the channel type is 'SIP'."), - 'resource': fields.char('Resource name', size=64, - help="Resource name for the channel type selected. For example, if you use 'Dial(SIP/phone1)' in your Asterisk dialplan to ring the SIP phone of this user, then the resource name for this user is 'phone1'. For a SIP phone, the phone number is often used as resource name, but not always."), - 'alert_info': fields.char('User-specific Alert-Info SIP header', size=255, help="Set a user-specific Alert-Info header in SIP request to user's IP Phone for the click2dial feature. If empty, the Alert-Info header will not be added. You can use it to have a special ring tone for click2dial (a silent one !) or to activate auto-answer for example."), - 'variable': fields.char('User-specific Variable', size=255, help="Set a user-specific 'Variable' field in the Asterisk Manager Interface 'originate' request for the click2dial feature. If you want to have several variable headers, separate them with '|'."), - 'asterisk_server_id': fields.many2one('asterisk.server', 'Asterisk server', - help="Asterisk server on which the user's phone is connected. If you leave this field empty, it will use the first Asterisk server of the user's company."), - } + ], 'Asterisk Channel Type', + help="Asterisk channel type, as used in the Asterisk dialplan. " + "If the user has a regular IP phone, the channel type is 'SIP'."), + 'resource': fields.char( + 'Resource Name', size=64, + help="Resource name for the channel type selected. For example, " + "if you use 'Dial(SIP/phone1)' in your Asterisk dialplan to ring " + "the SIP phone of this user, then the resource name for this user " + "is 'phone1'. For a SIP phone, the phone number is often used as " + "resource name, but not always."), + 'alert_info': fields.char( + 'User-specific Alert-Info SIP Header', size=255, + help="Set a user-specific Alert-Info header in SIP request to " + "user's IP Phone for the click2dial feature. If empty, the " + "Alert-Info header will not be added. You can use it to have a " + "special ring tone for click2dial (a silent one !) or to " + "activate auto-answer for example."), + 'variable': fields.char( + 'User-specific Variable', size=255, + help="Set a user-specific 'Variable' field in the Asterisk " + "Manager Interface 'originate' request for the click2dial " + "feature. If you want to have several variable headers, separate " + "them with '|'."), + 'asterisk_server_id': fields.many2one( + 'asterisk.server', 'Asterisk Server', + help="Asterisk server on which the user's phone is connected. " + "If you leave this field empty, it will use the first Asterisk " + "server of the user's company."), + } _defaults = { 'asterisk_chan_type': 'SIP', @@ -338,17 +398,28 @@ class res_users(orm.Model): def _check_validity(self, cr, uid, ids): for user in self.browse(cr, uid, ids): - for check_string in [('Resource name', user.resource), ('Internal number', user.internal_number), ('Caller ID', user.callerid)]: + strings_to_check = [ + (_('Resource Name'), user.resource), + (_('Internal Number'), user.internal_number), + (_('Caller ID'), user.callerid), + ] + for check_string in strings_to_check: if check_string[1]: try: - plom = check_string[1].encode('ascii') + check_string[1].encode('ascii') except UnicodeEncodeError: - raise orm.except_orm(_('Error :'), _("The '%s' for the user '%s' should only have ASCII caracters" % (check_string[0], user.name))) + raise orm.except_orm( + _('Error:'), + _("The '%s' for the user '%s' should only have " + "ASCII caracters") + % (check_string[0], user.name)) return True - _constraints = [ - (_check_validity, "Error message in raise", ['resource', 'internal_number', 'callerid']), - ] + _constraints = [( + _check_validity, + "Error message in raise", + ['resource', 'internal_number', 'callerid'] + )] class phone_common(orm.AbstractModel): @@ -360,59 +431,56 @@ class phone_common(orm.AbstractModel): _('Error:'), _('Missing phone number')) - user, ast_server, ast_manager = self.pool['asterisk.server']._connect_to_asterisk(cr, uid, context=context) + user, ast_server, ast_manager = \ + self.pool['asterisk.server']._connect_to_asterisk( + cr, uid, context=context) ast_number = self.pool['asterisk.server']._reformat_number( cr, uid, erp_number, ast_server, context=context) # The user should have a CallerID if not user.callerid: - raise orm.except_orm(_('Error :'), _('No callerID configured for the current user')) + raise orm.except_orm( + _('Error:'), + _('No callerID configured for the current user')) variable = [] if user.asterisk_chan_type == 'SIP': # We can only have one alert-info header in a SIP request if user.alert_info: - variable.append('SIPAddHeader=Alert-Info: ' + user.alert_info) + variable.append( + 'SIPAddHeader=Alert-Info: %s' % user.alert_info) elif ast_server.alert_info: - variable.append('SIPAddHeader=Alert-Info: ' + ast_server.alert_info) + variable.append( + 'SIPAddHeader=Alert-Info: %s' % ast_server.alert_info) if user.variable: for user_variable in user.variable.split('|'): variable.append(user_variable.strip()) + channel = '%s/%s' % (user.asterisk_chan_type, user.resource) + if user.dial_suffix: + channel += '/%s' % user.dial_suffix try: ast_manager.Originate( - user.asterisk_chan_type + '/' + user.resource + ( ('/' + user.dial_suffix) if user.dial_suffix else ''), - context = ast_server.context, - extension = ast_number, - priority = str(ast_server.extension_priority), - timeout = str(ast_server.wait_time*1000), - caller_id = user.callerid, - account = user.cdraccount, - variable = variable) + channel, + context=ast_server.context, + extension=ast_number, + priority=str(ast_server.extension_priority), + timeout=str(ast_server.wait_time * 1000), + caller_id=user.callerid, + account=user.cdraccount, + variable=variable) except Exception, e: - _logger.error("Error in the Originate request to Asterisk server %s" % ast_server.ip_address) - _logger.error("Here is the detail of the error : '%s'" % unicode(e)) - raise orm.except_orm(_('Error :'), _("Click to dial with Asterisk failed.\nHere is the error: '%s'" % unicode(e))) - + _logger.error( + "Error in the Originate request to Asterisk server %s" + % ast_server.ip_address) + _logger.error( + "Here are the details of the error: '%s'" % unicode(e)) + raise orm.except_orm( + _('Error:'), + _("Click to dial with Asterisk failed.\nHere is the error: " + "'%s'") + % unicode(e)) finally: ast_manager.Logoff() - return True - - def _prepare_incall_pop_action( - self, cr, uid, record_res, number, context=None): - # Not executed because this module doesn't depend on base_phone_popup - # TODO move to a dedicated module asterisk_popup ? - action = super(phone_common, self)._prepare_incall_pop_action( - cr, uid, record_res, number, context=context) - if not action: - action = { - 'name': _('No Partner Found'), - 'type': 'ir.actions.act_window', - 'res_model': 'wizard.open.calling.partner', - 'view_mode': 'form', - 'views': [[False, 'form']], # Beurk, but needed - 'target': 'new', - 'context': {'incall_number_popup': number} - } - return action + return {'dialed_number': ast_number} diff --git a/asterisk_click2dial/asterisk_click2dial_demo.xml b/asterisk_click2dial/asterisk_click2dial_demo.xml index c1f5ef2..80e76ac 100644 --- a/asterisk_click2dial/asterisk_click2dial_demo.xml +++ b/asterisk_click2dial/asterisk_click2dial_demo.xml @@ -12,7 +12,6 @@ Akretion Asterisk IPBX asterisk.akretion.com - 33 click2dial mypassword from-internal diff --git a/asterisk_click2dial/asterisk_server_view.xml b/asterisk_click2dial/asterisk_server_view.xml index 165826c..5c55a82 100644 --- a/asterisk_click2dial/asterisk_server_view.xml +++ b/asterisk_click2dial/asterisk_server_view.xml @@ -51,9 +51,6 @@ - - - @@ -72,7 +69,6 @@ - diff --git a/asterisk_click2dial_crm_claim/__init__.py b/asterisk_click2dial/controller.py similarity index 65% rename from asterisk_click2dial_crm_claim/__init__.py rename to asterisk_click2dial/controller.py index b76eb75..b48c66f 100644 --- a/asterisk_click2dial_crm_claim/__init__.py +++ b/asterisk_click2dial/controller.py @@ -1,9 +1,8 @@ -# -*- coding: utf-8 -*- +# -*- encoding: utf-8 -*- ############################################################################## # -# Asterisk Click2Dial CRM Claim module for OpenERP -# Copyright (C) 2012-2013 Akretion (http://www.akretion.com/) -# @author Alexis de Lattre +# Asterisk click2dial module for OpenERP +# Copyright (C) 2014 Alexis de Lattre (alexis@via.ecp.fr) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -20,4 +19,13 @@ # ############################################################################## -from . import wizard +import openerp + + +class AsteriskClick2dialController(openerp.addons.web.http.Controller): + _cp_path = '/asterisk_click2dial' + + @openerp.addons.web.http.jsonrequest + def get_record_from_my_channel(self, req): + res = req.session.model('asterisk.server').get_record_from_my_channel() + return res diff --git a/asterisk_click2dial/i18n/asterisk_click2dial.pot b/asterisk_click2dial/i18n/asterisk_click2dial.pot index f4212cd..04861ae 100644 --- a/asterisk_click2dial/i18n/asterisk_click2dial.pot +++ b/asterisk_click2dial/i18n/asterisk_click2dial.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-08-21 16:21+0000\n" -"PO-Revision-Date: 2014-08-21 16:21+0000\n" +"POT-Creation-Date: 2014-08-25 21:42+0000\n" +"PO-Revision-Date: 2014-08-25 21:42+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -17,12 +17,12 @@ msgstr "" #. module: asterisk_click2dial #: field:asterisk.server,login:0 -msgid "AMI login" +msgid "AMI Login" msgstr "" #. module: asterisk_click2dial #: field:asterisk.server,password:0 -msgid "AMI password" +msgid "AMI Password" msgstr "" #. module: asterisk_click2dial @@ -32,7 +32,7 @@ msgstr "" #. module: asterisk_click2dial #: field:asterisk.server,alert_info:0 -msgid "Alert-Info SIP header" +msgid "Alert-Info SIP Header" msgstr "" #. module: asterisk_click2dial @@ -45,9 +45,14 @@ msgstr "" msgid "Asterisk CallerID" msgstr "" +#. module: asterisk_click2dial +#: field:res.users,asterisk_chan_type:0 +msgid "Asterisk Channel Type" +msgstr "" + #. module: asterisk_click2dial #: field:asterisk.server,ip_address:0 -msgid "Asterisk IP addr. or DNS" +msgid "Asterisk IP address or DNS" msgstr "" #. module: asterisk_click2dial @@ -55,6 +60,16 @@ msgstr "" msgid "Asterisk Manager Interface" msgstr "" +#. module: asterisk_click2dial +#: field:res.users,asterisk_server_id:0 +msgid "Asterisk Server" +msgstr "" + +#. module: asterisk_click2dial +#: field:asterisk.server,name:0 +msgid "Asterisk Server Name" +msgstr "" + #. module: asterisk_click2dial #: view:asterisk.server:0 msgid "Asterisk Server Search" @@ -68,11 +83,6 @@ msgstr "" msgid "Asterisk Servers" msgstr "" -#. module: asterisk_click2dial -#: field:res.users,asterisk_chan_type:0 -msgid "Asterisk channel type" -msgstr "" - #. module: asterisk_click2dial #: help:res.users,asterisk_chan_type:0 msgid "Asterisk channel type, as used in the Asterisk dialplan. If the user has a regular IP phone, the channel type is 'SIP'." @@ -84,23 +94,15 @@ msgid "Asterisk dialplan context from which the calls will be made. Refer to /et msgstr "" #. module: asterisk_click2dial -#: field:res.users,asterisk_server_id:0 -msgid "Asterisk server" -msgstr "" - -#. module: asterisk_click2dial -#: field:asterisk.server,name:0 -msgid "Asterisk server name" -msgstr "" - -#. module: asterisk_click2dial -#: help:asterisk.server,name:0 -msgid "Asterisk server name." +#: help:res.users,asterisk_server_id:0 +msgid "Asterisk server on which the user's phone is connected. If you leave this field empty, it will use the first Asterisk server of the user's company." msgstr "" #. module: asterisk_click2dial -#: help:res.users,asterisk_server_id:0 -msgid "Asterisk server on which the user's phone is connected. If you leave this field empty, it will use the first Asterisk server of the user's company." +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:26 +#, python-format +msgid "BIG PB" msgstr "" #. module: asterisk_click2dial @@ -114,7 +116,9 @@ msgid "Call Detail Record (CDR) account used for billing this user." msgstr "" #. module: asterisk_click2dial +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:405 #: field:res.users,callerid:0 +#, python-format msgid "Caller ID" msgstr "" @@ -124,24 +128,19 @@ msgid "Caller ID used for the calls initiated by this user." msgstr "" #. module: asterisk_click2dial -#: field:wizard.open.calling.partner,calling_number:0 -msgid "Calling number" +#: field:number.not.found,calling_number:0 +msgid "Calling Number" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:288 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:310 #, python-format msgid "Can't get calling number from Asterisk.\n" "Here is the error: '%s'" msgstr "" #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Cancel" -msgstr "" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:395 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:481 #, python-format msgid "Click to dial with Asterisk failed.\n" "Here is the error: '%s'" @@ -163,72 +162,30 @@ msgid "Company who uses the Asterisk server." msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:248 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:255 #, python-format msgid "Connection Test Failed!" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:257 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:264 #, python-format msgid "Connection Test Successfull!" msgstr "" -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:82 -#, python-format -msgid "Could not get the calling number from Asterisk. Is your phone ringing or are you currently on the phone ? If yes, check your setup and look at the OpenERP debug logs." -msgstr "" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Create a new partner" -msgstr "" - -#. module: asterisk_click2dial -#: field:wizard.open.calling.partner,current_mobile:0 -msgid "Current mobile" -msgstr "" - -#. module: asterisk_click2dial -#: field:wizard.open.calling.partner,current_phone:0 -msgid "Current phone" -msgstr "" - #. module: asterisk_click2dial #: selection:res.users,asterisk_chan_type:0 msgid "DAHDI" msgstr "" #. module: asterisk_click2dial -#: view:asterisk.server:0 -msgid "Dialplan Parameters" +#: field:asterisk.server,context:0 +msgid "Dialplan Context" msgstr "" #. module: asterisk_click2dial -#: field:asterisk.server,context:0 -msgid "Dialplan context" -msgstr "" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:88 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:90 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:92 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:94 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:100 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:198 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:217 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:221 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:233 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:288 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:346 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:369 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:395 -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:81 -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:95 -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:189 -#, python-format -msgid "Error :" +#: view:asterisk.server:0 +msgid "Dialplan Parameters" msgstr "" #. module: asterisk_click2dial @@ -238,14 +195,34 @@ msgid "Error message in raise" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:360 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:109 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:114 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:119 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:124 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:133 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:191 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:212 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:218 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:238 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:308 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:413 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:432 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:444 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:480 #, python-format msgid "Error:" msgstr "" #. module: asterisk_click2dial #: field:asterisk.server,extension_priority:0 -msgid "Extension priority" +msgid "Extension Priority" +msgstr "" + +#. module: asterisk_click2dial +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:25 +#, python-format +msgid "Fail" msgstr "" #. module: asterisk_click2dial @@ -254,7 +231,7 @@ msgid "H323" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:249 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:256 #, python-format msgid "Here is the error message: %s" msgstr "" @@ -270,19 +247,10 @@ msgid "IP address or DNS name of the Asterisk server." msgstr "" #. module: asterisk_click2dial +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:404 #: field:res.users,internal_number:0 -msgid "Internal number" -msgstr "" - -#. module: asterisk_click2dial -#: field:asterisk.server,international_prefix:0 -msgid "International prefix" -msgstr "" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:118 #, python-format -msgid "Invalid phone number" +msgid "Internal Number" msgstr "" #. module: asterisk_click2dial @@ -301,98 +269,74 @@ msgid "MGCP" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:361 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:433 #, python-format msgid "Missing phone number" msgstr "" #. module: asterisk_click2dial -#: field:asterisk.server,country_prefix:0 -msgid "My country prefix" -msgstr "" - -#. module: asterisk_click2dial -#: field:asterisk.server,national_prefix:0 -msgid "National prefix" -msgstr "" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:198 +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:45 #, python-format -msgid "No Asterisk server configured for the company '%s'." +msgid "Moving to %s ID %d" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:410 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:192 #, python-format -msgid "No Partner Found" +msgid "No Asterisk server configured for the company '%s'." msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:369 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:445 #, python-format msgid "No callerID configured for the current user" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:217 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:213 #, python-format msgid "No channel type configured for the current user." msgstr "" #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "No partner found in OpenERP with this number" -msgstr "" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:221 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:219 #, python-format msgid "No resource name configured for the current user" msgstr "" -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:88 -#, python-format -msgid "Only use digits for the '%s' on the Asterisk server '%s'" -msgstr "" - #. module: asterisk_click2dial #. openerp-web -#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:20 -#: code:addons/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml:13 +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:31 #, python-format -msgid "Open Calling Partner" -msgstr "" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Open Parent Partner form" +msgid "Number Not Found" msgstr "" #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Open Partner form" +#: model:ir.model,name:asterisk_click2dial.model_number_not_found +msgid "Number not found" msgstr "" #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Open Related Invoices" +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:111 +#, python-format +msgid "Only use digits for the '%s' on the Asterisk server '%s'" msgstr "" #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Open Related Sale Orders" +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml:13 +#, python-format +msgid "Open Caller" msgstr "" #. module: asterisk_click2dial #: model:ir.model,name:asterisk_click2dial.model_wizard_open_calling_partner -#: view:wizard.open.calling.partner:0 msgid "Open calling partner" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:258 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:265 #, python-format msgid "OpenERP can successfully login to the Asterisk Manager Interface." msgstr "" @@ -404,17 +348,7 @@ msgstr "" #. module: asterisk_click2dial #: field:asterisk.server,out_prefix:0 -msgid "Out prefix" -msgstr "" - -#. module: asterisk_click2dial -#: help:wizard.open.calling.partner,parent_partner_id:0 -msgid "Parent Partner related to the calling number." -msgstr "" - -#. module: asterisk_click2dial -#: field:wizard.open.calling.partner,parent_partner_id:0 -msgid "Parent partner" +msgid "Out Prefix" msgstr "" #. module: asterisk_click2dial @@ -423,23 +357,13 @@ msgid "Partner" msgstr "" #. module: asterisk_click2dial -#: field:wizard.open.calling.partner,partner_id:0 -msgid "Partner name" +#: help:number.not.found,to_update_partner_id:0 +msgid "Partner on which the phone number will be written" msgstr "" #. module: asterisk_click2dial -#: help:wizard.open.calling.partner,to_update_partner_id:0 -msgid "Partner on which the phone or mobile number will be written" -msgstr "" - -#. module: asterisk_click2dial -#: help:wizard.open.calling.partner,partner_id:0 -msgid "Partner related to the calling number." -msgstr "" - -#. module: asterisk_click2dial -#: field:wizard.open.calling.partner,to_update_partner_id:0 -msgid "Partner to update" +#: field:number.not.found,to_update_partner_id:0 +msgid "Partner to Update" msgstr "" #. module: asterisk_click2dial @@ -448,13 +372,8 @@ msgid "Password that OpenERP will use to communicate with the Asterisk Manager I msgstr "" #. module: asterisk_click2dial -#: help:wizard.open.calling.partner,calling_number:0 -msgid "Phone number of calling party that has been obtained from Asterisk." -msgstr "" - -#. module: asterisk_click2dial -#: help:asterisk.server,country_prefix:0 -msgid "Phone prefix of the country where the Asterisk server is located. For e.g. the phone prefix for France is '33'. If the phone number to dial starts with the 'My country prefix', OpenERP will remove the country prefix from the phone number and add the 'out prefix' followed by the 'national prefix'. If the phone number to dial doesn't start with the 'My country prefix', OpenERP will add the 'out prefix' followed by the 'international prefix'." +#: help:number.not.found,calling_number:0 +msgid "Phone number of calling party that has been obtained from Asterisk, in the format used by Asterisk (not E.164)." msgstr "" #. module: asterisk_click2dial @@ -462,19 +381,9 @@ msgstr "" msgid "Port" msgstr "" -#. module: asterisk_click2dial -#: help:asterisk.server,national_prefix:0 -msgid "Prefix for national phone calls (don't include the 'out prefix'). For e.g., in France, the phone numbers look like '01 41 98 12 42' : the National prefix is '0'." -msgstr "" - -#. module: asterisk_click2dial -#: help:asterisk.server,international_prefix:0 -msgid "Prefix to add to make international phone calls (don't include the 'out prefix'). For e.g., in France, the International prefix is '00'." -msgstr "" - #. module: asterisk_click2dial #: help:asterisk.server,out_prefix:0 -msgid "Prefix to dial to place outgoing calls. If you don't use a prefix to place outgoing calls, leave empty." +msgid "Prefix to dial to make outgoing calls. If you don't use a prefix to make outgoing calls, leave empty." msgstr "" #. module: asterisk_click2dial @@ -483,14 +392,16 @@ msgid "Priority of the extension in the Asterisk dialplan. Refer to /etc/asteris msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:233 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:239 #, python-format msgid "Problem in the request from OpenERP to Asterisk. Here is the error message: %s" msgstr "" #. module: asterisk_click2dial +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:403 #: field:res.users,resource:0 -msgid "Resource name" +#, python-format +msgid "Resource Name" msgstr "" #. module: asterisk_click2dial @@ -508,12 +419,6 @@ msgstr "" msgid "SIP" msgstr "" -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:189 -#, python-format -msgid "Select the partner to update." -msgstr "" - #. module: asterisk_click2dial #: view:asterisk.server:0 msgid "Server Name" @@ -544,6 +449,13 @@ msgstr "" msgid "Standard Asterisk Parameters" msgstr "" +#. module: asterisk_click2dial +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:44 +#, python-format +msgid "Success" +msgstr "" + #. module: asterisk_click2dial #: help:asterisk.server,port:0 msgid "TCP port on which the Asterisk Manager Interface listens. Defined in /etc/asterisk/manager.conf on Asterisk." @@ -555,19 +467,19 @@ msgid "Test Connection to Asterisk" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:346 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:414 #, python-format msgid "The '%s' for the user '%s' should only have ASCII caracters" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:100 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:136 #, python-format msgid "The '%s' should only have ASCII caracters for the Asterisk server '%s'" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:92 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:120 #, python-format msgid "The 'extension priority' must be a positive value for the Asterisk server '%s'" msgstr "" @@ -577,45 +489,6 @@ msgstr "" msgid "The active field allows you to hide the Asterisk server without deleting it." msgstr "" -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:95 -#, python-format -msgid "The object '%s' is not found in your OpenERP database, probably because the related module is not installed." -msgstr "" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:121 -#, python-format -msgid "The phone number is not written in valid format." -msgstr "" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:119 -#, python-format -msgid "The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42" -msgstr "" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:120 -#, python-format -msgid "The phone number is not written in valid national format." -msgstr "" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Update an existing partner" -msgstr "" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Update mobile" -msgstr "" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Update phone" -msgstr "" - #. module: asterisk_click2dial #: help:res.users,internal_number:0 msgid "User's internal phone number." @@ -623,17 +496,17 @@ msgstr "" #. module: asterisk_click2dial #: field:res.users,alert_info:0 -msgid "User-specific Alert-Info SIP header" +msgid "User-specific Alert-Info SIP Header" msgstr "" #. module: asterisk_click2dial -#: field:res.users,variable:0 -msgid "User-specific Variable" +#: field:res.users,dial_suffix:0 +msgid "User-specific Dial Suffix" msgstr "" #. module: asterisk_click2dial -#: field:res.users,dial_suffix:0 -msgid "User-specific dial suffix" +#: field:res.users,variable:0 +msgid "User-specific Variable" msgstr "" #. module: asterisk_click2dial @@ -648,17 +521,17 @@ msgstr "" #. module: asterisk_click2dial #: field:asterisk.server,wait_time:0 -msgid "Wait time (sec)" +msgid "Wait Time (sec)" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:90 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:115 #, python-format msgid "You should set a 'Wait time' value between 1 and 120 seconds for the Asterisk server '%s'" msgstr "" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:94 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:125 #, python-format msgid "You should set a TCP port between 1 and 65535 for the Asterisk server '%s'" msgstr "" @@ -678,13 +551,3 @@ msgstr "" msgid "phone.common" msgstr "" -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "with calling number as mobile" -msgstr "" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "with calling number as phone" -msgstr "" - diff --git a/asterisk_click2dial/i18n/fr.po b/asterisk_click2dial/i18n/fr.po index 70cbbdb..995cfc9 100644 --- a/asterisk_click2dial/i18n/fr.po +++ b/asterisk_click2dial/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-08-21 16:22+0000\n" -"PO-Revision-Date: 2014-08-21 16:22+0000\n" +"POT-Creation-Date: 2014-08-25 21:43+0000\n" +"PO-Revision-Date: 2014-08-25 21:43+0000\n" "Last-Translator: Alexis de Lattre \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -17,12 +17,12 @@ msgstr "" #. module: asterisk_click2dial #: field:asterisk.server,login:0 -msgid "AMI login" +msgid "AMI Login" msgstr "Nom d'utilisateur AMI" #. module: asterisk_click2dial #: field:asterisk.server,password:0 -msgid "AMI password" +msgid "AMI Password" msgstr "Mot de passe AMI" #. module: asterisk_click2dial @@ -32,8 +32,8 @@ msgstr "Actif" #. module: asterisk_click2dial #: field:asterisk.server,alert_info:0 -msgid "Alert-Info SIP header" -msgstr "En-tête SIP Alert-Info SIP" +msgid "Alert-Info SIP Header" +msgstr "En-tête SIP Alert-Info" #. module: asterisk_click2dial #: help:asterisk.server,wait_time:0 @@ -45,16 +45,31 @@ msgstr "Temps (en secondes) pendant lequel Asterisk essayera de joindre le tél msgid "Asterisk CallerID" msgstr "Asterisk CallerID" +#. module: asterisk_click2dial +#: field:res.users,asterisk_chan_type:0 +msgid "Asterisk Channel Type" +msgstr "Type de canal Asterisk" + #. module: asterisk_click2dial #: field:asterisk.server,ip_address:0 -msgid "Asterisk IP addr. or DNS" -msgstr "Adr. IP ou DNS d'Asterisk" +msgid "Asterisk IP address or DNS" +msgstr "Adresse IP ou DNS d'Asterisk" #. module: asterisk_click2dial #: view:asterisk.server:0 msgid "Asterisk Manager Interface" msgstr "Asterisk Manager Interface" +#. module: asterisk_click2dial +#: field:res.users,asterisk_server_id:0 +msgid "Asterisk Server" +msgstr "Serveur Asterisk" + +#. module: asterisk_click2dial +#: field:asterisk.server,name:0 +msgid "Asterisk Server Name" +msgstr "Nom du serveur Asterisk" + #. module: asterisk_click2dial #: view:asterisk.server:0 msgid "Asterisk Server Search" @@ -68,11 +83,6 @@ msgstr "Recherche de serveur Asterisk" msgid "Asterisk Servers" msgstr "Serveurs Asterisk" -#. module: asterisk_click2dial -#: field:res.users,asterisk_chan_type:0 -msgid "Asterisk channel type" -msgstr "Type de canal Asterisk" - #. module: asterisk_click2dial #: help:res.users,asterisk_chan_type:0 msgid "Asterisk channel type, as used in the Asterisk dialplan. If the user has a regular IP phone, the channel type is 'SIP'." @@ -83,26 +93,18 @@ msgstr "Type de canal Asterisk, tel qu'utilisé dans le dialplan d'Asterisk. Si msgid "Asterisk dialplan context from which the calls will be made. Refer to /etc/asterisk/extensions.conf on your Asterisk server." msgstr "Contexte du dialplan d'Asterisk depuis lequel les appels seront initiés. Cf /etc/asterisk/extensions.conf sur le serveur Asterisk." -#. module: asterisk_click2dial -#: field:res.users,asterisk_server_id:0 -msgid "Asterisk server" -msgstr "Serveur Asterisk" - -#. module: asterisk_click2dial -#: field:asterisk.server,name:0 -msgid "Asterisk server name" -msgstr "Nom du serveur Asterisk" - -#. module: asterisk_click2dial -#: help:asterisk.server,name:0 -msgid "Asterisk server name." -msgstr "Nom du serveur Asterisk." - #. module: asterisk_click2dial #: help:res.users,asterisk_server_id:0 msgid "Asterisk server on which the user's phone is connected. If you leave this field empty, it will use the first Asterisk server of the user's company." msgstr "Serveur Asterisk sur lequel le téléphone de l'utilisateur est connecté. Si vous laissez ce champ vide, le premier serveur Asterisk de la société de l'utilisateur sera utilisé." +#. module: asterisk_click2dial +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:26 +#, python-format +msgid "BIG PB" +msgstr "BIG PB" + #. module: asterisk_click2dial #: field:res.users,cdraccount:0 msgid "CDR Account" @@ -114,7 +116,9 @@ msgid "Call Detail Record (CDR) account used for billing this user." msgstr "Compte CDR utilisé pour facturer cet utilisateur (CDR = Journal d'appel détaillé)." #. module: asterisk_click2dial +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:405 #: field:res.users,callerid:0 +#, python-format msgid "Caller ID" msgstr "Identification de l'appelant" @@ -124,12 +128,12 @@ msgid "Caller ID used for the calls initiated by this user." msgstr "'Caller ID' des appels passés par l'utilisateur." #. module: asterisk_click2dial -#: field:wizard.open.calling.partner,calling_number:0 -msgid "Calling number" +#: field:number.not.found,calling_number:0 +msgid "Calling Number" msgstr "Numéro appelant" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:288 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:310 #, python-format msgid "Can't get calling number from Asterisk.\n" "Here is the error: '%s'" @@ -137,12 +141,7 @@ msgstr "Le numéro de l'appelant n'a pas pu être récupéré auprès d'Asterisk "Voilà l'erreur : '%s'" #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Cancel" -msgstr "Annuler" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:395 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:481 #, python-format msgid "Click to dial with Asterisk failed.\n" "Here is the error: '%s'" @@ -165,73 +164,31 @@ msgid "Company who uses the Asterisk server." msgstr "Société qui utilise le serveur Asterisk." #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:248 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:255 #, python-format msgid "Connection Test Failed!" -msgstr "Connection Test Failed!" +msgstr "Echec du test de connexion !" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:257 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:264 #, python-format msgid "Connection Test Successfull!" -msgstr "Connection Test Successfull!" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:82 -#, python-format -msgid "Could not get the calling number from Asterisk. Is your phone ringing or are you currently on the phone ? If yes, check your setup and look at the OpenERP debug logs." -msgstr "OpenERP n'a pas pu obtenir le numéro de l'appelant auprès d'Asterisk. Votre téléphone est-il bien entrain de sonner ou êtes-vous bien au téléphone actuellement ? Si oui, vérifiez les paramètres de configuration et consultez les logs de debug d'OpenERP." - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Create a new partner" -msgstr "Créer un nouveau partenaire" - -#. module: asterisk_click2dial -#: field:wizard.open.calling.partner,current_mobile:0 -msgid "Current mobile" -msgstr "Tél. portable actuel" - -#. module: asterisk_click2dial -#: field:wizard.open.calling.partner,current_phone:0 -msgid "Current phone" -msgstr "Tél. actuel" +msgstr "Test de connexion réussi !" #. module: asterisk_click2dial #: selection:res.users,asterisk_chan_type:0 msgid "DAHDI" msgstr "DAHDI" -#. module: asterisk_click2dial -#: view:asterisk.server:0 -msgid "Dialplan Parameters" -msgstr "Dialplan Parameters" - #. module: asterisk_click2dial #: field:asterisk.server,context:0 -msgid "Dialplan context" +msgid "Dialplan Context" msgstr "Contexte du dialplan" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:88 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:90 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:92 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:94 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:100 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:198 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:217 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:221 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:233 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:288 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:346 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:369 -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:395 -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:81 -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:95 -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:189 -#, python-format -msgid "Error :" -msgstr "Erreur :" +#: view:asterisk.server:0 +msgid "Dialplan Parameters" +msgstr "Paramètres du dialplan" #. module: asterisk_click2dial #: constraint:asterisk.server:0 @@ -240,26 +197,46 @@ msgid "Error message in raise" msgstr "Error message in raise" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:360 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:109 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:114 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:119 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:124 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:133 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:191 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:212 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:218 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:238 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:308 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:413 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:432 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:444 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:480 #, python-format msgid "Error:" -msgstr "Error:" +msgstr "Erreur :" #. module: asterisk_click2dial #: field:asterisk.server,extension_priority:0 -msgid "Extension priority" +msgid "Extension Priority" msgstr "Priorité de l'extension" +#. module: asterisk_click2dial +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:25 +#, python-format +msgid "Fail" +msgstr "Fail" + #. module: asterisk_click2dial #: selection:res.users,asterisk_chan_type:0 msgid "H323" msgstr "H323" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:249 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:256 #, python-format msgid "Here is the error message: %s" -msgstr "Here is the error message: %s" +msgstr "Voilà le message d'erreur : %s" #. module: asterisk_click2dial #: selection:res.users,asterisk_chan_type:0 @@ -272,20 +249,11 @@ msgid "IP address or DNS name of the Asterisk server." msgstr "Adresse IP ou DNS du serveur Asterisk." #. module: asterisk_click2dial +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:404 #: field:res.users,internal_number:0 -msgid "Internal number" -msgstr "Numéro interne" - -#. module: asterisk_click2dial -#: field:asterisk.server,international_prefix:0 -msgid "International prefix" -msgstr "Préfixe international" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:118 #, python-format -msgid "Invalid phone number" -msgstr "Numéro de téléphone invalide" +msgid "Internal Number" +msgstr "Numéro interne" #. module: asterisk_click2dial #: selection:res.users,asterisk_chan_type:0 @@ -303,121 +271,87 @@ msgid "MGCP" msgstr "MGCP" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:361 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:433 #, python-format msgid "Missing phone number" -msgstr "Missing phone number" +msgstr "Numéro de téléphone manquant" #. module: asterisk_click2dial -#: field:asterisk.server,country_prefix:0 -msgid "My country prefix" -msgstr "Préfixe du pays" - -#. module: asterisk_click2dial -#: field:asterisk.server,national_prefix:0 -msgid "National prefix" -msgstr "Préfixe national" +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:45 +#, python-format +msgid "Moving to %s ID %d" +msgstr "Moving to %s ID %d" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:198 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:192 #, python-format msgid "No Asterisk server configured for the company '%s'." msgstr "Aucun serveur Asterisk n'est associé à la société '%s'." #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:410 -#, python-format -msgid "No Partner Found" -msgstr "No Partner Found" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:369 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:445 #, python-format msgid "No callerID configured for the current user" msgstr "Le callerID n'est pas configuré pour l'utilisateur courant" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:217 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:213 #, python-format msgid "No channel type configured for the current user." msgstr "Aucun type de canal n'est configuré pour l'utilisateur actuel." #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "No partner found in OpenERP with this number" -msgstr "Aucun partenaire trouvé dans OpenERP avec ce numéro" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:221 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:219 #, python-format msgid "No resource name configured for the current user" msgstr "Aucun nom de ressource n'a été renseigné pour l'utilisateur actuel" -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:88 -#, python-format -msgid "Only use digits for the '%s' on the Asterisk server '%s'" -msgstr "N'utilisez que des chiffres pour le '%s' du serveur Asterisk '%s'" - #. module: asterisk_click2dial #. openerp-web -#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:20 -#: code:addons/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml:13 +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:31 #, python-format -msgid "Open Calling Partner" -msgstr "Open Calling Partner" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Open Parent Partner form" -msgstr "Ouvrir la fiche du partenaire parent" +msgid "Number Not Found" +msgstr "Numéro introuvable" #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Open Partner form" -msgstr "Ouvrir le fiche Partenaire" +#: model:ir.model,name:asterisk_click2dial.model_number_not_found +msgid "Number not found" +msgstr "Numéro introuvable" #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Open Related Invoices" -msgstr "Ouvrir les factures associées" +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:111 +#, python-format +msgid "Only use digits for the '%s' on the Asterisk server '%s'" +msgstr "N'utilisez que des chiffres pour le '%s' du serveur Asterisk '%s'" #. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Open Related Sale Orders" -msgstr "Ouvrir les commandes associées" +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml:13 +#, python-format +msgid "Open Caller" +msgstr "Ouvrir l'appelant" #. module: asterisk_click2dial #: model:ir.model,name:asterisk_click2dial.model_wizard_open_calling_partner -#: view:wizard.open.calling.partner:0 msgid "Open calling partner" msgstr "Ouvrir le partenaire appelant" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:258 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:265 #, python-format msgid "OpenERP can successfully login to the Asterisk Manager Interface." -msgstr "OpenERP can successfully login to the Asterisk Manager Interface." +msgstr "OpenERP s'authentifie avec succès à l'Asterisk Manager Interface." #. module: asterisk_click2dial #: view:res.users:0 msgid "Optional Asterisk Parameters - for experts only, can be left empty" -msgstr "Optional Asterisk Parameters - for experts only, can be left empty" +msgstr "Paramètres Asterisk optionnels - pour les experts uniquement, peut être laissé vide" #. module: asterisk_click2dial #: field:asterisk.server,out_prefix:0 -msgid "Out prefix" -msgstr "Préfixe pour l'extérieur" - -#. module: asterisk_click2dial -#: help:wizard.open.calling.partner,parent_partner_id:0 -msgid "Parent Partner related to the calling number." -msgstr "Partenaire parent associé au numéro appelant." - -#. module: asterisk_click2dial -#: field:wizard.open.calling.partner,parent_partner_id:0 -msgid "Parent partner" -msgstr "Partenaire parent" +msgid "Out Prefix" +msgstr "Préfixe de sortie" #. module: asterisk_click2dial #: model:ir.model,name:asterisk_click2dial.model_res_partner @@ -425,23 +359,13 @@ msgid "Partner" msgstr "Partenaire" #. module: asterisk_click2dial -#: field:wizard.open.calling.partner,partner_id:0 -msgid "Partner name" -msgstr "Nom du Partenaire" - -#. module: asterisk_click2dial -#: help:wizard.open.calling.partner,to_update_partner_id:0 -msgid "Partner on which the phone or mobile number will be written" -msgstr "Partenaire sur lequel le numéro de téléphone fixe ou de téléphone portable sera écrit" - -#. module: asterisk_click2dial -#: help:wizard.open.calling.partner,partner_id:0 -msgid "Partner related to the calling number." -msgstr "Partenaire associé au numéro de téléphone appelant." +#: help:number.not.found,to_update_partner_id:0 +msgid "Partner on which the phone number will be written" +msgstr "Partenaire sur lequel le numéro de téléphone sera écrit" #. module: asterisk_click2dial -#: field:wizard.open.calling.partner,to_update_partner_id:0 -msgid "Partner to update" +#: field:number.not.found,to_update_partner_id:0 +msgid "Partner to Update" msgstr "Partenaire à mettre à jour" #. module: asterisk_click2dial @@ -450,34 +374,19 @@ msgid "Password that OpenERP will use to communicate with the Asterisk Manager I msgstr "Mot de passe qui sera utilisé par OpenERP pour communiquer avec l'Asterisk Manager Interface. Ce mot de passe est configuré dans le fichier /etc/asterisk/manager.conf sur votre serveur Asterisk." #. module: asterisk_click2dial -#: help:wizard.open.calling.partner,calling_number:0 -msgid "Phone number of calling party that has been obtained from Asterisk." -msgstr "Numéro de téléphone de l'appelant obtenu auprès d'Asterisk." - -#. module: asterisk_click2dial -#: help:asterisk.server,country_prefix:0 -msgid "Phone prefix of the country where the Asterisk server is located. For e.g. the phone prefix for France is '33'. If the phone number to dial starts with the 'My country prefix', OpenERP will remove the country prefix from the phone number and add the 'out prefix' followed by the 'national prefix'. If the phone number to dial doesn't start with the 'My country prefix', OpenERP will add the 'out prefix' followed by the 'international prefix'." -msgstr "Préfixe téléphonique du pays dans lequel est situé le serveur Asterisk. Par exemple, le préfixe téléphonique de la France est '33'. Si le numéro de téléphone à appeler commence par le préfixe du pays, OpenERP supprimera ce préfixe du numéro de téléphone à composer et ajoutera le préfixe pour l'extérieur suivi par le préfixe national. Si le numéro de téléphone à appeler ne commence pas par le préfixe du pays, OpenERP ajoutera le préfixe pour l'extérieur suivi par le préfixe international." +#: help:number.not.found,calling_number:0 +msgid "Phone number of calling party that has been obtained from Asterisk, in the format used by Asterisk (not E.164)." +msgstr "Phone number of calling party that has been obtained from Asterisk, in the format used by Asterisk (not E.164)." #. module: asterisk_click2dial #: field:asterisk.server,port:0 msgid "Port" msgstr "Port" -#. module: asterisk_click2dial -#: help:asterisk.server,national_prefix:0 -msgid "Prefix for national phone calls (don't include the 'out prefix'). For e.g., in France, the phone numbers look like '01 41 98 12 42' : the National prefix is '0'." -msgstr "Préfixe pour les appels nationaux (ne pas inclure le préfixe pour l'extérieur). Par exemple, en France, les numéros de téléphone sont du type '01 41 98 12 42' ; le préfixe national est '0'." - -#. module: asterisk_click2dial -#: help:asterisk.server,international_prefix:0 -msgid "Prefix to add to make international phone calls (don't include the 'out prefix'). For e.g., in France, the International prefix is '00'." -msgstr "Préfixe à ajouter pour passer des appels vers l'étranger (ne pas inclure le préfixe pour l'extérieur). Par exemple, en France, le préfixe pour l'international est '00'." - #. module: asterisk_click2dial #: help:asterisk.server,out_prefix:0 -msgid "Prefix to dial to place outgoing calls. If you don't use a prefix to place outgoing calls, leave empty." -msgstr "Préfixe à composer pour appeler vers l'extérieur. Si vous n'avez pas à composer un préfixe pour appeler vers l'extérieur, laissez vide." +msgid "Prefix to dial to make outgoing calls. If you don't use a prefix to make outgoing calls, leave empty." +msgstr "Préfixe à composer pour les appels vers l'extérieur. Si vous n'utilisez pas de préfixe pour les appels vers l'extérieur, laissez vide." #. module: asterisk_click2dial #: help:asterisk.server,extension_priority:0 @@ -485,14 +394,16 @@ msgid "Priority of the extension in the Asterisk dialplan. Refer to /etc/asteris msgstr "Priorité de l'extension dans le dialplan d'Asterisk. Cf /etc/asterisk/extensions.conf sur le serveur Asterisk." #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:233 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:239 #, python-format msgid "Problem in the request from OpenERP to Asterisk. Here is the error message: %s" -msgstr "Problem in the request from OpenERP to Asterisk. Here is the error message: %s" +msgstr "Problème dans la requête d'OpenERP vers Asterisk. Voilà le message d'erreur : %s" #. module: asterisk_click2dial +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:403 #: field:res.users,resource:0 -msgid "Resource name" +#, python-format +msgid "Resource Name" msgstr "Nom de la ressource" #. module: asterisk_click2dial @@ -510,12 +421,6 @@ msgstr "SCCP" msgid "SIP" msgstr "SIP" -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:189 -#, python-format -msgid "Select the partner to update." -msgstr "Sélectionnez le partenaire à mettre à jour." - #. module: asterisk_click2dial #: view:asterisk.server:0 msgid "Server Name" @@ -544,7 +449,14 @@ msgstr "Skinny" #. module: asterisk_click2dial #: view:res.users:0 msgid "Standard Asterisk Parameters" -msgstr "Standard Asterisk Parameters" +msgstr "Paramètres Asterisk standards" + +#. module: asterisk_click2dial +#. openerp-web +#: code:addons/asterisk_click2dial/static/src/js/asterisk_click2dial.js:44 +#, python-format +msgid "Success" +msgstr "Succès" #. module: asterisk_click2dial #: help:asterisk.server,port:0 @@ -557,19 +469,19 @@ msgid "Test Connection to Asterisk" msgstr "Test de connexion à Asterisk" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:346 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:414 #, python-format msgid "The '%s' for the user '%s' should only have ASCII caracters" msgstr "Le '%s' pour l'utilisateur '%s' ne devrait contenir que des caractères ASCII" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:100 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:136 #, python-format msgid "The '%s' should only have ASCII caracters for the Asterisk server '%s'" msgstr "Le '%s' ne doit contenir que des caractères ASCII pour le serveur Asterisk '%s'" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:92 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:120 #, python-format msgid "The 'extension priority' must be a positive value for the Asterisk server '%s'" msgstr "Le paramètre 'Priorité de l'extension' doit être un entier positif pour le serveur Asterisk '%s'" @@ -579,45 +491,6 @@ msgstr "Le paramètre 'Priorité de l'extension' doit être un entier positif po msgid "The active field allows you to hide the Asterisk server without deleting it." msgstr "Le champ Actif permet de cacher le serveur Asterisk sans le supprimer." -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/wizard/open_calling_partner.py:95 -#, python-format -msgid "The object '%s' is not found in your OpenERP database, probably because the related module is not installed." -msgstr "The object '%s' is not found in your OpenERP database, probably because the related module is not installed." - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:121 -#, python-format -msgid "The phone number is not written in valid format." -msgstr "Le numéro de téléphone n'est pas dans un format valide." - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:119 -#, python-format -msgid "The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42" -msgstr "Le numéro de téléphone n'est pas dans un format international valide. Exemple de numéro de téléphone dans un format international valide : +33 1 41 98 12 42" - -#. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:120 -#, python-format -msgid "The phone number is not written in valid national format." -msgstr "Le numéro de téléphone n'est pas dans un format national valide." - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Update an existing partner" -msgstr "Mettre à jour un partenaire existant" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Update mobile" -msgstr "Mettre à jour le portable" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "Update phone" -msgstr "Mettre à jour le tél." - #. module: asterisk_click2dial #: help:res.users,internal_number:0 msgid "User's internal phone number." @@ -625,19 +498,19 @@ msgstr "Numéro de téléphone interne de l'utilisateur." #. module: asterisk_click2dial #: field:res.users,alert_info:0 -msgid "User-specific Alert-Info SIP header" +msgid "User-specific Alert-Info SIP Header" msgstr "En-tête SIP Alert-Info spécifique à l'utilisateur" +#. module: asterisk_click2dial +#: field:res.users,dial_suffix:0 +msgid "User-specific Dial Suffix" +msgstr "Suffixe d'appel spécifique à l'utilisateur" + #. module: asterisk_click2dial #: field:res.users,variable:0 msgid "User-specific Variable" msgstr "Variable spécifique à l'utilisateur" -#. module: asterisk_click2dial -#: field:res.users,dial_suffix:0 -msgid "User-specific dial suffix" -msgstr "Suffixe d'appel spécifique à l'utilisateur" - #. module: asterisk_click2dial #: help:res.users,dial_suffix:0 msgid "User-specific dial suffix such as aa=2wb for SCCP auto answer." @@ -650,17 +523,17 @@ msgstr "Utilisateurs" #. module: asterisk_click2dial #: field:asterisk.server,wait_time:0 -msgid "Wait time (sec)" +msgid "Wait Time (sec)" msgstr "Temps d'attente (sec)" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:90 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:115 #, python-format msgid "You should set a 'Wait time' value between 1 and 120 seconds for the Asterisk server '%s'" msgstr "Vous devez indiquer une valeur comprise entre 1 et 120 secondes pour le paramètre 'Temps d'attente' pour le serveur Asterisk '%s'" #. module: asterisk_click2dial -#: code:addons/asterisk_click2dial/asterisk_click2dial.py:94 +#: code:addons/asterisk_click2dial/asterisk_click2dial.py:125 #, python-format msgid "You should set a TCP port between 1 and 65535 for the Asterisk server '%s'" msgstr "Vous devez mettre un port TCP entre 1 et 65535 pour le serveur Asterisk '%s'" @@ -680,13 +553,3 @@ msgstr "mISDN" msgid "phone.common" msgstr "phone.common" -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "with calling number as mobile" -msgstr "avec le numéro appelant comme portable" - -#. module: asterisk_click2dial -#: view:wizard.open.calling.partner:0 -msgid "with calling number as phone" -msgstr "avec le numéro appelant comme tél." - diff --git a/asterisk_click2dial/scripts/openerp_popup_timeout.sh b/asterisk_click2dial/scripts/openerp_popup_timeout.sh new file mode 100755 index 0000000..a5b2c38 --- /dev/null +++ b/asterisk_click2dial/scripts/openerp_popup_timeout.sh @@ -0,0 +1,27 @@ +#! /bin/sh +# -*- encoding: utf-8 -*- +# +# Written by Alexis de Lattre + +# Example of wrapper for set_name_agi.py which makes sure that the +# script doesn't take too much time to execute + +# Limiting the execution time of set_name_agi.py is important because +# the script is designed to be executed at the beginning of each +# incoming or outgoing phone call... and if the script get stucks, the +# phone call will also get stucks ! + +# For Debian Lenny and Ubuntu Lucid, you need to install the package "timeout" +# For Ubuntu >= Maverick and Debian >= Squeeze, the "timeout" command is shipped +# in the "coreutils" package + +# The first argument of the "timeout" command is the maximum execution time +# In this example, we chose 2 seconds. + +# To test this script manually (i.e. outside of Asterisk), run : +# echo "agi_callerid:0141401242"|openerp_popup_timeout.sh +# where 0141401242 is a phone number that could be presented by the calling party + +PATH=/usr/local/sbin:/usr/local/bin:/var/lib/asterisk/agi-bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/share/asterisk/agi-bin + +timeout 2s set_name_agi.py --server openerp.mycompany.com --database erp_prod --user-id 12 --password "thepasswd" --notify admin demo diff --git a/asterisk_click2dial/scripts/set_name_agi.py b/asterisk_click2dial/scripts/set_name_agi.py index 40ca075..29983de 100755 --- a/asterisk_click2dial/scripts/set_name_agi.py +++ b/asterisk_click2dial/scripts/set_name_agi.py @@ -108,20 +108,66 @@ not_found_name = "Not in OpenERP" # Define command line options options = [ - {'names': ('-s', '--server'), 'dest': 'server', 'type': 'string', 'help': 'DNS or IP address of the OpenERP server. Default = none (will not try to connect to OpenERP)', 'action': 'store', 'default': False}, - {'names': ('-p', '--port'), 'dest': 'port', 'type': 'int', 'help': "Port of OpenERP's XML-RPC interface. Default = 8069", 'action': 'store', 'default': 8069}, - {'names': ('-e', '--ssl'), 'dest': 'ssl', 'help': "Use XML-RPC secure i.e. with SSL instead of clear XML-RPC. Default = no, use clear XML-RPC", 'action': 'store_true', 'default': False}, - {'names': ('-d', '--database'), 'dest': 'database', 'type': 'string', 'help': "OpenERP database name. Default = 'openerp'", 'action': 'store', 'default': 'openerp'}, - {'names': ('-u', '--user-id'), 'dest': 'user', 'type': 'int', 'help': "OpenERP user ID to use when connecting to OpenERP. Default = 2", 'action': 'store', 'default': 2}, - {'names': ('-w', '--password'), 'dest': 'password', 'type': 'string', 'help': "Password of the OpenERP user. Default = 'demo'", 'action': 'store', 'default': 'demo'}, - {'names': ('-a', '--ascii'), 'dest': 'ascii', 'help': "Convert name from UTF-8 to ASCII. Default = no, keep UTF-8", 'action': 'store_true', 'default': False}, - {'names': ('-n', '--notify'), 'dest': 'notify', 'help': "Notify OpenERP users via a pop-up (requires the OpenERP module 'base_phone_popup'). If you use this option, you must pass the logins of the OpenERP users to notify as argument to the script. Default = no", 'action': 'store_true', 'default': False}, - {'names': ('-g', '--geoloc'), 'dest': 'geoloc', 'help': "Try to geolocate phone numbers unknown to OpenERP. This features requires the 'phonenumbers' Python lib. To install it, run 'sudo pip install phonenumbers' Default = no", 'action': 'store_true', 'default': False}, - {'names': ('-l', '--geoloc-lang'), 'dest': 'lang', 'help': "Language in which the name of the country and city name will be displayed by the geolocalisation database. Use the 2 letters ISO code of the language. Default = 'en'", 'action': 'store', 'default': "en"}, - {'names': ('-c', '--geoloc-country'), 'dest': 'country', 'help': "2 letters ISO code for your country e.g. 'FR' for France. This will be used by the geolocalisation system to parse the phone number of the calling party. Default = 'FR'", 'action': 'store', 'default': "FR"}, - {'names': ('-o', '--outgoing'), 'dest': 'outgoing', 'help': "Update the Connected Line ID name on outgoing calls via a call to the Asterisk function CONNECTEDLINE(), instead of updating the Caller ID name on incoming calls. Default = no.", 'action': 'store_true', 'default': False}, - {'names': ('-i', '--outgoing-agi-variable'), 'dest': 'outgoing_agi_var', 'help': "Enter the name of the AGI variable (without the 'agi_' prefix) from which the script will get the phone number dialed by the user on outgoing calls. For example, with Xivo, you should specify 'dnid' as the AGI variable. Default = 'extension'", 'action': 'store', 'default': "extension"}, - {'names': ('-m', '--max-size'), 'dest': 'max_size', 'type': 'int', 'help': "If the name has more characters this maximum size, cut it to this maximum size. Default = 40", 'action': 'store', 'default': 40}, + {'names': ('-s', '--server'), 'dest': 'server', 'type': 'string', + 'action': 'store', 'default': False, + 'help': 'DNS or IP address of the OpenERP server. Default = none ' + '(will not try to connect to OpenERP)'}, + {'names': ('-p', '--port'), 'dest': 'port', 'type': 'int', + 'action': 'store', 'default': 8069, + 'help': "Port of OpenERP's XML-RPC interface. Default = 8069"}, + {'names': ('-e', '--ssl'), 'dest': 'ssl', + 'help': "Use XML-RPC secure i.e. with SSL instead of clear XML-RPC. " + "Default = no, use clear XML-RPC", + 'action': 'store_true', 'default': False}, + {'names': ('-d', '--database'), 'dest': 'database', 'type': 'string', + 'action': 'store', 'default': 'openerp', + 'help': "OpenERP database name. Default = 'openerp'"}, + {'names': ('-u', '--user-id'), 'dest': 'user', 'type': 'int', + 'action': 'store', 'default': 2, + 'help': "OpenERP user ID to use when connecting to OpenERP. " + "Default = 2"}, + {'names': ('-w', '--password'), 'dest': 'password', 'type': 'string', + 'action': 'store', 'default': 'demo', + 'help': "Password of the OpenERP user. Default = 'demo'"}, + {'names': ('-a', '--ascii'), 'dest': 'ascii', + 'action': 'store_true', 'default': False, + 'help': "Convert name from UTF-8 to ASCII. Default = no, keep UTF-8"}, + {'names': ('-n', '--notify'), 'dest': 'notify', + 'action': 'store_true', 'default': False, + 'help': "Notify OpenERP users via a pop-up (requires the OpenERP " + "module 'base_phone_popup'). If you use this option, you must pass " + "the logins of the OpenERP users to notify as argument to the " + "script. Default = no"}, + {'names': ('-g', '--geoloc'), 'dest': 'geoloc', + 'action': 'store_true', 'default': False, + 'help': "Try to geolocate phone numbers unknown to OpenERP. This " + "features requires the 'phonenumbers' Python lib. To install it, " + "run 'sudo pip install phonenumbers' Default = no"}, + {'names': ('-l', '--geoloc-lang'), 'dest': 'lang', 'type': 'string', + 'action': 'store', 'default': "en", + 'help': "Language in which the name of the country and city name " + "will be displayed by the geolocalisation database. Use the 2 " + "letters ISO code of the language. Default = 'en'"}, + {'names': ('-c', '--geoloc-country'), 'dest': 'country', 'type': 'string', + 'action': 'store', 'default': "FR", + 'help': "2 letters ISO code for your country e.g. 'FR' for France. " + "This will be used by the geolocalisation system to parse the phone " + "number of the calling party. Default = 'FR'"}, + {'names': ('-o', '--outgoing'), 'dest': 'outgoing', + 'action': 'store_true', 'default': False, + 'help': "Update the Connected Line ID name on outgoing calls via a " + "call to the Asterisk function CONNECTEDLINE(), instead of updating " + "the Caller ID name on incoming calls. Default = no."}, + {'names': ('-i', '--outgoing-agi-variable'), 'dest': 'outgoing_agi_var', + 'type': 'string', 'action': 'store', 'default': "extension", + 'help': "Enter the name of the AGI variable (without the 'agi_' " + "prefix) from which the script will get the phone number dialed by " + "the user on outgoing calls. For example, with Xivo, you should " + "specify 'dnid' as the AGI variable. Default = 'extension'"}, + {'names': ('-m', '--max-size'), 'dest': 'max_size', 'type': 'int', + 'action': 'store', 'default': 40, + 'help': "If the name has more characters this maximum size, cut it " + "to this maximum size. Default = 40"}, ] @@ -218,7 +264,8 @@ def main(options, arguments): stdinput.get('agi_calleridname') and not stdinput.get('agi_calleridname').isdigit() and stdinput.get('agi_calleridname').lower() - not in ['asterisk', 'unknown', 'anonymous']): + not in ['asterisk', 'unknown', 'anonymous'] + and not options.notify): stdout_write( 'VERBOSE "Incoming CallerID name is %s"\n' % stdinput.get('agi_calleridname')) diff --git a/asterisk_click2dial/static/src/css/asterisk_click2dial.css b/asterisk_click2dial/static/src/css/asterisk_click2dial.css index 652965b..c566196 100644 --- a/asterisk_click2dial/static/src/css/asterisk_click2dial.css +++ b/asterisk_click2dial/static/src/css/asterisk_click2dial.css @@ -4,13 +4,13 @@ The licence is in the file __openerp__.py */ -.openerp .oe_topbar_item.oe_topbar_open_calling_partner{ +.openerp .oe_topbar_item.oe_topbar_open_caller{ padding: 0px; width: 32px; height: 32px; } -.openerp .oe_topbar_item.oe_topbar_open_calling_partner button{ +.openerp .oe_topbar_item.oe_topbar_open_caller button{ position: relative; top: -3px; box-sizing: border-box; diff --git a/asterisk_click2dial/static/src/js/asterisk_click2dial.js b/asterisk_click2dial/static/src/js/asterisk_click2dial.js index 15443bc..02ee939 100644 --- a/asterisk_click2dial/static/src/js/asterisk_click2dial.js +++ b/asterisk_click2dial/static/src/js/asterisk_click2dial.js @@ -6,26 +6,54 @@ openerp.asterisk_click2dial = function (instance) { var _t = instance.web._t; - instance.web.OpenCallingPartner = instance.web.Widget.extend({ - template:'asterisk_click2dial.OpenCallingPartner', + instance.web.OpenCaller = instance.web.Widget.extend({ + template:'asterisk_click2dial.OpenCaller', start: function () { - this.$('button').on('click', this.on_open_calling_partner); + this.$('button').on('click', this.on_open_caller); this._super(); }, - on_open_calling_partner: function (event) { + on_open_caller: function (event) { event.stopPropagation(); - var action = { - name: _t('Open Calling Partner'), - type: 'ir.actions.act_window', - res_model: 'wizard.open.calling.partner', - view_mode: 'form', - views: [[false, 'form']], - target: 'new', - context: {}, - }; - instance.client.action_manager.do_action(action); + var self = this; + self.rpc('/asterisk_click2dial/get_record_from_my_channel', {}).done(function(r) { + // console.log('RESULT RPC r='+r); + // console.log('RESULT RPC type r='+typeof r); + if (r === false) { + self.do_notify( + _t('Failure'), + _t('Problem in the connection to Asterisk')); + } + else if (typeof r == 'string') { + var action = { + name: _t('Number Not Found'), + type: 'ir.actions.act_window', + res_model: 'number.not.found', + view_mode: 'form', + views: [[false, 'form']], + target: 'new', + context: {'default_calling_number': r}, + }; + instance.client.action_manager.do_action(action); + + } + else if (typeof r == 'object' && r.length == 3) { + self.do_notify( // Not working + _t('Success'), + _t('Moving to %s ID %d', r[0], r[1])); + var action = { + type: 'ir.actions.act_window', + res_model: r[0], + res_id: r[1], + view_mode: 'form,tree', + views: [[false, 'form']], + target: 'current', + context: {}, + }; + instance.client.action_manager.do_action(action); + } + }); }, }); @@ -33,7 +61,7 @@ openerp.asterisk_click2dial = function (instance) { do_update: function(){ this._super.apply(this, arguments); this.update_promise.then(function() { - var asterisk_button = new instance.web.OpenCallingPartner(); + var asterisk_button = new instance.web.OpenCaller(); asterisk_button.appendTo(instance.webclient.$el.find('.oe_systray')); }); }, diff --git a/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml b/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml index 3c459e4..27348bc 100644 --- a/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml +++ b/asterisk_click2dial/static/src/xml/asterisk_click2dial.xml @@ -7,10 +7,10 @@