'''Asterisk server object, to store all the parameters of the Asterisk IPBXs'''
_name="asterisk.server"
_name="asterisk.server"
_description="Asterisk Servers"
_description="Asterisk Servers"
_columns={
_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="IPv4 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',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'."),
'national_format_allowed':fields.boolean('National format allowed ?',help="Do we allow to use click2dial on phone numbers written in national format, e.g. 01 41 98 12 42, or only in the international format, e.g. +33 1 41 98 12 42 ?"),
'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 Asterisk 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=40,help="Set Alert-Info header in SIP request to user's IP Phone. If empty, the Alert-Info header will not be added. You can use it to have a special ring tone for click2dial, for example you could choose a silent ring tone."),
'company_id':fields.many2one('res.company','Company',help="Company who uses the Asterisk server."),
'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="IPv4 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',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'."),
'national_format_allowed':fields.boolean('National format allowed ?',help="Do we allow to use click2dial on phone numbers written in national format, e.g. 01 41 98 12 42, or only in the international format, e.g. +33 1 41 98 12 42 ?"),
'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 Asterisk 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=40,help="Set Alert-Info header in SIP request to user's IP Phone. If empty, the Alert-Info header will not be added. You can use it to have a special ring tone for click2dial, for example you could choose a silent ring tone."),
'company_id':fields.many2one('res.company','Company',help="Company who uses the Asterisk server."),
'callerid':fields.char('Caller ID',size=50,help="Caller ID used for the calls initiated by this user."),
'asterisk_chan_type':fields.selection([('SIP','SIP'),('IAX2','IAX2'),('DAHDI','DAHDI'),('Zap','Zap'),('Skinny','Skinny'),('MGCP','MGCP'),('mISDN','mISDN'),('H323','H323')],'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'."),
'asterisk_server_id':fields.many2one('asterisk.server','Asterisk server',help="Asterisk server on which the user's phone is connected."),
'callerid':fields.char('Caller ID',size=50,help="Caller ID used for the calls initiated by this user."),
'asterisk_chan_type':fields.selection([('SIP','SIP'),('IAX2','IAX2'),('DAHDI','DAHDI'),('Zap','Zap'),('Skinny','Skinny'),('MGCP','MGCP'),('mISDN','mISDN'),('H323','H323')],'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'."),
'asterisk_server_id':fields.many2one('asterisk.server','Asterisk server',help="Asterisk server on which the user's phone is connected."),
}
}
_defaults={
_defaults={
@ -279,7 +280,7 @@ res_users()
classres_partner_address(osv.osv):
classres_partner_address(osv.osv):
_name="res.partner.address"
_name="res.partner.address"
_inherit="res.partner.address"
_inherit="res.partner.address"
defaction_dial_phone(self,cr,uid,ids,context):
defaction_dial_phone(self,cr,uid,ids,context):
'''Function called by the button 'Dial' next to the 'phone' field
'''Function called by the button 'Dial' next to the 'phone' field
@ -293,6 +294,30 @@ class res_partner_address(osv.osv):