Search 1.9 billion lines of Odoo code on GitHub

asterisk_dialer

Author: litnimax
License: no license
Branch: master
Repository: brett005/asterisk_dialer
Dependencies: base, mail, and web
Languages: Bourne Shell (62, 2.4%), HTML (21, 0.8%), JavaScript (72, 2.7%), Markdown (143, 5.4%), PO File (652, 24.8%), Python (844, 32.1%), and XML (833, 31.7%)
Other branches: crm_feature_move, and moving_to_crm_try_1
Other repositories: 13927729580/asterisk_dialer, B-Rich/asterisk_dialer, Manexware/asterisk_dialer, OdooBulgaria/asterisk_dialer, SibghatullahSheikh/asterisk_dialer, VbossEkat/asterisk_dialer, alexgeertsen/asterisk_dialer, asteriskauto/asterisk_dialer, avinaszh/asterisk_dialer, ayyoub36/asterisk_dialer, cervajs/asterisk_dialer, cmsdesigner/asterisk_dialer, consultingerp/asterisk_dialer, daemondev/asterisk_dialer, dialpro/asterisk_dialer, eslammohamed13/asterisk_dialer, firatocak/asterisk_dialer, gorocacher/asterisk_dialer, gvsurenderreddy/asterisk_dialer, jason156/asterisk_dialer, kaisatec/asterisk_dialer, leangjia/asterisk_dialer, litnimax/asterisk_dialer, macntouch/asterisk_dialer, mohamedhagag/asterisk_dialer, molandtoxx/asterisk_dialer, rohitramnani1994/asterisk_dialer, sagar123pawar/asterisk_dialer, sc4you/asterisk_dialer, shyjuk/asterisk_dialer, swipswaps/asterisk_dialer, syjet/asterisk_dialer, tespechit/asterisk_dialer, tsabi/asterisk_dialer, tymiles003/asterisk_dialer, umair-gujjar/asterisk_dialer, and ygol/asterisk_dialer

