-
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
================= | ||
Voicent Connector | ||
================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fconnector--telephony-lightgray.png?logo=github | ||
:target: https://github.com/OCA/connector-telephony/tree/12.0/connector_voicent | ||
:alt: OCA/connector-telephony | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/connector-telephony-12-0/connector-telephony-12-0-connector_voicent | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/228/12.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows you to connect Odoo with Voicent <https://www.voicent.com> and is meant to be extended to integrate Odoo records and processes with phone calls made by Voicent. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Go to Connectors > Backends > Voicent Backends | ||
#. Create a new Voicent Backend with the host and port | ||
#. Create Call Lines to determine when (which stage in the process) calls are added to the queue | ||
#. Create Time Line to determine when (what time) calls are made | ||
|
||
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 <https://github.com/OCA/connector-telephony/issues/new?body=module:%20connector_voicent%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Open Source Integrators | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com> | ||
* Youness MAAFI <youness.maafi@gmail.com> | ||
* Murtuza Saleh <murtuza.saleh@serpentcs.com> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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. | ||
|
||
.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px | ||
:target: https://github.com/max3903 | ||
:alt: max3903 | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-max3903| | ||
|
||
This module is part of the `OCA/connector-telephony <https://github.com/OCA/connector-telephony/tree/12.0/connector_voicent>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (C) 2019 Open Source Integrators | ||
# <https://www.opensourceintegrators.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'Voicent Connector', | ||
'version': '12.0.1.0.0', | ||
'category': 'Connector', | ||
'license': 'AGPL-3', | ||
'summary': """This module allows you to connect Odoo with Voicent | ||
(https://www.voicent.com) and is meant to be extended to integrate | ||
Odoo records and processes with phone calls made by Voicent.""", | ||
"author": "Open Source Integrators, " | ||
"Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/connector-telephony", | ||
'depends': [ | ||
'connector', | ||
], | ||
'data': [ | ||
'security/ir.model.access.csv', | ||
'data/check_the_voicent_status.xml', | ||
'view/res_partner.xml', | ||
'view/backend_voicent.xml', | ||
'view/queue_job_view.xml', | ||
], | ||
'installable': True, | ||
'maintainers': [ | ||
'max3903', | ||
], | ||
'development_status': 'Beta', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="fetch_check_the_voicent_status" model="ir.cron"> | ||
<field name="name">Fetch check the Voicent status</field> | ||
<field name="model_id" ref="model_backend_voicent"/> | ||
<field eval="True" name="active"/> | ||
<field name="user_id" ref="base.user_root"/> | ||
<field name="interval_number">15</field> | ||
<field name="interval_type">minutes</field> | ||
<field name="numbercall">-1</field> | ||
<field eval="False" name="doall"/> | ||
<field name="state">code</field> | ||
<field name="code">model._run_check_the_voicent_status()</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (C) 2019 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
||
# Simple message | ||
import voicent | ||
|
||
|
||
v = voicent.Voicent() | ||
phoneno = "6024275632" | ||
reqid = v.callText(phoneno, "Hello, This is a test of the autodialer.", "1") | ||
status = v.callStatus(reqid) | ||
|
||
# Using Campaign in 2 steps | ||
v = voicent.Voicent() | ||
filepath = "/home/mchambreuil/odoo/pvm/voicent.csv" | ||
listname = "Test" | ||
leadsrc_id = v.importCampaign(listname, filepath) | ||
res = v.runCampaign(listname) | ||
v.checkStatus(res['leadsrc_id']) | ||
|
||
# Using Campaign in 1 step with TTS | ||
v = voicent.Voicent() | ||
filepath = "/home/mchambreuil/odoo/pvm/voicent.csv" | ||
res = v.importAndRunCampaign(filepath, "tts", "Hello, This is a test. Bye") | ||
status = v.checkStatus(res['camp_id']) | ||
|
||
# Using Campaign in 1 step with Template | ||
v = voicent.Voicent() | ||
filepath = "/home/mchambreuil/odoo/pvm/voicent.csv" | ||
res = v.importAndRunCampaign(filepath, "template", "Test") | ||
status = v.checkStatus(res['camp_id']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Name,Phone | ||
Maxime Chambreuil,6024275632 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
# Copyright (C) 2018 Voicent | ||
# Copyright (C) 2019 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
# | ||
# Documentation available at https://voicent.com/developer/docs/camp-api/ | ||
|
||
import ntpath | ||
import requests | ||
import ast | ||
|
||
|
||
class Voicent(): | ||
|
||
def __init__(self, host="localhost", port="8155"): | ||
self.host_ = host | ||
self.port_ = port | ||
|
||
def postToGateway(self, urlstr, params, files=None): | ||
url = "http://" + self.host_ + ":" + self.port_ + urlstr | ||
res = requests.post(url, params, files=files) | ||
return res.text | ||
|
||
def getReqId(self, rcstr): | ||
index1 = rcstr.find("[ReqId=") | ||
if (index1 == -1): | ||
return "" | ||
index1 += 7 | ||
index2 = rcstr.find("]", index1) | ||
if (index2 == -1): | ||
return "" | ||
return rcstr[index1:index2] | ||
|
||
def callText(self, phoneno, text, selfdelete): | ||
urlstr = "/ocall/callreqHandler.jsp" | ||
params = { | ||
'info': 'simple text call', | ||
'phoneno': phoneno, | ||
'firstocc': 10, | ||
'txt': text, | ||
'selfdelete': selfdelete | ||
} | ||
res = self.postToGateway(urlstr, params) | ||
return self.getReqId(res) | ||
|
||
def callAudio(self, phoneno, filename, selfdelete): | ||
urlstr = "/ocall/callreqHandler.jsp" | ||
params = { | ||
'info': 'simple audio call', | ||
'phoneno': phoneno, | ||
'firstocc': 10, | ||
'audiofile': filename, | ||
'selfdelete': selfdelete | ||
} | ||
res = self.postToGateway(urlstr, params) | ||
return self.getReqId(res) | ||
|
||
def callIvr(self, phoneno, appname, selfdelete): | ||
urlstr = "/ocall/callreqHandler.jsp" | ||
params = { | ||
'info': 'simple text call', | ||
'phoneno': phoneno, | ||
'firstocc': 10, | ||
'startapp': appname, | ||
'selfdelete': selfdelete | ||
} | ||
res = self.postToGateway(urlstr, params) | ||
return self.getReqId(res) | ||
|
||
def callStatus(self, reqid): | ||
urlstr = "/ocall/callstatusHandler.jsp" | ||
params = {'reqid': reqid} | ||
res = self.postToGateway(urlstr, params) | ||
return self.getReqId(res) | ||
|
||
def callRemove(self, reqId): | ||
urlstr = "/ocall/callremoveHandler.jsp" | ||
params = {'reqid': reqId} | ||
res = self.postToGateway(urlstr, params) | ||
return self.getReqId(res) | ||
|
||
def callTillConfirm(self, vcastexe, vocfile, wavfile, ccode): | ||
urlstr = "/ocall/callreqHandler.jsp" | ||
cmdline = "\"" | ||
cmdline += vocfile | ||
cmdline += "\"" | ||
cmdline += " -startnow" | ||
cmdline += " -confirmcode " | ||
cmdline += ccode | ||
cmdline += " -wavfile " | ||
cmdline += "\"" | ||
cmdline += wavfile | ||
cmdline += "\"" | ||
|
||
params = { | ||
'info': 'Simple Call till Confirm', | ||
'phoneno': '1111111', | ||
'firstocc': 10, | ||
'selfdelete': 0, | ||
'startexec': vcastexe, | ||
'cmdline': cmdline | ||
} | ||
res = self.postToGateway(urlstr, params) | ||
return self.getReqId(res) | ||
|
||
################ | ||
# CAMPAIGN API # | ||
################ | ||
|
||
def importCampaign(self, listname, filepath): | ||
urlstr = "/ocall/campapi" | ||
params = { | ||
'action': 'import', | ||
'importfile': ntpath.basename(filepath), | ||
'importfilepath': filepath, | ||
'profile': 'Test', | ||
'mod': 'cus', | ||
'fieldsep': ',', | ||
'row1': 1, | ||
'mergeopt': 'empty', | ||
'leadsrcname': listname | ||
} | ||
files = { | ||
'file': (ntpath.basename(filepath), open(filepath, 'rb')) | ||
} | ||
res = self.postToGateway(urlstr, params, files) | ||
return ast.literal_eval(res) | ||
|
||
def runCampaign(self, listname): | ||
urlstr = "/ocall/campapi" | ||
params = { | ||
'action': 'bbp', | ||
'CAMP_NAME': 'Test', | ||
'listname': listname, | ||
'phonecols': 'Phone', | ||
'lines': '4', | ||
'calldisps': '', | ||
'callerid': '+18884728568', | ||
} | ||
res = self.postToGateway(urlstr, params) | ||
return ast.literal_eval(res) | ||
|
||
def importAndRunCampaign(self, filepath, msgtype, msginfo): | ||
urlstr = "/ocall/campapi" | ||
params = { | ||
'action': 'bbp', | ||
# Parameters for importing the campaign | ||
'importfile': ntpath.basename(filepath), | ||
'importfilepath': filepath, | ||
# 'profile': 'Test', | ||
'mod': 'cus', | ||
'row1': 1, | ||
'leadsrcname': 'Test', | ||
# Parameters for running the campaign | ||
'CAMP_NAME': 'Test', | ||
'phonecols': 'Phone', | ||
'lines': '4', | ||
'calldisps': '', | ||
'callerid': '+18884728568', | ||
# Parameters for Autodialer | ||
'msgtype': msgtype, | ||
'msginfo': msginfo, | ||
} | ||
files = { | ||
'file': (ntpath.basename(filepath), open(filepath, 'rb')) | ||
} | ||
res = self.postToGateway(urlstr, params, files) | ||
return ast.literal_eval(res) | ||
|
||
def checkStatus(self, leadsrc_id): | ||
urlstr = "/ocall/campapi" | ||
params = { | ||
'action': 'campstats', | ||
'leadsrc_id': leadsrc_id | ||
} | ||
res = self.postToGateway(urlstr, params) | ||
return ast.literal_eval(res) | ||
|
||
def exportResult(self, camp_id, filename, extracols): | ||
urlstr = "/ocall/campapi" | ||
params = { | ||
'action': 'exportcamp', | ||
'camp_id_id': camp_id, | ||
'f': filename, | ||
'extracols': extracols | ||
} | ||
res = self.postToGateway(urlstr, params) | ||
return ast.literal_eval(res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import res_partner | ||
from . import backend_voicent | ||
from . import queue_job |
Oops, something went wrong.