diff --git a/asterisk_click2dial/__openerp__.py b/asterisk_click2dial/__openerp__.py index 0efce62..d4524ac 100644 --- a/asterisk_click2dial/__openerp__.py +++ b/asterisk_click2dial/__openerp__.py @@ -25,26 +25,26 @@ 'version': '0.3', 'category': 'Generic Modules/Others', 'license': 'AGPL-3', - 'description': """This module adds a 'dial' button in the partner address -view so that users can directly dial a phone number through Asterisk. This feature is usually known as 'click2dial'. + 'description': """This module adds 3 functionnalities : -Here is how it works : -1) In OpenERP, the user clicks on the 'dial' button next to a phone number field in the Partner address view. -2) Asterisk makes the user's phone ring. -3) The user answers his own phone (if he doesn't, the process stops here). -4) Asterisk dials the phone number found in OpenERP in place of the user. -5) If the remote party answers, the user can talk to his correspondent. +1) It adds a 'dial' button in the partner address 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 address 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. -This module also adds the ability to show the name of the calling party on incoming phone calls if the presented -phone number is present in the Partner addresses of OpenERP. +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 addresses of OpenERP. Here is how it works : +. On incoming phone calls, the Asterisk dialplan executes an AGI script "get_cid_name_timeout.sh". +. The "get_cid_name_timeout.sh" script calls the "get_cid_name.py" script with a short timeout. +. The "get_cid_name.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. -Here is how it works : -1) On incoming phone calls, the Asterisk dialplan executes an AGI "get_cid_name_timeout.sh". -2) The "get_cid_name_timeout.sh" script calls the "get_cid_name.py" script with a short timeout. -3) The "get_cid_name.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. -4) If it finds the name, it is add as CallerID name of the call, so as to be presented on the IP phone - of the user. +3) It adds a button "Open calling partner" in the menu "Sales > Address book" to open the partner form of the calling party in 2 clicks. 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 Partner addresses of OpenERP and, if a record matches, it opens the form view of the corresponding partner. 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', diff --git a/asterisk_click2dial/asterisk_click2dial.py b/asterisk_click2dial/asterisk_click2dial.py index 0cc922b..9f015e5 100644 --- a/asterisk_click2dial/asterisk_click2dial.py +++ b/asterisk_click2dial/asterisk_click2dial.py @@ -55,13 +55,13 @@ class asterisk_server(osv.osv): } _defaults = { - 'active': lambda *a: 1, - 'port': lambda *a: 5038, # Default AMI port - 'out_prefix': lambda *a: '0', - 'national_prefix': lambda *a: '0', - 'international_prefix': lambda *a: '00', - 'extension_priority': lambda *a: 1, - 'wait_time': lambda *a: 15, + 'active': True, + 'port': 5038, # Default AMI port + 'out_prefix': '0', + 'national_prefix': '0', + 'international_prefix': '00', + 'extension_priority': 1, + 'wait_time': 15, } def _check_validity(self, cr, uid, ids): @@ -325,8 +325,8 @@ asterisk_server() # Parameters specific for each user class res_users(osv.osv): - _name = "res.users" _inherit = "res.users" + _columns = { 'internal_number': fields.char('Internal number', size=15, help="User's internal phone number."), @@ -348,7 +348,7 @@ class res_users(osv.osv): } _defaults = { - 'asterisk_chan_type': lambda *a: 'SIP', + 'asterisk_chan_type': 'SIP', } def _check_validity(self, cr, uid, ids): @@ -465,10 +465,10 @@ class wizard_open_calling_partner(osv.osv_memory): } return action else: - _logger.debug("Could not find a partner corresponding to the calling number '%s'" % calling_number) # TODO : display an error message + _logger.debug("Could not find a partner corresponding to the calling number '%s'" % calling_number) raise osv.except_osv(_('Error :'), _("Could not find a partner corresponding to the calling number '%s'" % calling_number)) else: - _logger.debug("Could not retrieve the calling number from Asterisk") # TODO : display an error message + _logger.debug("Could not retrieve the calling number from Asterisk") raise osv.except_osv(_('Error :'), _("Could not retrieve the calling number from Asterisk")) wizard_open_calling_partner() @@ -476,8 +476,8 @@ wizard_open_calling_partner() # This module supports multi-company class res_company(osv.osv): - _name = "res.company" _inherit = "res.company" + _columns = { 'asterisk_server_ids': fields.one2many('asterisk.server', 'company_id', 'Asterisk servers', help="List of Asterisk servers.") } diff --git a/asterisk_click2dial/asterisk_click2dial_demo.xml b/asterisk_click2dial/asterisk_click2dial_demo.xml index ddc3a52..f253b44 100644 --- a/asterisk_click2dial/asterisk_click2dial_demo.xml +++ b/asterisk_click2dial/asterisk_click2dial_demo.xml @@ -2,7 +2,7 @@ diff --git a/asterisk_click2dial/asterisk_server_view.xml b/asterisk_click2dial/asterisk_server_view.xml index 1b0e6cc..667b0c3 100644 --- a/asterisk_click2dial/asterisk_server_view.xml +++ b/asterisk_click2dial/asterisk_server_view.xml @@ -2,7 +2,7 @@ @@ -32,10 +32,10 @@ - + - - + + @@ -76,7 +76,7 @@ - + diff --git a/asterisk_click2dial/res_partner_view.xml b/asterisk_click2dial/res_partner_view.xml index 5298f88..ea60044 100644 --- a/asterisk_click2dial/res_partner_view.xml +++ b/asterisk_click2dial/res_partner_view.xml @@ -2,7 +2,7 @@ @@ -13,14 +13,13 @@ asterisk.res.users.internal.number res.users - form - + - + diff --git a/asterisk_click2dial/security/asterisk_server_security.xml b/asterisk_click2dial/security/asterisk_server_security.xml index c8a58e3..25b51ff 100644 --- a/asterisk_click2dial/security/asterisk_server_security.xml +++ b/asterisk_click2dial/security/asterisk_server_security.xml @@ -2,7 +2,7 @@