Skip to content

Commit

Permalink
Merge e889721 into 1e7b01f
Browse files Browse the repository at this point in the history
  • Loading branch information
treveradams committed Jul 27, 2016
2 parents 1e7b01f + e889721 commit 1d3de57
Show file tree
Hide file tree
Showing 39 changed files with 4,791 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly
- pip install phonenumbers py-Asterisk SOAPpy
- pip install phonenumbers py-Asterisk SOAPpy FreeSWITCH-ESL-Python
- hg clone http://bitbucket.org/anybox/web_action_request -b ${VERSION} ${HOME}/web_action_request
- if [ -d /home/travis/${ODOO_REPO##*/}-${VERSION}/addons ]; then ln -s ${HOME}/web_action_request/web_action_request /home/travis/${ODOO_REPO##*/}-${VERSION}/addons; fi
- hg clone http://bitbucket.org/anybox/bus_enhanced ${HOME}/bus_enhanced
- if [ -d /home/travis/${ODOO_REPO##*/}-${VERSION}/addons ]; then ln -s ${HOME}/bus_enhanced/bus_enhanced /home/travis/${ODOO_REPO##*/}-${VERSION}/addons; fi

script:
- travis_run_tests
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

# Odoo telephony connector

This projets aims at connecting Odoo to different phone systems. Phone systems currently supported are Asterisk (an OpenSource IPBX, cf [asterisk.org](http://www.asterisk.org/) and OVH (the centrex offer of OVH, cf the [OVH website](http://www.ovhtelecom.fr/telephonie/)).
This projets aims at connecting Odoo to different phone systems. Phone systems currently supported are Asterisk (an OpenSource IPBX, cf [asterisk.org](http://www.asterisk.org/), OVH (the centrex offer of OVH, cf the [OVH website](http://www.ovhtelecom.fr/telephonie/)) and FreeSWITCH (cross-platform multi-protocol soft switch, cf [FreeSWITCH.org](http://freeswitch.org)).

This project provides:
* a serie of modules (base\_phone, base\_phone\_popup,
crm\_phone, hr\_phone, event\_phone, etc...) that are independant from
the phone system and can be usefull on all Odoo installations.
* several modules (asterisk\_click2dial, ovh\_telephony\_connector)
* several modules (asterisk\_click2dial, ovh\_telephony\_connector, freeswitch\_click2dial)
that are specific to a particular phone system.

The main maintainer of this project is Alexis de Lattre from
Expand All @@ -31,6 +31,7 @@ addon | version | summary
[crm_claim_phone](crm_claim_phone/) | 8.0.0.1.0 | Validate phone numbers in CRM Claims
[crm_phone](crm_phone/) | 8.0.0.1.0 | Validate phone numbers in CRM
[event_phone](event_phone/) | 8.0.0.1.0 | Validate phone numbers in Events
[freeswitch_click2dial](freeswitch_click2dial/) | 8.0.0.4.0 | FreeSWITCH-Odoo telephony connector (click2dial)
[hr_phone](hr_phone/) | 8.0.0.1.0 | Validate phone numbers in HR
[hr_recruitment_phone](hr_recruitment_phone/) | 8.0.0.1.0 | Validate phone numbers in HR Recruitment
[ovh_telephony_connector](ovh_telephony_connector/) | 8.0.0.1.0 | OVH-Odoo telephony connector (click2call)
Expand Down
2 changes: 1 addition & 1 deletion asterisk_click2dial/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Asterisk Click2dial module for OpenERP
Expand Down
2 changes: 1 addition & 1 deletion asterisk_click2dial/asterisk_click2dial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Asterisk Click2dial module for OpenERP
Expand Down
2 changes: 1 addition & 1 deletion asterisk_click2dial/controller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Asterisk click2dial module for OpenERP
Expand Down
2 changes: 1 addition & 1 deletion base_phone/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Base Phone module for OpenERP
Expand Down
25 changes: 25 additions & 0 deletions base_phone_popup/popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,31 @@ def incall_notify_by_login(
callerid = False
return callerid

def incall_notify_by_extension(
self, cr, uid, number, extension_list, context=None):
assert isinstance(extension_list, list), 'extension_list must be a list'
res = self.get_record_from_phone_number(
cr, uid, number, context=context)
user_ids = self.pool['res.users'].search(
cr, uid, [('internal_number', 'in', extension_list)], context=context)
logger.debug(
'Notify incoming call from number %s to users %s'
% (number, user_ids))
action = self._prepare_incall_pop_action(
cr, uid, res, number, context=context)
if action:
users = self.pool['res.users'].read(
cr, uid, user_ids, ['context_incall_popup'], context=context)
for user in users:
if user['context_incall_popup']:
self.pool['action.request'].notify(
cr, user['id'], action)
if res:
callerid = res[2]
else:
callerid = False
return callerid


class res_users(orm.Model):
_inherit = 'res.users'
Expand Down
138 changes: 138 additions & 0 deletions freeswitch_click2dial/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
.. 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

=====================
FreeSWITCH Click2Dial
=====================

The technical name of this module is *freeswitch_click2dial*, but this module
implements much more than a simple *click2dial* ! This module adds 3
functionalities:

1) It adds a *Dial* button in the partner form view so that users can directly
dial a phone number through FreeSWITCH. 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 view.

* OpenERP connects to the FreeSWITCH Event Socket and FreeSWITCH makes the
user's phone ring.

* The user answers his own phone (if he doesn't, the process stops here).

* FreeSWITCH dials the phone number found in OpenERP in place of the user.

* If the remote party answers, the user can talk to his correspondent.

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/leads/employees/... of OpenERP. To understand how to
use this, please see get_caller_name.py, which should be installed per the
instructions in the script on the OpenERP/Odoo server. This works for
incoming and outgoing calls, per instructions in the script.

3) It adds a phone icon (*Open Caller*) in the top menu bar
(next to the Preferences) to get the partner/lead/candidate/registrations
corresponding to the calling party in one click. Here is how it works :

* When the user clicks on the phone icon, OpenERP sends a query to the
FreeSWITCH 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
Partners/Leads/Candidates/Registrations of OpenERP. If a record matches,
it takes you to the form view of this record. If no record matchs, it
opens a wizard which proposes to create a new Partner with the presented
phone number as *Phone* or *Mobile* number or update an existing Partner.

It is possible to get a pop-up of the record corresponding to the calling
party without any action from the user via the module *base_phone_popup*.

Installation
============

To install this module, you need to:

* Click on the module and install it

Additionally, you will need the FreeSWITCH ESL python module. The easiest way is
pip install FreeSWITCH-ESL-Python. Otherwise, you will find it under
${FREESWITCH_SRC_TOP_DIR}/libs/esl/python. Go to
${FREESWITCH_SRC_TOP_DIR}/libs/esl. Type make. Then make pymod. You will then
need to install ${FREESWITCH_SRC_TOP_DIR}/libs/esl/python/ESL.py and
${FREESWITCH_SRC_TOP_DIR}/libs/esl/python/_ESL.so into the appropriate places
on your OpenERP/Odoo server.
(https://wiki.freeswitch.org/wiki/Event_Socket_Library#Installation for more
information.) An alternative method would involve
https://github.com/gurteshwar/freeswitch-esl-python.

Configuration
=============

To configure this module, you need to:

* Settings > Technical > FreeSWITCH Servers
* Setup you server
* Configure users under Settings > Users > $USER > Telphony tab

Usage
=====

To use this module, you need to:

* See scripts/get_caller_name.py to see how to set caller and callee name

* Click on Dial next to any phone number covered by associated modules

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch}

.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example
Known issues / Roadmap
======================

* None

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/
{project_repo}/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/
{project_repo}/issues/new?body=module:%20
{module_name}%0Aversion:%20
{version}%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.


Credits
=======

Contributors
------------

* Firstname Lastname <email.address@example.org>
* Second Person <second.person@example.org>

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 http://odoo-community.org.

23 changes: 23 additions & 0 deletions freeswitch_click2dial/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# FreeSWITCH Click2Dial module for OpenERP
# Copyright (C) 2010-2013 Alexis de Lattre <alexis@via.ecp.fr>
#
# 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 . import freeswitch_click2dial
from . import controller
44 changes: 44 additions & 0 deletions freeswitch_click2dial/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# FreeSWITCH Click2dial module for OpenERP
# Copyright (C) 2010-2014 Alexis de Lattre <alexis@via.ecp.fr>
#
# 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 Click2dial',
'version': '8.0.0.4.0',
'category': 'Phone',
'license': 'AGPL-3',
'summary': 'FreeSWITCH-OpenERP connector',
'author': "Trever L. Adams,Akretion,Odoo Community Association (OCA)",
'website': 'https://github.com/treveradams/connector-telephony',
'depends': ['base_phone'],
'external_dependencies': {'python': ['freeswitchESL']},
'data': [
'freeswitch_server_view.xml',
'res_users_view.xml',
'security/ir.model.access.csv',
'web_freeswitch_click2dial.xml',
],
'demo': ['freeswitch_click2dial_demo.xml'],
'qweb': ['static/src/xml/*.xml'],
'css': ['static/src/css/*.css'],
'application': True,
'installable': True,
}
31 changes: 31 additions & 0 deletions freeswitch_click2dial/controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# FreeSWITCH click2dial module for OpenERP
# Copyright (C) 2014 Alexis de Lattre (alexis@via.ecp.fr)
#
# 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/>.
#
##############################################################################

import openerp


class FreeSWITCHClick2dialController(openerp.addons.web.http.Controller):
_cp_path = '/freeswitch_click2dial'

@openerp.addons.web.http.jsonrequest
def get_record_from_my_channel(self, req):
res = req.session.model('freeswitch.server').get_record_from_my_channel()
return res
Loading

0 comments on commit 1d3de57

Please sign in to comment.