Browse Source

Update the module description to add the new feature "open calling partner".

Code clean-up.
pull/26/head
Alexis de Lattre 12 years ago
parent
commit
a1327e3b6d
  1. 34
      asterisk_click2dial/__openerp__.py
  2. 24
      asterisk_click2dial/asterisk_click2dial.py
  3. 2
      asterisk_click2dial/asterisk_click2dial_demo.xml
  4. 10
      asterisk_click2dial/asterisk_server_view.xml
  5. 35
      asterisk_click2dial/res_partner_view.xml
  6. 7
      asterisk_click2dial/res_users_view.xml
  7. 2
      asterisk_click2dial/security/asterisk_server_security.xml

34
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',

24
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.")
}

2
asterisk_click2dial/asterisk_click2dial_demo.xml

@ -2,7 +2,7 @@
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010-2012 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
The licence is in the file __openerp__.py
Demo data for the click2dial module
-->

10
asterisk_click2dial/asterisk_server_view.xml

@ -2,7 +2,7 @@
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010-2012 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
The licence is in the file __openerp__.py
-->
<openerp>
@ -32,10 +32,10 @@
<field name="company_id" select="1" invisible="not context.get('asterisk_server_main_view', False)" />
<newline />
<field name="name" select="1" />
<field name="active" select="2" />
<field name="active" />
<field name="ip_address" select="1" />
<field name="port" select="2" />
<field name="login" select="2" />
<field name="port" />
<field name="login" />
<field name="password" password="True" />
<field name="context" />
<field name="extension_priority" />
@ -76,7 +76,7 @@
</record>
<!-- Menu entry under Administration > Configuration -->
<menuitem action="action_asterisk_server" id="act_menu_ast_server" parent="base.menu_config" />
<menuitem action="action_asterisk_server" id="act_menu_ast_server" parent="base.menu_res_company_global" sequence="30" />
</data>

35
asterisk_click2dial/res_partner_view.xml

@ -2,7 +2,7 @@
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010-2012 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
The licence is in the file __openerp__.py
Inherit partner_address views to add 'Dial' button next to 'phone'
and 'mobile' fields
@ -14,22 +14,19 @@
<record id="asterisk_res_partner_address_dial1" model="ir.ui.view">
<field name="name">asterisk.res.partner.address.dial1</field>
<field name="model">res.partner.address</field>
<field name="type">form</field>
<field name="priority">15</field>
<field name="inherit_id" ref="base.view_partner_address_form1"/>
<field name="arch" type="xml">
<data>
<field name="phone" position="replace">
<label string="Phone : " align="1.0" />
<group colspan="1" col="6">
<field name="phone" nolabel="1" colspan="5" select="2" />
<group colspan="2" col="8">
<field name="phone" colspan="7" />
<button name="action_dial_phone" string="Dial" type="object"/>
</group>
</field>
<field name="mobile" position="replace">
<label string="Mobile : " align="1.0" />
<group colspan="1" col="6">
<field name="mobile" nolabel="1" colspan="5" select="2" />
<group colspan="2" col="8">
<field name="mobile" colspan="7" />
<button name="action_dial_mobile" string="Dial" type="object"/>
</group>
</field>
@ -40,22 +37,19 @@
<record id="asterisk_res_partner_address_dial2" model="ir.ui.view">
<field name="name">asterisk.res.partner.address.dial2</field>
<field name="model">res.partner.address</field>
<field name="type">form</field>
<field name="priority">15</field>
<field name="inherit_id" ref="base.view_partner_address_form2"/>
<field name="arch" type="xml">
<data>
<field name="phone" position="replace">
<label string="Phone : " align="1.0" />
<group colspan="1" col="6">
<field name="phone" nolabel="1" colspan="5" select="2" />
<group colspan="2" col="8">
<field name="phone" colspan="7" />
<button name="action_dial_phone" string="Dial" type="object"/>
</group>
</field>
<field name="mobile" position="replace">
<label string="Mobile : " align="1.0" />
<group colspan="1" col="6">
<field name="mobile" nolabel="1" colspan="5" select="2" />
<group colspan="2" col="8">
<field name="mobile" colspan="7" />
<button name="action_dial_mobile" string="Dial" type="object"/>
</group>
</field>
@ -66,22 +60,19 @@
<record id="asterisk_res_partner_dial" model="ir.ui.view">
<field name="name">asterisk.res.partner.dial</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="priority">15</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<data>
<field name="phone" position="replace">
<label string="Phone : " align="1.0" />
<group colspan="1" col="6">
<field name="phone" nolabel="1" colspan="5" select="2" />
<group colspan="2" col="8">
<field name="phone" colspan="7" />
<button name="action_dial_phone" string="Dial" type="object"/>
</group>
</field>
<field name="mobile" position="replace">
<label string="Mobile : " align="1.0" />
<group colspan="1" col="6">
<field name="mobile" nolabel="1" colspan="5" select="2" />
<group colspan="2" col="8">
<field name="mobile" colspan="7" />
<button name="action_dial_mobile" string="Dial" type="object"/>
</group>
</field>

7
asterisk_click2dial/res_users_view.xml

@ -2,7 +2,7 @@
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010-2012 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
The licence is in the file __openerp__.py
Inherit res_users view to add the click2dial-related fields
-->
@ -13,14 +13,13 @@
<record id="asterisk_res_users_internal_number" model="ir.ui.view">
<field name="name">asterisk.res.users.internal.number</field>
<field name="model">res.users</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<page string="User" position="after">
<page string="Telephony">
<field name="internal_number" select="2"/>
<field name="internal_number"/>
<field name="asterisk_chan_type"/>
<field name="callerid" />
<field name="callerid"/>
<field name="asterisk_server_id"/>
</page>
</page>

2
asterisk_click2dial/security/asterisk_server_security.xml

@ -2,7 +2,7 @@
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010-2012 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
The licence is in the file __openerp__.py
-->
<openerp>

Loading…
Cancel
Save