Browse Source

Patch courtesy of daemon dog :

- add support for SCCP phones
- adds dial_suffix to allow some tweaking for SCCP phones
- move menu entry of asterisk servers to Settings >Configuration > Asterisk servers
- strip (0) from phone number in all scenarios

Added by me : re-org of res.users form view, to separate standard parameters from advanced/optional ones.
pull/26/head
nodenet-1 12 years ago
committed by Alexis de Lattre
parent
commit
d0a008beb9
  1. 2
      asterisk_click2dial/__openerp__.py
  2. 9
      asterisk_click2dial/asterisk_click2dial.py
  3. 5
      asterisk_click2dial/asterisk_server_view.xml
  4. 5
      asterisk_click2dial/res_users_view.xml
  5. 2
      asterisk_click2dial_crm/res_users_view.xml

2
asterisk_click2dial/__openerp__.py

@ -22,7 +22,7 @@
{
'name': 'Asterisk Click2dial',
'version': '0.3',
'version': '0.4',
'category': 'Extra Tools',
'license': 'AGPL-3',
'description': """This module adds 3 functionnalities :

9
asterisk_click2dial/asterisk_click2dial.py

@ -120,6 +120,10 @@ class asterisk_server(osv.osv):
if not tmp_number:
raise osv.except_osv(error_title_msg, invalid_format_msg)
# treat (0) as a special condition as we dont want an extra 0 to be inserted in the number
# FIXME all 0s after the country prefix should be stripped off
tmp_number = tmp_number.replace('(0)','')
# First, we remove all stupid caracters and spaces
for char_to_remove in [' ', '.', '(', ')', '[', ']', '-', '/']:
tmp_number = tmp_number.replace(char_to_remove, '')
@ -275,7 +279,7 @@ class asterisk_server(osv.osv):
# Dial with Asterisk
originate_act = 'Action: originate\r\n' + \
'Channel: ' + user.asterisk_chan_type + '/' + user.internal_number + '\r\n' + \
'Channel: ' + user.asterisk_chan_type + '/' + user.internal_number + ( ('/' + user.dial_suffix) if user.dial_suffix else '') + '\r\n' + \
'Priority: ' + str(ast_server.extension_priority) + '\r\n' + \
'Timeout: ' + str(ast_server.wait_time*1000) + '\r\n' + \
'CallerId: ' + user.callerid + '\r\n' + \
@ -359,6 +363,8 @@ class res_users(osv.osv):
_columns = {
'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,
help="Caller ID used for the calls initiated by this user."),
# You'd probably think : Asterisk should reuse the callerID of sip.conf !
@ -372,6 +378,7 @@ class res_users(osv.osv):
('MGCP', 'MGCP'),
('mISDN', 'mISDN'),
('H323', 'H323'),
('SCCP', 'SCCP'),
], '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'."),
'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. If you want to have several variable headers, separate them with '|'."),

5
asterisk_click2dial/asterisk_server_view.xml

@ -75,8 +75,9 @@
<field name="context">{'asterisk_server_main_view': True}</field>
</record>
<!-- Menu entry under Administration > Configuration -->
<menuitem action="action_asterisk_server" id="act_menu_ast_server" parent="base.menu_res_company_global" sequence="30" />
<!-- Menu entry under Settings > Configuration -->
<menuitem id="menu_asterisk_servers" name="Asterisk servers" parent="base.menu_config" groups="base.group_extended"/>
<menuitem action="action_asterisk_server" id="act_menu_ast_server" parent="menu_asterisk_servers" sequence="50"/>
</data>

5
asterisk_click2dial/res_users_view.xml

@ -17,12 +17,15 @@
<field name="arch" type="xml">
<page string="User" position="after">
<page string="Telephony">
<separator string="Standard parameters" colspan="4"/>
<field name="internal_number"/>
<field name="asterisk_chan_type"/>
<field name="callerid"/>
<field name="asterisk_server_id"/>
<separator string="Optional parameters - for experts only, can be left empty" colspan="4"/>
<field name="dial_suffix"/>
<field name="alert_info"/>
<field name="variable"/>
<field name="asterisk_server_id"/>
</page>
</page>
</field>

2
asterisk_click2dial_crm/res_users_view.xml

@ -14,7 +14,7 @@
<field name="model">res.users</field>
<field name="inherit_id" ref="asterisk_click2dial.asterisk_res_users_internal_number"/>
<field name="arch" type="xml">
<field name="variable" position="after">
<field name="asterisk_server_id" position="after">
<field name="context_propose_creation_crm_call"/>
</field>
</field>

Loading…
Cancel
Save