You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.8 KiB

  1. # -*- coding: utf-8 -*-
  2. # (c) 2016 credativ Ltd (<http://credativ.co.uk>).
  3. # (c) 2016 Trever L. Adams
  4. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
  5. from openerp import models, fields, api
  6. import logging
  7. logger = logging.getLogger(__name__)
  8. class FreeSWITCHServer(models.Model):
  9. _inherit = "freeswitch.server"
  10. ucp_url = fields.Char(
  11. string='Script to download FreeSWITCH recordings', required=False,
  12. default="https://localhost/cgi-bin/get_recording.pl?"
  13. "file={odoo_filename}",
  14. help="Macros allowed: {odoo_type} (inbound, outbound), {odoo_src}"
  15. "(source phone number}, {odoo_dst} (destination number), "
  16. "{odoo_duration} (length of call), {odoo_start} (start time of call "
  17. "in seconds since epoch), {odoo_filename} (file name on server), "
  18. "{odoo_uniqueid} (FreeSWITCH UUID of call).")
  19. server_jitter_correction = fields.Integer(
  20. string='Time jitter compensation', required=True,
  21. help='Number of seconds to subtract from new call start and add to '
  22. 'new call end, for call merging, to compensate for system/database '
  23. 'load and time drift between FreeSWITCH server and Odoo/Odoo database '
  24. 'server(s). 5 seconds is likely a good start. Above 10 seconds you '
  25. 'get into the realm where you may have distinct calls confused. 20 - '
  26. '30 seconds begins to guarantee this. It is best to keep this low '
  27. 'and use a method to keep time synced.',
  28. default=5)
  29. class PhoneCommon(models.AbstractModel):
  30. _inherit = 'phone.common'
  31. @api.model
  32. def _get_ucp_url(self, user):
  33. fs_server = user.freeswitch_server_id
  34. return fs_server.ucp_url
  35. @api.model
  36. def _get_jitter(self, user):
  37. fs_server = user.freeswitch_server_id
  38. return fs_server.server_jitter_correction