<h1>Odoo Dialer Application</h1> <h2>THIS APPLICATION IS DEPRICATED</h2> <p>Here is the new currenly supported version: https://apps.odoo.com/apps/modules/13.0/asterisk_dialer</p> <h2>Introduction</h2> <p>This application is used to manage telemarketing campaigns e.g. call customers and playback a pre-recorded voice message or connect answered calls to operators. Other use cases are also possible as new features can be easily implemented using custom Asterisk dial plan.</p> <p>This application uses Asterisk RESTful Interface (ARI) and requires <strong>Asterisk v12</strong> and newer. It is implemented inside Odoo using Python threads and does not have separate software components. </p> <p><em>That&#39;s why You have to run Odoo in threaded mode devoted to one database disabling *</em>workers** option and settings <strong>dbfilter</strong> option in Odoo configuration (see example of confoguration file below).*</p> <h2>Software requirements and installation</h2> <p>Requirements:</p> <ul> <li><a href="https://github.com/asterisk/ari-py">ari-py</a> (pip install ari)</li> <li><a href="https://github.com/odoo/odoo/tree/8.0/">Odoo 8.0</a></li> <li>Asterisk v.12/13 with func_curl enabled.</li> </ul> <p>Installation:</p> <ul> <li>Install Odoo 8.0.</li> <li>Download asterisk_dialer from here and put it in your Odoo&#39;s addons folder. Or you can you my <a href="https://github.com/litnimax/odoo-asterisk-dialer/blob/master/install.sh">install.sh</a> script to install Odoo &amp; Asterisk dialer into virtual env in current directory.</li> <li>Install latest Asterisk. Versions &lt; 12 do not have ARI support. </li> <li>Install Asterisk ARI libs (pip install ari).</li> </ul> <h2>Configuration</h2> <h3>Odoo configuration</h3> <p>In Odoo you should set <strong>data_dir</strong> option. It is used as a root folder for storing uploaded voice files. Be sure this folder is accessible for UID which is asterisk running under.</p> <h4>Example configuration file</h4> <p><code> [options] addons_path = /home/max/tmp-work/odoo/odoo/openerp/addons,/home/max/tmp-work/odoo/myaddons,/home/max/tmp-work/odoo/odoo/addons, admin_passwd = admin data_dir = /home/max/tmp-work/odoo/filestore db_host = localhost db_password = openerp db_user = openerp dbfilter = ^odoo_dialer$ debug_mode = False log_level = info logfile = False workers = 0 </code> You can generate default Odoo configuration by running <code>./odoo -s</code>. It will create a default ~/.openerp_serverrc file in home directory.</p> <p><strong>Warning!</strong> Make sure You set up correct <em>dbfilter</em> option and also disabled workers by settings it to zero.</p> <h3>Asterisk settings</h3> <h4>ARI settings</h4> <p>ARI is configured in ari.conf. Example of configuration:</p> <p><code> allowed_origins = * [username] type = user read_only = no password = $6$GPX.W2HVNvy9Bo$EeHySUu89U8.Wg6BvJCWNv51bDhu82t8gNz1u5n83MH1qWK282G2zV4V4neFldBRNb.nVchmRq28EGFTYl4QH. password_format = crypt </code> Password is generated with mkpasswd -m sha-512 or just use password_format = plain at your risk ;-) and put plain password here. </p> <p>Remember it will be transfered over the network in plain text and if Asterisk is in internet using plain is a security hole. </p> <p>Imagine a phone bill for $40,000 for calls to Inmarsat because Asterisk ARI access is sniffed.</p> <h4>Dialplan</h4> <p>Dialer operates using ARI originate method and Local channel. Due to Aterisk limitation to return call status of non-connected calls we have to use Local channel and its context to actually send call to provider and use <code>h</code> exten to update call status. Here is an example of such a dial plan: </p> <p>``` [peer-1] include =&gt; dialer_hangup exten =&gt; _X!,1,Dial(SIP/${EXTEN}@peer-1,60,g)</p> <p>[peer-2] include =&gt; dialer_hangup exten =&gt; _X!,1,Dial(SIP/${EXTEN}@peer-2,60,g)</p> <p>[e1] include =&gt; dialer_hangup exten =&gt; _X!,1,Dial(DAHDI/g0/${EXTEN},60,g)</p> <p>[dialer<em>hangup] exten =&gt; h,1,Set(res=${CURL(http://localhost:8069/dialer/channel</em>update/?channel<em>id=${UNIQUEID}&amp;status=${DIALSTATUS}&amp;answered</em>time=${ANSWEREDTIME})}) ; ;exten =&gt; h,n,Verbose(CALL ID: ${UNIQUEID}, DIAL STATUS: ${DIALSTATUS}, UPDATE RESULT: ${res})</p> <p>```</p> <p>So you must add the above snippet to your extensions.conf. Replace <em>peers</em> with your provider&#39;s peer from sip.conf and <em>localhost:8069</em> with your Odoo instance URL.</p> <p>When creating Call Routing in Odoo Dialer Application name Dial Context exactly like Asterisk context name. </p> <h3>Running Dialer</h3> <p>Dialer operates in 2 modes (dialer type setting):</p> <ul> <li>Asterisk dialplan</li> <li>Odoo Stasis app</li> </ul> <h4>Asterisk Dialplan</h4> <p>When dialer type is set to <em>Playback</em> the Dialer originates calls and puts connected calls in specified Asterisk context name.</p> <p>For example if instead of message playback we need to put every connected call in queue, the following dialplan must be created in extensions.conf:</p> <p><code> [queue] exten =&gt; _X.,1,Queue(test) </code> In Dialer configuration field <em>Context name</em> must be set to <em>queue</em>.</p> <h4>Stasis App</h4> <p>In this mode Dialer plays uploaded sound file to called number.</p> <h2>Number Lists</h2> <p>The Dialer can dial either Contacts (Partners) or custom list of phone numbers. This lists can be imported from .csv files.</p> <h2>Troubleshooting</h2> <p>Enable debug mode. </p> <p>Run Odoo with &#39;&#39;--log-level=debug&#39;&#39; and see errors.</p> <h3>Playback file is not played</h3> <p>Odoo saves sound files in a folder set by data_dir option. Check that Asterisk can read from there.</p> <h3>Asterisk func curl not found</h3> <p><code> [Nov 5 11:13:25] ERROR[18838][C-000005e2]: pbx.c:4291 ast_func_read: Function CURL not registered </code> Install libcurl-devel, re-run ./configure and make menuselect, get sure res<em>curl and func</em>curl are selected and recompile and install these modules.</p> <h3>Channel update script Not Found error</h3> <p>This is how this error looks in Odoo&#39;s log: ``` 2014-12-10 13:49:04,158 12709 INFO None openerp.http: Generating nondb routing 2014-12-10 13:49:04,298 12709 INFO None werkzeug: 127.0.0.1 - - [10/Dec/2014 13:49:04] &quot;GET /dialer/channel<em>update/?channel</em>id=fe405e90-7fa8-11e4-bab0-70f395e579e2-1418132452-2&amp;status=CHANUNAVAIL&amp;answered_time=0 HTTP/1.1&quot; 404 -</p> <p>``` &quot;Nondb routing&quot; means there is either no database or more then one database available for selection. You have to check dbfilter option to be set correctly.</p> <p>And this is how this error looks like in Asterisk console: ``` -- Executing [h@e1:1] Set(&quot;Local/102@e1-00000001;2&quot;, &quot;res=&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 3.2 Final//EN&quot;&gt; -- <title>404 Not Found</title> -- <h1>Not Found</h1> -- <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>&quot;) in new stack -- Executing [h@e1:2] Verbose(&quot;Local/102@e1-00000001;2&quot;, &quot;ID: f0e054c8-8073-11e4-bcc6-70f395e579e2-1418219617-2 DIAL STATUS: CHANUNAVAIL UPDATE RESULT: &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 3.2 Final//EN&quot;&gt; -- <title>404 Not Found</title> -- <h1>Not Found</h1> -- <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>&quot;) in new stack ID: f0e054c8-8073-11e4-bcc6-70f395e579e2-1418219617-2 DIAL STATUS: CHANUNAVAIL UPDATE RESULT: &lt;!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 3.2 Final//EN&gt; <title>404 Not Found</title> <h1>Not Found</h1> <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p></p> <p>```</p> <h3>Asterisk permission issue</h3> <p>If you see something like that: <code> [Nov 23 16:54:57] WARNING[18025]: file.c:758 ast_openstream_full: File /home/openerp/.local/share/Odoo/filestore/odoo_production/sounds/01 does not exist in any format [Nov 23 16:54:57] WARNING[18025]: file.c:1077 ast_streamfile: Unable to open /home/openerp/.local/share/Odoo/filestore/odoo_production/sounds/01 (format (slin)): Permission denied [Nov 23 16:54:57] WARNING[18025]: res_stasis_playback.c:248 playback_final_update: a781d96a-7320-11e4-9f00-040108bd4001-1416754481-1: Playback failed for sound:/home/openerp/.local/share/Odoo/filestore/odoo_production/sounds/01 </code> Make sounds folder accessible for Asterisk.</p> <h3>Outdated python requests lib</h3> <p><code> File &quot;/usr/local/lib/python2.7/dist-packages/swaggerpy/http_client.py&quot;, line 121, in __init__ self.auth = requests.auth.HTTPBasicAuth(username, password) AttributeError: &#39;module&#39; object has no attribute &#39;HTTPBasicAuth&#39; </code> python-requests package may be outdated. You may need to uninstall it and install a fresh one from python package repo (pip install requests --update).</p> <h2>Feature requests</h2> <p>The following features could be implemented if requested:</p> <ul> <li>Allow dialed person to press a key to confirm (aknowledge) the message</li> <li>Allow dialed person to be deleted from dialing list so that he will not be dialed on next round (like unsubscribe from list).</li> <li>Record dialed person choice in menu.</li> <li>Other.</li> </ul> <p>To create a feature request <a href="https://github.com/litnimax/asterisk_dialer/issues/new">create</a> a Github issue with label <em>enhancement</em>.</p>