Skip to content
blak3r edited this page Apr 4, 2012 · 27 revisions

There are a lot of things that could be done to improve this project. Any help would be greatly appreciated. This page is currently a stub. Refer to the TODO.txt in the Code root directory for now.

Table of Contents

Features

  • Multiple Matching Contact Handling, provide user with option to pick who it is? At the very least need to fix outbound calling
  - Todo this, we need to add a new action to controller.php and add a new column to asteriskLog.  The action=setContactId will pass a contact id which will then get written to the asteriskLog db table.  Then, in asteriskLogger we check if the contactId is already set before trying to make the relation.
  • Need to do custom code for Contacts Subpanels.. (doesn't show magic call icon there).
  • Update language files for german and whatever the other language is.

Minor Bugs

  • $sugar_config['asterisk_dialin_ext_match'] = 'Local\/(?:.*?)(\d\d\d?\d?\d?)@'; -- Make this take 3-11 digits. If longer then say 5 characters we need to implement a method to look at users's mobile phones.
  • See issues for bug on RingGroups

Potential Enhancements

  • Better handling for answering on mobile phone. (currently a chat box still appears).
  • Would be cool if we displayed voicemail inside sugar. From what i've read this sounds doable given the options in AMI.
  • Ability to record the call... It's unclear whether or not this can be done without complicated AGI scripts or not?
  • Have Button to create a new contact when number isn't recognized... (Add to contact--> create new or add to existing)

Performance Improvements

I'm not aware of any performance issues with using this plugin. That being said... I'm sure there are some optimizations that could be made. This section outlines what we should focus on.

The CallListener.php class is called by every active browser tab that each user has open about every 5 seconds (this is for the call popups). Therefore, this is where any optimization efforts should take place.

  1. Optimize the query that executes against the asterisk_log table. It selects any recent calls that have occurred in the last hour which haven't been closed by the user. I have very little experience with optimizing database queries.
    1. Perhaps indexing the timestampCall column would improve performance?
    2. Alternatively, perhaps we should move older calls to an archive table periodically to improve table scanning.
Other Improvements:
  1. When there are active calls, CallListener looks up the contact in the database by phone number each time. We should stop doing this each time by persisting the contact to the asterisk log table once it's been determined. I plan on tackling this when I add multiple matching contact support.
Originally, this plugin continued to make AJAX calls even after the user session died (like when you login on a different computer)... I changed the code to only schedule subsequent ajax calls when the previous call returns successful. This will work from a performance standpoint but if there is ever a case where a single request fails for a legit reason... the call popup will not appear until user refreshes their page. I think this is an acceptable tradeoff. I'm just documenting it here in case the call popups seem to be sporatically failing.

Configuration Changes Needed

  • Need configurable Channel detection in order to assign calls to users when they answer on cell phones.
  • Add a configurable option
  • (DONE) Need to add dialin prefix (its in sugarListener)
  • (DONE) Need to make config option for the dialout. Currently hardcoded to /SIP (in my case i need to do the Local/##@sugarsip/n... see CreateCall... for some reason I don't need it in callListener (presumably b/c it's already SIP at that point).
  • (DONE) Parametize the channel --> assigned user id detection, search for Local/LC-52@from-internal-4bbbb in asteriskLogger.
  • (DONE) Add max subject length to controller.php (also variables for IBC, OBC);

MISC

  • Verify Asterisk Logger fix to relogin to AMI works if asterisk goes down.
  • (DONE) Currently language is hardcoded in sugarListener.php
  • (DONE) AsteriskLogger -> findUser method --> add to query something to detect that user is "Active" so you don't get past employees matchin.
  • (Performance) -- Reduce querying in callListener... Perhaps set Contact only in asteriskLogger? -- You'd loose it getting updated if person adds afterwards.
  • (Performance) -- Index the timestampCall column?
  • (Performance) -- Perhaps create a asterisk_log_archive table and copy entries to it after 1 week to cut down on records that have to be scanned.
  • (Performance) -- Ajax calls to callLister continue even after user's session ends (like when you login from a diff browser). Need to somehow stop that.
  • Process the AMI response in CallCreate / controller and display errors when they fail in javascript.
  • If the database cannot be accessed, this is the error message you get
! FATAL: Cannot find login credentials for user admin which is a bit misleading... as it makes you think soap is the problem

INSTALLER

  • (DONE) The previous versions added some custom code around every phone number.











JQUERY Loading on Page Problem Notes

In my production system, I have 6.4.1. I have an extension which uses JQUERY already (1.4 something)... Here's my results:

If I force include: echo '<script type="text/javascript" src="custom/include/javascript/jquery/jquery.pack.js"></script>'; Asterisk Plugin works fine... But, Dispage Fails.

If I conditionally include JS, works in Firefox... and it chrome...


On my demo 6.4 instance (I don't have any other extensions so jquery isn't loaded).
  • Include local copy of jquery works.
  • Conditional Include results in: Uncaught ReferenceError: $ is not defined
... I guess my conditional include isn't being loaded before the code reaches dialin.js and dialout.js.

My conditional code is inserting it after the head... but the code isn't at the head. So, I think I might have to surround my code with some YUI.

YAHOO.util.Event.onDomReady YAHOO.util.Event.onContentReady Uncaught ReferenceError: jQuery is not defined

Ugh... So, I need some YUI or standard javascript way to invoke some code which requires JQuery to be loaded...