Trever L. Adams
8 years ago
60 changed files with 1404 additions and 2 deletions
-
6asterisk_logcall/README.rst
-
1asterisk_logcall/__init__.py
-
39asterisk_logcall/__openerp__.py
-
2asterisk_logcall/models/__init__.py
-
64asterisk_logcall/models/asterisk_server.py
-
2asterisk_logcall/security/ir.model.access.csv
-
27asterisk_logcall/views/asterisk_server_view.xml
-
2crm_phone/__openerp__.py
-
3crm_phone/crm_phone.py
-
5crm_phone/view/crm_phonecall.xml
-
4crm_voip_logcall/README.rst
-
1crm_voip_logcall/__init__.py
-
35crm_voip_logcall/__openerp__.py
-
2crm_voip_logcall/models/__init__.py
-
36crm_voip_logcall/models/crm_voip_logcall.py
-
6freeswitch_logcall/README.rst
-
1freeswitch_logcall/__init__.py
-
39freeswitch_logcall/__openerp__.py
-
2freeswitch_logcall/models/__init__.py
-
64freeswitch_logcall/models/freeswitch_server.py
-
2freeswitch_logcall/security/ir.model.access.csv
-
26freeswitch_logcall/views/freeswitch_server_view.xml
-
44hr_recruitment_phone_log/README.rst
-
3hr_recruitment_phone_log/__init__.py
-
23hr_recruitment_phone_log/__openerp__.py
-
3hr_recruitment_phone_log/models/__init__.py
-
32hr_recruitment_phone_log/models/recruitment.py
-
2hr_recruitment_phone_log/security/ir.model.access.csv
-
56hr_recruitment_phone_log/views/recruitment_view.xml
-
18logcall/README.rst
-
1logcall/__init__.py
-
41logcall/__openerp__.py
-
2logcall/models/__init__.py
-
185logcall/models/crm_phonecall.py
-
202logcall/scripts/asterisk_logcall.py
-
5logcall/scripts/asterisk_logcall.sh
-
117logcall/scripts/freeswitch_logcall.lua
-
8logcall/security/ir.model.access.csv
-
17logcall/security/phone_integration_security.xml
-
18logcall/views/crm_phonecall_view.xml
-
33logcall/views/res_users_view.xml
-
44partner_phone_log/README.rst
-
3partner_phone_log/__init__.py
-
21partner_phone_log/__openerp__.py
-
3partner_phone_log/models/__init__.py
-
11partner_phone_log/models/partner.py
-
30partner_phone_log/views/partner_view.xml
-
44partner_phone_log_logcall/README.rst
-
1partner_phone_log_logcall/__init__.py
-
23partner_phone_log_logcall/__openerp__.py
-
2partner_phone_log_logcall/security/ir.model.access.csv
-
17partner_phone_log_logcall/views/partner_view.xml
-
1setup/hr_recruitment_phone_log/odoo_addons/hr_recruitment_phone_log
-
6setup/hr_recruitment_phone_log/setup.py
-
1setup/logcall/odoo_addons/logcall
-
6setup/logcall/setup.py
-
1setup/partner_phone_log/odoo_addons/partner_phone_log
-
6setup/partner_phone_log/setup.py
-
1setup/partner_phone_log_logcall/odoo_addons/partner_phone_log_logcall
-
6setup/partner_phone_log_logcall/setup.py
@ -0,0 +1,6 @@ |
|||
Asterisk Phone Log-call |
|||
========================= |
|||
|
|||
This bridge adds an option to the Asterisk IPBX servers for the URL to pull |
|||
down call recordings. It also adds an option for time jitter compensation |
|||
for use when automatically merging call records. |
@ -0,0 +1 @@ |
|||
from . import models |
@ -0,0 +1,39 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Phone Log-call module for Odoo/OpenERP |
|||
# Copyright (C) 2016 credativ Ltd (<http://credativ.co.uk>). |
|||
# Copyright (C) 2016 Trever L. Adams |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
|
|||
{ |
|||
'name': 'Asterisk Phone Log-call', |
|||
'version': '9.0.0.1.0', |
|||
'category': 'Phone', |
|||
'license': 'AGPL-3', |
|||
'summary': 'Necessary bridge between log-call and Asterisk Click2dial', |
|||
'author': "Trever L. Adams", |
|||
'website': '', |
|||
'depends': ['logcall', 'asterisk_click2dial'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/asterisk_server_view.xml', |
|||
], |
|||
'application': True, |
|||
'installable': True, |
|||
} |
@ -0,0 +1,2 @@ |
|||
from . import asterisk_server |
|||
|
@ -0,0 +1,64 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Phone Log-call module for Odoo/OpenERP |
|||
# Copyright (C) 2016 credativ Ltd (<http://credativ.co.uk>). |
|||
# Copyright (C) 2016 Trever L. Adams |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp import models, fields, api |
|||
import logging |
|||
|
|||
|
|||
logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class AsteriskServer(models.Model): |
|||
_inherit = "asterisk.server" |
|||
|
|||
ucp_url = fields.Char( |
|||
string='Script to download FreeSWITCH recordings', required=False, |
|||
default="https://localhost/cgi-bin/get_recording.pl?file={odoo_filename}", |
|||
help="Macros allowed: {odoo_type} (inbound, outbound), {odoo_src}" |
|||
"(source phone number}, {odoo_dst} (destination number), " |
|||
"{odoo_duration} (length of call), {odoo_start} (start time of call " |
|||
"in seconds since epoch), {odoo_filename} (file name on server), " |
|||
"{odoo_uniqueid} (FreeSWITCH UUID of call).") |
|||
server_jitter_correction = fields.Integer( |
|||
string='Time jitter compensation', required=True, |
|||
help='Number of seconds to subtract from new call start and add to ' |
|||
'new call end, for call merging, to compensate for system/database ' |
|||
'load and time drift between Asterisk server and Odoo/Odoo database ' |
|||
'server(s). 5 seconds is likely a good start. Above 10 seconds you get ' |
|||
'into the realm where you may have distinct calls confused. 20 - 30 ' |
|||
'seconds begins to guarantee this. It is best to keep this low ' |
|||
'and use a method to keep time synced.', |
|||
default=5) |
|||
|
|||
|
|||
class PhoneCommon(models.AbstractModel): |
|||
_inherit = 'phone.common' |
|||
|
|||
@api.model |
|||
def _get_ucp_url(self, users): |
|||
asterisk_server = users[0].get_asterisk_server_from_user() |
|||
return asterisk_server.ucp_url |
|||
|
|||
@api.model |
|||
def _get_jitter(self, users): |
|||
asterisk_server = users[0].get_asterisk_server_from_user() |
|||
return asterisk_server.server_jitter_correction |
@ -0,0 +1,2 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
ir_model_access_asterisk_server_phone_integration,Read access on asterisk.server,asterisk_click2dial.model_asterisk_server,logcall.group_phone_system_integration,1,0,0,0 |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Asterisk log call module |
|||
Copyright (C) 2016 Trever L. Adams |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="asterisk_logcall_extra_options" model="ir.ui.view"> |
|||
<field name="name">Asterisk IPBX Servers</field> |
|||
<field name="model">asterisk.server</field> |
|||
<field name="inherit_id" ref="asterisk_click2dial.view_asterisk_server_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//group[@name='dialplan']" position="after"> |
|||
<group name="extra" string="Extra Options"> |
|||
<field name="ucp_url"/> |
|||
<field name="server_jitter_correction"/> |
|||
</group> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,4 @@ |
|||
CRM VoIP Phone Log-call |
|||
======================= |
|||
|
|||
This bridge pulls in a configuration ption for use by logcall. This enables linking to call recordings in the logcall functionality. |
@ -0,0 +1 @@ |
|||
from . import models |
@ -0,0 +1,35 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Phone Log-call module for Odoo/OpenERP |
|||
# Copyright (C) 2016 credativ Ltd (<http://credativ.co.uk>). |
|||
# Copyright (C) 2016 Trever L. Adams |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
|
|||
{ |
|||
'name': 'CRM Voip Phone Log-call', |
|||
'version': '9.0.0.1.0', |
|||
'category': 'Phone', |
|||
'license': 'AGPL-3', |
|||
'summary': 'Necessary bridge between log-call and CRM VoIP module', |
|||
'author': "Trever L. Adams", |
|||
'website': '', |
|||
'depends': ['logcall', 'crm_voip'], |
|||
'application': True, |
|||
'installable': False, |
|||
} |
@ -0,0 +1,2 @@ |
|||
from . import freeswitch_server |
|||
|
@ -0,0 +1,36 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Phone Log-call module for Odoo/OpenERP |
|||
# Copyright (C) 2016 credativ Ltd (<http://credativ.co.uk>). |
|||
# Copyright (C) 2016 Trever L. Adams |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp import models, api |
|||
import logging |
|||
|
|||
|
|||
logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class PhoneCommon(models.AbstractModel): |
|||
_inherit = 'phone.common' |
|||
|
|||
@api.model |
|||
def _get_ucp_url(self, users): |
|||
base_url = params.get_param('crm.voip.ucp_url', default='http://localhost/ucp?quietmode=1&module=cdr&command=download&msgid={odoo_uniqueid}&type=download&format=wav&ext={caller_user}') |
|||
return base_url |
@ -0,0 +1,6 @@ |
|||
FreeSWITCH Phone Log-call |
|||
========================= |
|||
|
|||
This bridge adds an option to the FreeSWITCH servers for the URL to pull |
|||
down call recordings. It also adds an option for time jitter compensation |
|||
for use when automatically merging call records. |
@ -0,0 +1 @@ |
|||
from . import models |
@ -0,0 +1,39 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Phone Log-call module for Odoo/OpenERP |
|||
# Copyright (C) 2016 credativ Ltd (<http://credativ.co.uk>). |
|||
# Copyright (C) 2016 Trever L. Adams |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
|
|||
{ |
|||
'name': 'FreeSwitch Phone Log-call', |
|||
'version': '9.0.0.1.0', |
|||
'category': 'Phone', |
|||
'license': 'AGPL-3', |
|||
'summary': 'Necessary bridge between log-call and FreeSWITCH Click2dial', |
|||
'author': "Trever L. Adams", |
|||
'website': '', |
|||
'depends': ['logcall', 'freeswitch_click2dial'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/freeswitch_server_view.xml', |
|||
], |
|||
'application': True, |
|||
'installable': True, |
|||
} |
@ -0,0 +1,2 @@ |
|||
from . import freeswitch_server |
|||
|
@ -0,0 +1,64 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Phone Log-call module for Odoo/OpenERP |
|||
# Copyright (C) 2016 credativ Ltd (<http://credativ.co.uk>). |
|||
# Copyright (C) 2016 Trever L. Adams |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp import models, fields, api |
|||
import logging |
|||
|
|||
|
|||
logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class FreeSWITCHServer(models.Model): |
|||
_inherit = "freeswitch.server" |
|||
|
|||
ucp_url = fields.Char( |
|||
string='Script to download FreeSWITCH recordings', required=False, |
|||
default="https://localhost/cgi-bin/get_recording.pl?file={odoo_filename}", |
|||
help="Macros allowed: {odoo_type} (inbound, outbound), {odoo_src}" |
|||
"(source phone number}, {odoo_dst} (destination number), " |
|||
"{odoo_duration} (length of call), {odoo_start} (start time of call " |
|||
"in seconds since epoch), {odoo_filename} (file name on server), " |
|||
"{odoo_uniqueid} (FreeSWITCH UUID of call).") |
|||
server_jitter_correction = fields.Integer( |
|||
string='Time jitter compensation', required=True, |
|||
help='Number of seconds to subtract from new call start and add to ' |
|||
'new call end, for call merging, to compensate for system/database ' |
|||
'load and time drift between FreeSWITCH server and Odoo/Odoo database ' |
|||
'server(s). 5 seconds is likely a good start. Above 10 seconds you get ' |
|||
'into the realm where you may have distinct calls confused. 20 - 30 ' |
|||
'seconds begins to guarantee this. It is best to keep this low ' |
|||
'and use a method to keep time synced.', |
|||
default=5) |
|||
|
|||
|
|||
class PhoneCommon(models.AbstractModel): |
|||
_inherit = 'phone.common' |
|||
|
|||
@api.model |
|||
def _get_ucp_url(self, user): |
|||
fs_server = user.freeswitch_server_id |
|||
return fs_server.ucp_url |
|||
|
|||
@api.model |
|||
def _get_jitter(self, user): |
|||
fs_server = user.freeswitch_server_id |
|||
return fs_server.server_jitter_correction |
@ -0,0 +1,2 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
ir_model_access_freeswitch_server_phone_integration,Read access on freeswitch.server,freeswitch_click2dial.model_freeswitch_server,logcall.group_phone_system_integration,1,0,0,0 |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
FreeSWITCH log call module |
|||
Copyright (C) 2016 Trever L. Adams |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="freeswitch_logcall_extra_options" model="ir.ui.view"> |
|||
<field name="name">FreeSWITCH Servers</field> |
|||
<field name="model">freeswitch.server</field> |
|||
<field name="inherit_id" ref="freeswitch_click2dial.view_freeswitch_server_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//group[@name='dialplan']" position="after"> |
|||
<group name="extra" string="Extra Options"> |
|||
<field name="ucp_url"/> |
|||
<field name="server_jitter_correction"/> |
|||
</group> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,44 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
========================== |
|||
Show phonecalls on partner |
|||
========================== |
|||
|
|||
This module restores the phonecall list on the partner view. |
|||
|
|||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|||
:alt: Try me on Runbot |
|||
:target: https://runbot.odoo-community.org/runbot/140/9.0 |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-telephony/issues>`_. |
|||
In case of trouble, please check there if your issue has already been reported. |
|||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback |
|||
`here <https://github.com/OCA/connector-telephony/issues/new?body=module:%20partner_phone_log%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Ondřej Kuzník <ondrej.kuznik@credativ.co.uk> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
OCA, or the Odoo Community Association, is a nonprofit organization whose |
|||
mission is to support the collaborative development of Odoo features and |
|||
promote its widespread use. |
|||
|
|||
To contribute to this module, please visit https://odoo-community.org. |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import models |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# (c) 2016 credativ ltd. - Ondřej Kuzník |
|||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html |
|||
|
|||
{ |
|||
'name': 'Show phonecalls on HR Applicant', |
|||
'summary': 'Adds a phonecall log to HR Applicant', |
|||
'version': '9.0.1.0.0', |
|||
'category': 'Human Resources', |
|||
'author': 'credativ ltd., ' |
|||
'Odoo Community Association (OCA)', |
|||
'license': 'AGPL-3', |
|||
'depends': [ |
|||
'logcall', |
|||
'hr_recruitment_phone', |
|||
], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/recruitment_view.xml', |
|||
], |
|||
'application': True, |
|||
'installable': True, |
|||
} |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import recruitment |
@ -0,0 +1,32 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# (c) 2016 credativ ltd. - Ondřej Kuzník |
|||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html |
|||
|
|||
from openerp import models, fields, api |
|||
|
|||
|
|||
class CrmPhonecall(models.Model): |
|||
_inherit = "crm.phonecall" |
|||
|
|||
hr_applicant_id = fields.Many2one( |
|||
'hr.applicant', string='Applicant', ondelete='cascade') |
|||
|
|||
|
|||
class HrApplicant(models.Model): |
|||
_inherit = 'hr.applicant' |
|||
|
|||
phonecall_ids = fields.One2many('crm.phonecall', 'hr_applicant_id', string='Phone Calls') |
|||
phonecall_count = fields.Integer( |
|||
compute='_count_phonecalls', string='Number of Phonecalls', |
|||
readonly=True) |
|||
|
|||
@api.multi |
|||
@api.depends('phonecall_ids') |
|||
def _count_phonecalls(self): |
|||
cpo = self.env['crm.phonecall'] |
|||
for applicant in self: |
|||
try: |
|||
applicant.phonecall_count = cpo.search_count( |
|||
[('hr_applicant_id', '=', applicant.id)]) |
|||
except: |
|||
applicant.phonecall_count = 0 |
@ -0,0 +1,2 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
phone_system_integration_hr_applicant_write,Write access on hr.applicant for phone system integration and call logging,hr_recruitment.model_hr_applicant,logcall.group_phone_system_integration,1,1,0,0 |
@ -0,0 +1,56 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="crm_phonecall_search" model="ir.ui.view"> |
|||
<field name="name">crm.phonecall.search</field> |
|||
<field name="model">crm.phonecall</field> |
|||
<field name="inherit_id" ref="crm_phone.crm_phonecall_search"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='opportunity_id']" position="after"> |
|||
<field name="hr_applicant_id"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="hr_applicant_phonecall" model="ir.ui.view"> |
|||
<field name="name">hr_recruitment_phone.hr_applicant.form</field> |
|||
<field name="model">hr.applicant</field> |
|||
<field name="inherit_id" ref="hr_recruitment_phone.crm_case_form_view_job"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="message_ids" widget="mail_thread" position="replace"/> |
|||
|
|||
<xpath expr="//button[@name='action_makeMeeting']" position="before"> |
|||
<button class="oe_inline oe_stat_button" type="action" |
|||
name="%(crm_phone.crm_phonecall_action)d" |
|||
icon="fa-phone" |
|||
context="{'search_default_hr_applicant_id': active_id}"> |
|||
<field string="Calls" name="phonecall_count" widget="statinfo"/> |
|||
</button> |
|||
</xpath> |
|||
<xpath expr="//field[@name='description']" position="after"> |
|||
<notebook> |
|||
<page string="Internal Notes"> |
|||
<field name="message_ids" widget="mail_thread"/> |
|||
</page> |
|||
<page string="Communication"> |
|||
<field name="phonecall_ids" mode="tree" readonly="1"> |
|||
<tree string="Phonecalls" create="false" delete="false" |
|||
colors="gray:state in ('done', 'cancelled')"> |
|||
<field name="date"/> |
|||
<field name="end_date"/> |
|||
<field name="name"/> |
|||
<field name="partner_phone"/> |
|||
<field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_salesman_all_leads']}"/> |
|||
<field name="direction"/> |
|||
<field name="state"/> |
|||
</tree> |
|||
</field> |
|||
</page> |
|||
</notebook> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,18 @@ |
|||
Phone Log-call |
|||
================= |
|||
|
|||
When a call has completed within Asterisk, FreeSWITCH or similar |
|||
a callback can be added in a hangup handler to call a script |
|||
which sends a request to Odoo to log the call. |
|||
|
|||
This module requires a module providing _get_ucp_url and _get_jitter |
|||
functions in PhoneCommon. These provide a URL template for downloading |
|||
recordings (false is fine) and the number of seconds to use to make |
|||
sure there are no problems in merging call logs, respectively. |
|||
|
|||
Merging of call logs is automatic if, and only if, the call existing in |
|||
the database as a state time between the start of the new call minus jitter |
|||
and end of the new call plus jitter. It keep the data making the call the |
|||
longest. It will keep the original attachment, ignoring a new one. It will |
|||
append the new call description to the old making sure that the old ends with |
|||
a new line. |
@ -0,0 +1 @@ |
|||
from . import models |
@ -0,0 +1,41 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Phone Log-call module for Odoo/OpenERP |
|||
# Copyright (C) 2016 credativ Ltd (<http://credativ.co.uk>). |
|||
# Copyright (C) 2016 Trever L. Adams |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
|
|||
{ |
|||
'name': 'Phone Log-call', |
|||
'version': '9.0.0.1.0', |
|||
'category': 'Phone', |
|||
'license': 'AGPL-3', |
|||
'summary': 'Allow a call to be logged in Odoo', |
|||
'author': "credativ Ltd,Odoo Community Association (OCA)", |
|||
'website': 'http://www.credativ.co.uk/', |
|||
'depends': ['base_phone', 'crm_phone'], |
|||
'data': [ |
|||
'security/phone_integration_security.xml', |
|||
'security/ir.model.access.csv', |
|||
'views/crm_phonecall_view.xml', |
|||
'views/res_users_view.xml' |
|||
], |
|||
'application': True, |
|||
'installable': True, |
|||
} |
@ -0,0 +1,2 @@ |
|||
from . import crm_phonecall |
|||
|
@ -0,0 +1,185 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Phone Log-call module for Odoo/OpenERP |
|||
# Copyright (C) 2016 credativ Ltd (<http://credativ.co.uk>). |
|||
# Copyright (C) 2016 Trever L. Adams |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp import models, fields, api, _ |
|||
from datetime import datetime, timedelta |
|||
from pytz import timezone, utc |
|||
import logging |
|||
|
|||
|
|||
logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class ResUsers(models.Model): |
|||
_inherit = 'res.users' |
|||
|
|||
context_auto_log_calls = fields.Boolean( |
|||
string='Automatically Log Incoming Calls', default=True) |
|||
|
|||
|
|||
class CrmPhonecall(models.Model): |
|||
_inherit = "crm.phonecall" |
|||
|
|||
recording_id = fields.Many2one('ir.attachment', string='Call Recording', |
|||
readonly=True) |
|||
|
|||
|
|||
class PhoneCommon(models.AbstractModel): |
|||
_inherit = 'phone.common' |
|||
|
|||
@api.model |
|||
def _get_ucp_url(self): |
|||
pass |
|||
|
|||
@api.model |
|||
def log_call_and_recording(self, odoo_type, odoo_src, odoo_dst, |
|||
odoo_duration, odoo_start, odoo_filename, |
|||
odoo_uniqueid, odoo_description): |
|||
phonecall_obj = self.env['crm.phonecall'] |
|||
attach_obj = self.env['ir.attachment'] |
|||
attach_id = False |
|||
search_field = False |
|||
|
|||
caller_user, caller_external = (odoo_type == 'incoming' and |
|||
(odoo_dst, odoo_src) or |
|||
(odoo_src, odoo_dst)) |
|||
|
|||
call_name_prefix = (odoo_type == 'incoming' and "Call from %s" or |
|||
"Call to %s") |
|||
|
|||
users = self.env['res.users'].search( |
|||
[('internal_number', '=', caller_user)]) |
|||
|
|||
if not users or not users[0].context_auto_log_calls: |
|||
return False |
|||
|
|||
tz = users[0].partner_id.tz |
|||
|
|||
tz = timezone(tz) if tz else utc |
|||
odoo_start = datetime(1970, 1, 1, tzinfo=tz) + \ |
|||
timedelta(seconds=float(odoo_start)) |
|||
odoo_end = odoo_start + timedelta(seconds=float(odoo_duration)) |
|||
|
|||
phonecall_data = { |
|||
'partner_phone': caller_external, |
|||
'name': call_name_prefix % (caller_external,), |
|||
'opportunity_id': False, |
|||
'partner_id': False, |
|||
'hr_applicant_id': False, |
|||
'end_date': odoo_end, |
|||
'state': 'done', |
|||
'date': odoo_start, |
|||
'direction': 'inbound' if odoo_type == 'incoming' else 'outbound', |
|||
'description': odoo_description |
|||
} |
|||
|
|||
r = self.get_record_from_phone_number(caller_external) |
|||
if not r: |
|||
logger.warning("No partner found for number %s" % caller_external) |
|||
return phonecall_obj |
|||
elif r[0] == 'res.partner': |
|||
phonecall_data['partner_id'] = r[1] |
|||
search_field = 'partner_id' |
|||
if r[2]: |
|||
phonecall_data['name'] = call_name_prefix % (r[2],) |
|||
elif r[0] == 'crm.lead': |
|||
phonecall_data['opportunity_id'] = r[1] |
|||
search_field = 'opportunity_id' |
|||
if r[2]: |
|||
phonecall_data['name'] = call_name_prefix % (r[2],) |
|||
elif r[0] == 'hr.applicant': |
|||
phonecall_data['hr_applicant_id'] = r[1] |
|||
search_field = 'hr_applicant_id' |
|||
if r[2]: |
|||
phonecall_data['name'] = call_name_prefix % (r[2],) |
|||
record = self.env[r[0]].browse(r[1]) |
|||
|
|||
if users: |
|||
phonecall_data['user_id'] = users[0].id |
|||
|
|||
jitter = self._get_jitter(users[0]) |
|||
jitter_start = datetime.strftime(odoo_start - |
|||
timedelta(seconds=float(jitter)), |
|||
'%Y-%m-%d %H:%M:%S') |
|||
jitter_end = datetime.strftime(odoo_end + |
|||
timedelta(seconds=float(jitter)), |
|||
'%Y-%m-%d %H:%M:%S') |
|||
|
|||
phonecalls = phonecall_obj.search([ |
|||
('date', '>=', jitter_start), |
|||
('end_date', '<=', jitter_end), |
|||
(search_field, '=', r[1]), |
|||
('user_id', '=', users[0].id), |
|||
('direction', '=', phonecall_data['direction'])]) |
|||
|
|||
if phonecalls: |
|||
if (odoo_end.replace(tzinfo=None) < |
|||
datetime.strptime(phonecalls[0]['end_date'], |
|||
'%Y-%m-%d %H:%M:%S')): |
|||
odoo_end = \ |
|||
phonecalls[0]['end_date'].strptime('%Y-%m-%d %H:%M:%S') |
|||
if (odoo_start.replace(tzinfo=None) > |
|||
datetime.strptime(phonecalls[0]['date'], |
|||
'%Y-%m-%d %H:%M:%S')): |
|||
odoo_start = \ |
|||
phonecalls[0]['date'].strptime('%Y-%m-%d %H:%M:%S') |
|||
if phonecalls[0]['description']: |
|||
odoo_description = phonecalls[0]['description'] + '\n' + \ |
|||
odoo_description |
|||
if phonecalls[0]['recording_id']: |
|||
attach_id = phonecalls[0]['recording_id'] |
|||
phonecall_id = phonecalls[0] |
|||
phonecalls[0].write({'end_date': odoo_end, 'date': odoo_start, |
|||
'description': odoo_description, |
|||
'recording_id': |
|||
(attach_id.id if attach_id else False)}) |
|||
else: |
|||
phonecall_id = phonecall_obj.create(phonecall_data) |
|||
|
|||
if odoo_filename and not attach_id: |
|||
base_url = self._get_ucp_url(users[0]) |
|||
ir_attachment_data = { |
|||
'res_model': 'crm.phonecall', |
|||
'res_id': phonecall_id.id, |
|||
'name': phonecall_data['name'], |
|||
'type': 'url', |
|||
'mimetype': 'audio/wav', |
|||
'url': base_url.format(caller_user=caller_user, |
|||
odoo_type=odoo_type, |
|||
odoo_src=odoo_src, |
|||
odoo_dst=odoo_dst, |
|||
odoo_duration=odoo_duration, |
|||
odoo_start=odoo_start, |
|||
odoo_uniqueid=odoo_uniqueid.replace('.', '_'), |
|||
odoo_filename=odoo_filename), |
|||
'datas_fname': odoo_filename, |
|||
} |
|||
attach_id = attach_obj.create(ir_attachment_data) |
|||
phonecall_id.write({'recording_id': attach_id.id}) |
|||
|
|||
message_format = _("Recorded %s call (%%sm)." % odoo_type) |
|||
record.message_post( |
|||
body=message_format % (int(odoo_duration) / 60,), |
|||
message_type='comment', |
|||
attachment_ids=attach_id._ids) |
|||
|
|||
return phonecall_id.id |
@ -0,0 +1,202 @@ |
|||
#! /usr/bin/python |
|||
# -*- encoding: utf-8 -*- |
|||
# Copyright (C) 2010-2015 Alexis de Lattre <alexis.delattre@akretion.com> |
|||
# Copyright (C) 2016 credativ Ltd (<http://credativ.co.uk>). |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
|
|||
""" |
|||
Log a call and recording within Asterisk |
|||
|
|||
This is intended to be called by a hangup handler: |
|||
|
|||
Please, note the start is seconds since EPOCH in UTC, it must be UTC. |
|||
|
|||
Example: |
|||
[from-pstn-custom] |
|||
... |
|||
exten => _X!,n,Set(CHANNEL(hangup_handler_push)=from-pstn-hdlr,s,1(args)) |
|||
|
|||
[from-pstn-hdlr] |
|||
exten => s,1,Verbose(0, from-pstn-hdlr called) |
|||
same => n,Set(odoo_type=incoming) |
|||
same => n,Set(odoo_src=${CDR(src)}) |
|||
same => n,Set(odoo_dst=${CDR(dst)}) |
|||
same => n,Set(odoo_duration=${CDR(duration)}) |
|||
same => n,Set(odoo_start=${CDR(start)}) |
|||
same => n,Set(odoo_filename=${CDR(recordingfile)}) |
|||
same => n,Set(odoo_uniqueid=${UNIQUEID}) |
|||
same => n,AGI(/usr/local/bin/asterisk_logcall.sh,${odoo_type},${odoo_src},${odoo_dst},${odoo_duration},${odoo_start},${odoo_filename},${odoo_uniqueid}) |
|||
same => n,Return() |
|||
|
|||
To test from the CLI: |
|||
./asterisk_logcall.sh << EOF |
|||
agi_arg_1: outgoing |
|||
agi_arg_2: 875 |
|||
agi_arg_3: 01234567890 |
|||
agi_arg_4: 345 |
|||
agi_arg_5: 1234567890 |
|||
agi_arg_6: out-875-unknown-20160216-154438-1455637478.61.wav |
|||
agi_arg_7: 1455637478.61 |
|||
agi_arg_8: Description may include things like hangup cause, transfer, automated notes |
|||
EOF |
|||
|
|||
""" |
|||
|
|||
__author__ = "Craig Gowing <craig.gowing@credativ.co.uk> & Alexis de Lattre <alexis.delattre@akretion.com>" |
|||
__date__ = "February 2016" |
|||
__version__ = "0.2" |
|||
|
|||
import xmlrpclib |
|||
import sys |
|||
from optparse import OptionParser |
|||
|
|||
# Define command line options |
|||
options = [ |
|||
{'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 SSL connections instead of clear connections. " |
|||
"Default = no, use clear XML-RPC or JSON-RPC", |
|||
'action': 'store_true', 'default': False}, |
|||
{'names': ('-j', '--jsonrpc'), 'dest': 'jsonrpc', |
|||
'help': "Use JSON-RPC instead of the default protocol XML-RPC. " |
|||
"Default = no, use 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': 'userid', 'type': 'int', |
|||
'action': 'store', 'default': 2, |
|||
'help': "OpenERP user ID to use when connecting to OpenERP in " |
|||
"XML-RPC. Default = 2"}, |
|||
{'names': ('-t', '--username'), 'dest': 'username', 'type': 'string', |
|||
'action': 'store', 'default': 'demo', |
|||
'help': "OpenERP username to use when connecting to OpenERP in " |
|||
"JSON-RPC. Default = demo"}, |
|||
{'names': ('-w', '--password'), 'dest': 'password', 'type': 'string', |
|||
'action': 'store', 'default': 'demo', |
|||
'help': "Password of the OpenERP user. Default = 'demo'"}, |
|||
] |
|||
|
|||
def stdout_write(string): |
|||
'''Wrapper on sys.stdout.write''' |
|||
sys.stdout.write(string.encode(sys.stdout.encoding or 'utf-8', 'replace')) |
|||
sys.stdout.flush() |
|||
# When we output a command, we get an answer "200 result=1" on stdin |
|||
# Purge stdin to avoid these Asterisk error messages : |
|||
# utils.c ast_carefulwrite: write() returned error: Broken pipe |
|||
sys.stdin.readline() |
|||
return True |
|||
|
|||
|
|||
def stderr_write(string): |
|||
'''Wrapper on sys.stderr.write''' |
|||
sys.stderr.write(string.encode(sys.stdout.encoding or 'utf-8', 'replace')) |
|||
sys.stdout.flush() |
|||
return True |
|||
|
|||
def main(options, arguments): |
|||
|
|||
# AGI passes parameters to the script on standard input |
|||
stdinput = {} |
|||
while 1: |
|||
input_line = sys.stdin.readline() |
|||
if not input_line: |
|||
break |
|||
line = input_line.strip() |
|||
try: |
|||
variable, value = line.split(':', 1) |
|||
except: |
|||
break |
|||
if variable[:4] != 'agi_': # All AGI parameters start with 'agi_' |
|||
stderr_write("bad stdin variable : %s\n" % variable) |
|||
continue |
|||
variable = variable.strip() |
|||
value = value.strip() |
|||
if variable and value: |
|||
stdinput[variable] = value |
|||
stderr_write("full AGI environnement :\n") |
|||
|
|||
for variable in stdinput.keys(): |
|||
stderr_write("%s = %s\n" % (variable, stdinput.get(variable))) |
|||
|
|||
odoo_type = stdinput.get('agi_arg_1', '') |
|||
odoo_src = stdinput.get('agi_arg_2', '') |
|||
odoo_dst = stdinput.get('agi_arg_3', '') |
|||
odoo_duration = stdinput.get('agi_arg_4', '') |
|||
odoo_start = stdinput.get('agi_arg_5', '') |
|||
odoo_filename = stdinput.get('agi_arg_6', '') |
|||
odoo_uniqueid = stdinput.get('agi_arg_7', '') |
|||
odoo_description = stdinput.get('agi_arg_8', '') |
|||
|
|||
method = 'log_call_and_recording' |
|||
|
|||
res = False |
|||
# Yes, this script can be used without "-s openerp_server" ! |
|||
if options.server and options.jsonrpc: |
|||
import odoorpc |
|||
proto = options.ssl and 'jsonrpc+ssl' or 'jsonrpc' |
|||
stdout_write( |
|||
'VERBOSE "Starting %s request on OpenERP %s:%d database ' |
|||
'%s username %s"\n' % ( |
|||
proto.upper(), options.server, options.port, options.database, |
|||
options.username)) |
|||
try: |
|||
odoo = odoorpc.ODOO(options.server, proto, options.port) |
|||
odoo.login(options.database, options.username, options.password) |
|||
res = odoo.execute( |
|||
'phone.common', 'log_call_and_recording', odoo_type, odoo_src, odoo_dst, odoo_duration, odoo_start, odoo_filename, odoo_uniqueid, odoo_description) |
|||
stdout_write('VERBOSE "Called method %s, returned %s"\n' % (method, res)) |
|||
except: |
|||
stdout_write( |
|||
'VERBOSE "Could not connect to OpenERP in JSON-RPC"\n') |
|||
elif options.server: |
|||
proto = options.ssl and 'https' or 'http' |
|||
stdout_write( |
|||
'VERBOSE "Starting %s XML-RPC request on OpenERP %s:%d ' |
|||
'database %s user ID %d"\n' % ( |
|||
proto, options.server, options.port, options.database, |
|||
options.userid)) |
|||
sock = xmlrpclib.ServerProxy( |
|||
'%s://%s:%d/xmlrpc/object' |
|||
% (proto, options.server, options.port)) |
|||
try: |
|||
res = sock.execute( |
|||
options.database, options.userid, options.password, |
|||
'phone.common', 'log_call_and_recording', odoo_type, odoo_src, odoo_dst, odoo_duration, odoo_start, odoo_filename, odoo_uniqueid, odoo_description) |
|||
stdout_write('VERBOSE "Called method %s, returned %s"\n' % (method, res)) |
|||
except: |
|||
stdout_write('VERBOSE "Could not connect to OpenERP in XML-RPC"\n') |
|||
|
|||
return True |
|||
|
|||
if __name__ == '__main__': |
|||
usage = "Usage: asterisk_logcall.py [options] login1 login2 login3 ..." |
|||
epilog = "Script written by Craig Gowing based on work by Alexis de Lattre. " |
|||
"Published under the GNU AGPL licence." |
|||
description = "This is an AGI script that sends a query to OpenERP. " |
|||
parser = OptionParser(usage=usage, epilog=epilog, description=description) |
|||
for option in options: |
|||
param = option['names'] |
|||
del option['names'] |
|||
parser.add_option(*param, **option) |
|||
options, arguments = parser.parse_args() |
|||
sys.argv[:] = arguments |
|||
main(options, arguments) |
@ -0,0 +1,5 @@ |
|||
#! /bin/sh |
|||
|
|||
PATH=/usr/local/sbin:/usr/local/bin:/var/lib/asterisk/agi-bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/share/asterisk/agi-bin:. |
|||
|
|||
timeout 10s asterisk_logcall.py --server localhost --database 9.0-test --user-id 1 --password "admin" |
@ -0,0 +1,117 @@ |
|||
-- Copyright (C) 2016 Trever L. Adams |
|||
-- based on code and ideas by Craig Gowing <craig.gowing@credativ.co.uk> |
|||
-- & Alexis de Lattre <alexis.delattre@akretion.com> |
|||
-- License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
-- This module assumes calls start at creation not answer. |
|||
-- It works on incoming and outgoing calls. |
|||
-- See code for the line to uncomment to change this. |
|||
|
|||
-- Add the following to the appropriate places in your dialplan |
|||
-- Outbound (default dialplan, extension to extension, and anything out via gateway or via FXO: |
|||
-- <action application="set" data="api_hangup_hook=lua freeswitch_logcall.lua"/> |
|||
-- Inbound (public dialplan): |
|||
-- <action application="export" data="odoo_type="inbound"/> |
|||
-- <action application="export" data="nolocal:api_hangup_hook=lua freeswitch_logcall.lua"/> |
|||
|
|||
require("xmlrpc.http") |
|||
|
|||
function GetFileName(url) |
|||
if url == nil then |
|||
return "" |
|||
end |
|||
return url:match("^.+/(.+)$") |
|||
end |
|||
|
|||
function getTransferTarget(app_data) |
|||
if app_data == nil then |
|||
return "" |
|||
end |
|||
app_data = app_data:gsub("-.?leg%s*", "") |
|||
app_data = app_data:sub(1, string.find(app_data, " "), -2) |
|||
return app_data |
|||
end |
|||
|
|||
-- Change these to meet your installation |
|||
local port=8069; |
|||
local server="localhost"; |
|||
options_database = "odoo-test" |
|||
options_userid = 1 |
|||
options_password = "testtesttest" |
|||
|
|||
-- Best not change anything below |
|||
local protocol="https" |
|||
server_string = protocol .. "://" .. server .. ":" .. port .. "/xmlrpc/2/object" |
|||
|
|||
function odoo_report_call(odoo_type, odoo_src, odoo_dst, odoo_duration, odoo_start, odoo_filename, odoo_uniqueid, odoo_description) |
|||
local ok, res = xmlrpc.http.call(server_string, 'execute', options_database, options_userid, options_password, |
|||
'phone.common', 'log_call_and_recording', odoo_type, odoo_src, odoo_dst, odoo_duration, odoo_start, |
|||
odoo_filename, odoo_uniqueid, odoo_description) |
|||
assert(ok, string.format("XML-RPC call failed on client: %s", tostring(res))) |
|||
end |
|||
|
|||
odoo_hangupcause = env:getHeader("variable_hangup_cause") |
|||
if odoo_hangupcause == "LOSE_RACE" then |
|||
return |
|||
end |
|||
|
|||
odoo_type = env:getHeader("odoo_type") |
|||
if odoo_type == 'inbound' then |
|||
odoo_type = 'incoming' |
|||
else |
|||
odoo_type = 'outgoing' |
|||
end |
|||
if env:getHeader("Caller-RDNIS") then |
|||
redirected = true |
|||
end |
|||
name = env:getHeader("origination_caller_id_name") |
|||
if name == "Odoo Connector" then |
|||
odoo_type = 'outgoing' |
|||
end |
|||
odoo_connector = env:getHeader("odoo_connector") |
|||
if odoo_connector then |
|||
odoo_src = env:getHeader("dialed_user") |
|||
else |
|||
odoo_src = env:getHeader("Caller-Caller-ID-Number") |
|||
end |
|||
odoo_dst = env:getHeader("Caller-Destination-Number") |
|||
odoo_dst2 = env:getHeader("Other-Leg-Destination-Number") |
|||
if odoo_dst2 then |
|||
if string.len(odoo_dst) < string.len(odoo_dst2) then |
|||
odoo_dst = odoo_dst2 |
|||
end |
|||
end |
|||
if redirected and odoo_type == "outgoing" and odoo_connector == nil then |
|||
odoo_src, odoo_dst = odoo_dst, odoo_src |
|||
end |
|||
odoo_filename = env:getHeader("variable_rec_file") |
|||
odoo_uniqueid = env:getHeader("variable_uuid") |
|||
|
|||
if odoo_filename == nil then |
|||
odoo_filename = "" |
|||
else |
|||
odoo_filename = GetFileName(odoo_filename) |
|||
end |
|||
if odoo_hangupcause == nil then |
|||
odoo_hangupcause = "" |
|||
end |
|||
app_name = env:getHeader("variable_last_app") |
|||
app_data = getTransferTarget(env:getHeader("variable_last_arg")) |
|||
if app_name == "transfer" then |
|||
odoo_hangupcause = "[" .. odoo_hangupcause .. " / TRANSFERRED TO: " .. app_data .. "]" |
|||
else |
|||
odoo_hangupcause = "[" .. odoo_hangupcause .. "]" |
|||
end |
|||
|
|||
if redirected == true then |
|||
odoo_start = tonumber(env:getHeader("bridge_epoch")) |
|||
else |
|||
odoo_start = tonumber(env:getHeader("start_epoch")) |
|||
-- odoo_start = tonumber(env:getHeader("answer_epoch")) |
|||
end |
|||
local end_epoch = tonumber(env:getHeader("end_epoch")) |
|||
if odoo_start ~= nil and end_epoch ~= nil then |
|||
odoo_duration = tonumber(end_epoch) - tonumber(odoo_start) |
|||
end |
|||
|
|||
odoo_report_call(odoo_type, odoo_src, odoo_dst, tostring(odoo_duration), tostring(odoo_start), odoo_filename, odoo_uniqueid, odoo_hangupcause) |
@ -0,0 +1,8 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
phone_system_integration_phone_common_read,Read access on phone.common for phone system integration and call logging,model_phone_common,group_phone_system_integration,1,0,0,0 |
|||
phone_system_integration_crm_phonecall_create,Create access on crm.phonecall for phone system integration and call logging,model_crm_phonecall,group_phone_system_integration,1,1,1,0 |
|||
phone_system_integration_ir_attachment_create,Create access on ir.attachment for phone system integration and call logging,base.model_ir_attachment,group_phone_system_integration,1,1,1,0 |
|||
phone_system_integration_mail.message_create,Create access on mail.message for phone system integration and call logging,mail.model_mail_message,group_phone_system_integration,1,1,1,0 |
|||
phone_system_integration_mail.message_create,Create access on mail.followers for phone system integration and call logging,mail.model_mail_followers,group_phone_system_integration,1,1,1,0 |
|||
phone_system_integration_res_partner_write,Write access on res.partner for phone system integration and call logging,base.model_res_partner,group_phone_system_integration,1,1,0,0 |
|||
phone_system_integration_crm_lead_write,Write access on crm.lead for phone system integration and call logging,sale_crm.model_crm_lead,group_phone_system_integration,1,1,0,0 |
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
logcall module for Odoo/OpenERP |
|||
Copyright (C) 2016 Trever L. Adams |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data noupdate="1"> |
|||
|
|||
<!-- New group dedicated to the "Phone System Integration and Logging with Odoo" feature --> |
|||
<record id="group_phone_system_integration" model="res.groups"> |
|||
<field name="name">Phone System Integration and Logging</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="crm_phonecall_tree_view_recording_link" model="ir.ui.view"> |
|||
<field name="name">CRM - Phonecalls Tree</field> |
|||
<field name="model">crm.phonecall</field> |
|||
<field name="inherit_id" ref="crm_phone.crm_phonecall_tree"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='opportunity_id']" position="after"> |
|||
<field name="recording_id"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
|||
|
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
© 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
|
|||
<odoo> |
|||
<data> |
|||
|
|||
<record id="view_users_form" model="ir.ui.view"> |
|||
<field name="name">logcall.res.users.form</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base_phone.view_users_form"/> |
|||
<field name="arch" type="xml"> |
|||
<group name="phone-preferences" position="inside"> |
|||
<field name="context_auto_log_calls"/> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_users_form_simple_modif" model="ir.ui.view"> |
|||
<field name="name">logcall.users.preferences.view</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base_phone.view_users_form_simple_modif" /> |
|||
<field name="arch" type="xml"> |
|||
<group name="phone" position="inside"> |
|||
<field name="context_auto_log_calls" readonly="0"/> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</odoo> |
@ -0,0 +1,44 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
========================== |
|||
Show phonecalls on partner |
|||
========================== |
|||
|
|||
This module restores the phonecall list on the partner view. |
|||
|
|||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|||
:alt: Try me on Runbot |
|||
:target: https://runbot.odoo-community.org/runbot/140/9.0 |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-telephony/issues>`_. |
|||
In case of trouble, please check there if your issue has already been reported. |
|||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback |
|||
`here <https://github.com/OCA/connector-telephony/issues/new?body=module:%20partner_phone_log%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Ondřej Kuzník <ondrej.kuznik@credativ.co.uk> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
OCA, or the Odoo Community Association, is a nonprofit organization whose |
|||
mission is to support the collaborative development of Odoo features and |
|||
promote its widespread use. |
|||
|
|||
To contribute to this module, please visit https://odoo-community.org. |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import models |
@ -0,0 +1,21 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# (c) 2016 credativ ltd. - Ondřej Kuzník |
|||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html |
|||
|
|||
{ |
|||
'name': 'Show phonecalls on partner', |
|||
'summary': 'Adds a phonecall log to partner', |
|||
'version': '9.0.1.0.0', |
|||
'category': 'Customer Relationship Management', |
|||
'author': 'credativ ltd., ' |
|||
'Odoo Community Association (OCA)', |
|||
'license': 'AGPL-3', |
|||
'depends': [ |
|||
'crm_phone', |
|||
], |
|||
'data': [ |
|||
'views/partner_view.xml', |
|||
], |
|||
'application': True, |
|||
'installable': True, |
|||
} |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import partner |
@ -0,0 +1,11 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# (c) 2016 credativ ltd. - Ondřej Kuzník |
|||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html |
|||
|
|||
from openerp import models, fields |
|||
|
|||
|
|||
class ResPartner(models.Model): |
|||
_inherit = 'res.partner' |
|||
|
|||
phonecall_ids = fields.One2many('crm.phonecall', 'partner_id') |
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="res_partner_phonecall" model="ir.ui.view"> |
|||
<field name="name">res.partner.type.form.inherit</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_partner_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//notebook" position="inside"> |
|||
<page string="Communication"> |
|||
<field name="phonecall_ids" mode="tree" readonly="1"> |
|||
<tree string="Phonecalls" create="false" delete="false" |
|||
colors="gray:state in ('done', 'cancelled')"> |
|||
<field name="date"/> |
|||
<field name="end_date"/> |
|||
<field name="name"/> |
|||
<field name="partner_phone"/> |
|||
<field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'base.group_sale_salesman_all_leads']}"/> |
|||
<field name="state"/> |
|||
<field name="opportunity_id"/> |
|||
</tree> |
|||
</field> |
|||
</page> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,44 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
============================================== |
|||
Glue to show recording on partner's phonecalls |
|||
============================================== |
|||
|
|||
This module adds the recording link to partner's phonecalls |
|||
|
|||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|||
:alt: Try me on Runbot |
|||
:target: https://runbot.odoo-community.org/runbot/140/9.0 |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-telephony/issues>`_. |
|||
In case of trouble, please check there if your issue has already been reported. |
|||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback |
|||
`here <https://github.com/OCA/connector-telephony/issues/new?body=module:%20partner_phone_log_logcall%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Ondřej Kuzník <ondrej.kuznik@credativ.co.uk> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
OCA, or the Odoo Community Association, is a nonprofit organization whose |
|||
mission is to support the collaborative development of Odoo features and |
|||
promote its widespread use. |
|||
|
|||
To contribute to this module, please visit https://odoo-community.org. |
@ -0,0 +1 @@ |
|||
# -*- coding: utf-8 -*- |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# (c) 2016 credativ ltd. - Ondřej Kuzník |
|||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html |
|||
|
|||
{ |
|||
'name': 'Glue between asterisk_logcall and partner_phone_log', |
|||
'summary': 'Adds a recording column', |
|||
'version': '9.0.1.0.0', |
|||
'category': 'Customer Relationship Management', |
|||
'author': 'credativ ltd., ' |
|||
'Odoo Community Association (OCA)', |
|||
'license': 'AGPL-3', |
|||
'depends': [ |
|||
'logcall', |
|||
'partner_phone_log', |
|||
], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/partner_view.xml', |
|||
], |
|||
'application': True, |
|||
'installable': True, |
|||
} |
@ -0,0 +1,2 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
phone_system_integration_res_partner_write,Write access on res.partner for phone system integration and call logging,base.model_res_partner,logcall.group_phone_system_integration,1,1,0,0 |
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="res_partner_phonecall" model="ir.ui.view"> |
|||
<field name="name">res.partner.type.form.inherit</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="partner_phone_log.res_partner_phonecall"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='phonecall_ids']/tree" position="inside"> |
|||
<field name="recording_id"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1 @@ |
|||
../../../hr_recruitment_phone_log/ |
@ -0,0 +1,6 @@ |
|||
import setuptools |
|||
|
|||
setuptools.setup( |
|||
setup_requires=['setuptools-odoo'], |
|||
odoo_addon=True, |
|||
) |
@ -0,0 +1 @@ |
|||
../../../logcall/ |
@ -0,0 +1,6 @@ |
|||
import setuptools |
|||
|
|||
setuptools.setup( |
|||
setup_requires=['setuptools-odoo'], |
|||
odoo_addon=True, |
|||
) |
@ -0,0 +1 @@ |
|||
../../../partner_phone_log |
@ -0,0 +1,6 @@ |
|||
import setuptools |
|||
|
|||
setuptools.setup( |
|||
setup_requires=['setuptools-odoo'], |
|||
odoo_addon=True, |
|||
) |
@ -0,0 +1 @@ |
|||
../../../partner_phone_log_logcall/ |
@ -0,0 +1,6 @@ |
|||
import setuptools |
|||
|
|||
setuptools.setup( |
|||
setup_requires=['setuptools-odoo'], |
|||
odoo_addon=True, |
|||
) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue