yaai
yaai copied to clipboard
Popup Not Working / Call not recorded in Sugar
First, very impressive module / documentation / support.
Due to the above, in only a few hours my first attempt to link a sugar to a dialer, I've gotten to the point where:
I can establish a call with "click to dial", my voip software pops up and connects the call.
However, there is no popup in sugar. call and astreisk_log records appear to be created properly, but when I end the call the records are deleted.
My suspicion is that it's either related to the lack of popup, or it thinks its an internal call... Any thoughts?
BTW - Sugar 6.4.5 (upgraded for this module from 6.3.1)
Log from asteriskLogger:
2012-08-15 21:45:42 ! Successful SOAP login id=1scq1t4qq4ofd5n31o76b44300 user=asterix GUID=1e87d528-7473-101d-720a-502aad8dbd7d 2012-08-15 21:45:42 # Successfully opened socket connection to 192.168.xx.xx:5038 2012-08-15 21:45:42 ! AMI Login action returned with rc=Asterisk Call Manager/1.0
2012-08-15 21:45:42 [2012-08-15 21:45:42]
2012-08-15 21:45:42 ! --- Event -----------------------------------------------------------
2012-08-15 21:45:42 ! Event -->
2012-08-15 21:45:42 ! ---------------------------------------------------------------------
2012-08-15 21:45:50 [2012-08-15 21:45:50]
2012-08-15 21:45:50 ! --- Event -----------------------------------------------------------
2012-08-15 21:45:50 ! Event --> Newcallerid
2012-08-15 21:45:50 ! Privilege --> call,all
2012-08-15 21:45:50 ! Channel --> SIP/9902-09203bc0
2012-08-15 21:45:50 ! CallerID --> 9902
2012-08-15 21:45:50 ! CallerIDName --> <Unknown>
2012-08-15 21:45:50 ! Uniqueid --> 1345059385.30
2012-08-15 21:45:50 ! CID-CallingPres --> 0 (Presentation Allowed, Not Screened)
2012-08-15 21:45:50 ! ---------------------------------------------------------------------
2012-08-15 21:45:50 [2012-08-15 21:45:50]
2012-08-15 21:45:50 ! --- Event -----------------------------------------------------------
2012-08-15 21:45:50 ! Event --> Newcallerid
2012-08-15 21:45:50 ! Privilege --> call,all
2012-08-15 21:45:50 ! Channel --> SIP/9902-09203bc0
2012-08-15 21:45:50 ! CallerID --> 9902
2012-08-15 21:45:50 ! CallerIDName --> <Unknown>
2012-08-15 21:45:50 ! Uniqueid --> 1345059385.30
2012-08-15 21:45:50 ! CID-CallingPres --> 0 (Presentation Allowed, Not Screened)
2012-08-15 21:45:50 ! ---------------------------------------------------------------------
2012-08-15 21:45:53 [2012-08-15 21:45:53]
2012-08-15 21:45:53 ! --- Event -----------------------------------------------------------
2012-08-15 21:45:53 ! Event --> Newcallerid
2012-08-15 21:45:53 ! Privilege --> call,all
2012-08-15 21:45:53 ! Channel --> SIP/9902-09203bc0
2012-08-15 21:45:53 ! CallerID --> 9902
2012-08-15 21:45:53 ! CallerIDName --> David Test
2012-08-15 21:45:53 ! Uniqueid --> 1345059385.30
2012-08-15 21:45:53 ! CID-CallingPres --> 0 (Presentation Allowed, Not Screened)
2012-08-15 21:45:53 ! ---------------------------------------------------------------------
2012-08-15 21:45:53 [2012-08-15 21:45:53]
2012-08-15 21:45:53 ! --- Event -----------------------------------------------------------
2012-08-15 21:45:53 ! Event --> Newcallerid
2012-08-15 21:45:53 ! Privilege --> call,all
2012-08-15 21:45:53 ! Channel --> SIP/9902-09203bc0
2012-08-15 21:45:53 ! CallerID --> 9902
2012-08-15 21:45:53 ! CallerIDName --> David Test
2012-08-15 21:45:53 ! Uniqueid --> 1345059385.30
2012-08-15 21:45:53 ! CID-CallingPres --> 0 (Presentation Allowed, Not Screened)
2012-08-15 21:45:53 ! ---------------------------------------------------------------------
2012-08-15 21:45:53 [2012-08-15 21:45:53]
2012-08-15 21:45:53 ! --- Event -----------------------------------------------------------
2012-08-15 21:45:53 ! Event --> Newcallerid
2012-08-15 21:45:53 ! Privilege --> call,all
2012-08-15 21:45:53 ! Channel --> SIP/9902-09203bc0
2012-08-15 21:45:53 ! CallerID --> 9902
2012-08-15 21:45:53 ! CallerIDName --> David Test
2012-08-15 21:45:53 ! Uniqueid --> 1345059385.30
2012-08-15 21:45:53 ! CID-CallingPres --> 0 (Presentation Allowed, Not Screened)
2012-08-15 21:45:53 ! ---------------------------------------------------------------------
2012-08-15 21:45:53 [2012-08-15 21:45:53]
2012-08-15 21:45:53 ! --- Event -----------------------------------------------------------
2012-08-15 21:45:53 ! Event --> Dial
2012-08-15 21:45:53 ! Privilege --> call,all
2012-08-15 21:45:53 ! Source --> SIP/9902-09203bc0
2012-08-15 21:45:53 ! Destination --> SIP/SIP-UA-0920e768
2012-08-15 21:45:53 ! CallerID --> 9902
2012-08-15 21:45:53 ! CallerIDName --> David Test
2012-08-15 21:45:53 ! SrcUniqueID --> 1345059385.30
2012-08-15 21:45:53 ! DestUniqueID --> 1345059388.31
2012-08-15 21:45:53 ! ---------------------------------------------------------------------
2012-08-15 21:45:53 ! Dial Event src= dest=SIP/SIP-UA-0920e768
Array
(
[id] => 44e807fb-fe1c-6bb0-80c1-502bfc1a002b
[error] => Array
(
[number] => 0
[name] => No Error
[description] => No Error
)
)
2012-08-15 21:45:54 ! Successfully created CALL record with id=44e807fb-fe1c-6bb0-80c1-502bfc1a002b
2012-08-15 21:45:54 * Stripping callin prefix:
2012-08-15 21:45:54 * CallerID is:
2012-08-15 21:45:54 Inbound state detected... /^(sip/[1-9][0-9][0-9]?[0-9]?-|Local)/i is astMatchInternal eChannel= eDestination=SIP/SIP-UA-0920e768
2012-08-15 21:45:54 [2012-08-15 21:45:54]
2012-08-15 21:45:54 ! --- Event -----------------------------------------------------------
2012-08-15 21:45:54 ! Event --> Newcallerid
2012-08-15 21:45:54 ! Privilege --> call,all
2012-08-15 21:45:54 ! Channel --> SIP/SIP-UA-0920e768
2012-08-15 21:45:54 ! CallerID --> 2157406743
2012-08-15 21:45:54 ! CallerIDName --> <Unknown>
2012-08-15 21:45:54 ! Uniqueid --> 1345059388.31
2012-08-15 21:45:54 ! CID-CallingPres --> 0 (Presentation Allowed, Not Screened)
2012-08-15 21:45:54 ! ---------------------------------------------------------------------
2012-08-15 21:46:06 [2012-08-15 21:46:06]
2012-08-15 21:46:06 ! --- Event -----------------------------------------------------------
2012-08-15 21:46:06 ! Event --> Link
2012-08-15 21:46:06 ! Privilege --> call,all
2012-08-15 21:46:06 ! Channel1 --> SIP/9902-09203bc0
2012-08-15 21:46:06 ! Channel2 --> SIP/SIP-UA-0920e768
2012-08-15 21:46:06 ! Uniqueid1 --> 1345059385.30
2012-08-15 21:46:06 ! Uniqueid2 --> 1345059388.31
2012-08-15 21:46:06 ! CallerID1 --> 9902
2012-08-15 21:46:06 ! CallerID2 --> xxxxxx6743
2012-08-15 21:46:06 ! ---------------------------------------------------------------------
2012-08-15 21:46:14 [2012-08-15 21:46:14]
2012-08-15 21:46:14 ! --- Event -----------------------------------------------------------
2012-08-15 21:46:14 ! Event --> Unlink
2012-08-15 21:46:14 ! Privilege --> call,all
2012-08-15 21:46:14 ! Channel1 --> SIP/9902-09203bc0
2012-08-15 21:46:14 ! Channel2 --> SIP/SIP-UA-0920e768
2012-08-15 21:46:14 ! Uniqueid1 --> 1345059385.30
2012-08-15 21:46:14 ! Uniqueid2 --> 1345059388.31
2012-08-15 21:46:14 ! CallerID1 --> 9902
2012-08-15 21:46:14 ! CallerID2 --> 2157406743
2012-08-15 21:46:14 ! ---------------------------------------------------------------------
2012-08-15 21:46:14 [2012-08-15 21:46:14]
2012-08-15 21:46:14 ! --- Event -----------------------------------------------------------
2012-08-15 21:46:14 ! Event --> Hangup
2012-08-15 21:46:14 ! Privilege --> call,all
2012-08-15 21:46:14 ! Channel --> SIP/SIP-UA-0920e768
2012-08-15 21:46:14 ! Uniqueid --> 1345059388.31
2012-08-15 21:46:14 ! Cause --> 16
2012-08-15 21:46:14 ! Cause-txt --> Normal Clearing
2012-08-15 21:46:14 ! ---------------------------------------------------------------------
2012-08-15 21:46:14 # +++ findCallByAsteriskDestId(1345059388.31)
2012-08-15 21:46:14 ! FindCallByAsteriskDestId - Found entry in asterisk_log recordId=44e807fb-fe1c-6bb0-80c1-502bfc1a002b
2012-08-15 21:46:14 Looking for user extension number in: SIP/SIP-UA-0920e768
2012-08-15 21:46:14 Channel Matched SIP/### style regex. Ext is:SIP
2012-08-15 21:46:14 # +++ findUserByAsteriskExtension(SIP)
2012-08-15 21:46:14 ! Assigned user will be set to Administrator.
2012-08-15 21:46:14 # Measured call duration is 0 seconds
2012-08-15 21:46:14 Adding INBOUND Failed Call, id=1345059388.31, call_id = 44e807fb-fe1c-6bb0-80c1-502bfc1a002b
2012-08-15 21:46:14 # +++ find AccountByPhoneNumber()
2012-08-15 21:46:15 Found a matching account, relating to account instead of contact
2012-08-15 21:46:15 # Establishing relation to Accounts... Call ID: 44e807fb-fe1c-6bb0-80c1-502bfc1a002b to Bean ID: 7430b9b3-ce9d-b965-1d42-50105186d8f1
2012-08-15 21:46:15 ! No results returned
! Call start was 2012-08-15 13:45:54
2012-08-15 21:46:15 # (INBOUND) now updating record in /Calls/ id=44e807fb-fe1c-6bb0-80c1-502bfc1a002b...
Array
(
[bitter] => Array
(
[id] => 10
[call_record_id] => 44e807fb-fe1c-6bb0-80c1-502bfc1a002b
[asterisk_id] =>
[callstate] => Dial
[uistate] =>
[callerID] =>
[callerName] =>
[channel] => SIP/SIP-UA-0920e768
[remote_channel] =>
[timestampCall] => 2012-08-15 15:45:54
[timestampLink] =>
[timestampHangup] =>
[direction] => I
[hangup_cause] =>
[hangup_cause_txt] =>
[asterisk_dest_id] => 1345059388.31
[contact_id] =>
[opencnam] =>
)
[sweet] => Array
(
[assigned_user_name] => As Terix
[modified_by_name] => As Terix
[created_by_name] => As Terix
[id] => 44e807fb-fe1c-6bb0-80c1-502bfc1a002b
[name] => ** Automatic record **
[date_entered] => 2012-08-15 19:45:53
[date_modified] => 2012-08-15 19:45:54
[modified_user_id] => 1e87d528-7473-101d-720a-502aad8dbd7d
[created_by] => 1e87d528-7473-101d-720a-502aad8dbd7d
[description] =>
[deleted] => 0
[assigned_user_id] => 1e87d528-7473-101d-720a-502aad8dbd7d
[duration_hours] => 0
[duration_minutes] =>
[date_start] =>
[date_end] =>
[parent_type] =>
[status] => In Limbo
[direction] => Inbound
[parent_id] =>
[reminder_time] => -1
[outlook_id] =>
[contact_name] =>
[asterisk_caller_id_c] =>
)
)
2012-08-15 21:46:15 NAME: ** Automatic record **
2012-08-15 21:46:15 DESCRIPTION:
2012-08-15 21:46:16 Cleaning up Failed Calls part1, asterisk_id =
2012-08-15 21:46:16 Cleaning up Failed Calls part2, DELETED call_record_id = 44e807fb-fe1c-6bb0-80c1-502bfc1a002b
2012-08-15 21:46:16 [2012-08-15 21:46:16]
2012-08-15 21:46:16 ! --- Event -----------------------------------------------------------
2012-08-15 21:46:16 ! Event --> Hangup
2012-08-15 21:46:16 ! Privilege --> call,all
2012-08-15 21:46:16 ! Channel --> SIP/9902-09203bc0
2012-08-15 21:46:16 ! Uniqueid --> 1345059385.30
2012-08-15 21:46:16 ! Cause --> 16
2012-08-15 21:46:16 ! Cause-txt --> Normal Clearing
2012-08-15 21:46:16 ! ---------------------------------------------------------------------
2012-08-15 21:46:16 # +++ findCallByAsteriskId(1345059385.30)
2012-08-15 21:46:16 ! Warning, results set was empty!
2012-08-15 21:46:16 [1345059385.30] FAILED TO FIND A CALL (note: there are two hangups per call, so this might not be an error)
Thanks for your kind words. I think it's deleting it because call duration is 0 seconds.
The call was detected as inbound. But, deleted after hangup:
"part2, DELETED call_record_id = 44e807fb-fe1c-6bb0-80c1-502bfc1a002b"
You could search asteriskLogger.php for part2, and see why that's happening.
As for the lack of call popup, start with "nothing seems to work" in the troubleshooting section. Did you remember to add call notification checkbox in studio? And enable It for the user?
~blake
On Aug 15, 2012, at 4:25 PM, dbAN [email protected] wrote:
part2, DELETED call_record_id = 44e807fb-fe1c-6bb0-80c1-502bfc1a002b
I also have kind words for the extremely quick response LOL
The calls actually last at least 30 seconds, and yes to studio and enabled for the user.
I'll take a look for part2 in the code and see what I can see.
Will update with anything I find tomorrow, thanks again.
Hmm. Well, I suspect duration could be the problem.
Only time issue I know of is if database time is different then sugar time. There is an open issue where that bug was found.
I'd try doing a really long call and see if duration is still zero.
The fact that your not getting popups is probably because it's not detecting your user extension properly.
~blake
On Aug 15, 2012, at 4:39 PM, dbAN [email protected] wrote:
I also have kind words for the extremely quick response LOL
The calls actually last at least 30 seconds, and yes to studio and enabled for the user.
I'll take a look for part2 in the code and see what I can see.
Will update with anything I find tomorrow, thanks again.
— Reply to this email directly or view it on GitHub.
Yeah it's your extension matching.
See:
2012-08-15 21:46:14 Looking for user extension number in: SIP/SIP-UA-0920e768 2012-08-15 21:46:14 Channel Matched SIP/### style regex. Ext is:SIP
That looks really weird. You must have some very strange dial plan. What extension were you calling from.
~blake
On Aug 15, 2012, at 4:39 PM, dbAN [email protected] wrote:
I also have kind words for the extremely quick response LOL
The calls actually last at least 30 seconds, and yes to studio and enabled for the user.
I'll take a look for part2 in the code and see what I can see.
Will update with anything I find tomorrow, thanks again.
— Reply to this email directly or view it on GitHub.
Ext is 9902, and apparently asterisk is 1.0... sigh... looked through the code and commented out the 1.1 sections I could find, uncommented 1.0 sections, but still no joy
That explains some things... Looks like
Your 0 second call duration is because you don't have a timestampLink. I think in AMI 1.0 this was set in the Link event which was commented out as you described.
if ($rawData['timestampLink'] != NULL) {
$callStartLink = strtotime($rawData['timestampLink']);
$callDurationRaw = $hangupTime - $callStartLink;
}
$callStart = strtotime($rawData['timestampCall']);
logLine("# [$id] Measured call duration is $callDurationRaw seconds\n");
Question... was the call log you posted before an Inbound or Outbound call? It was detected as an Inbound... but I might know what the problem was if it was actually an inbound call.
It was outbound... seems the test against $asteriskMatchInternal (which was empty) determined it was an inbound call...
I'd be happy to see something more elegant than
- $asteriskMatchInternal = "thisisnotagoodthing"; //$sugar_config['asterisk_expr'];
I've done a little hacking and slashing, adding this flag has helped some :)
logLine("! AMI Login action returned with rc=$result\n");
- if (strpos($result,"Manager/1.0") > 0) {
-
$managerVersion = "1.0";
- } else {
-
$managerVersion = "1.1";
- }
Nice...
I just pushed a minor update to combat the issue in the dial event.
e['Source'] in 1.0 == e['Channel'] in 1.1 Merging the changes might help.
Note: On this page I have Log examples... so you can see how events come in on AMI 1.1 for comparison purposes. https://github.com/blak3r/yaai/wiki/Log-Examples
Finally, in \misc\ folder... there are some older versions of asteriskLogger which worked with AMI 1.0.
Nice fix, will try shortly and let you know how it works!
BTW I thought I'd included this change (oddly enough @ line 306) in my last comment
if ($managerVersion == "1.0" && $e['Source'] != "") { $e['Channel'] = $e['Source']; logLine("Version 1.0 - Settiing Channel to " . $e['Channel'] . PHP_EOL); }
Thats actually a little cleaner.
~blake
On Aug 16, 2012, at 4:50 PM, dbAN [email protected] wrote:
Nice fix, will try shortly and let you know how it works!
BTW I thought I'd included this change (oddly enough @ line 306) in my last comment
if ($managerVersion == "1.0" && $e['Source'] != "") { $e['Channel'] = $e['Source']; logLine("Version 1.0 - Settiing Channel to " . $e['Channel'] . PHP_EOL); }
— Reply to this email directly or view it on GitHub.
Your updates definitely helped! Correctly identifying the call as outbound which was a huge step forward!
As you pointed out, the Asterisk box and Sugar box should be in sync time wise, but as I don't have direct access to the asterisk box I modded callListener a little: $lastHour = date('Y-m-d H:i:s',time() - (6 * 60 * 60 + 120));
Maybe see about making a "Time Difference" setting on ASTERISK Configuration?
I've done a little more bashing about myself, as the current script appears to look for contact / account.
Our immediate project calls for lead based calling, so modified findSugarObjectByPhoneNumber to findSugarModuleByPhoneNumber an am calling it as follows: (can shoot you the current version of findSugarModuleByPhoneNumber if you like, it's a little crude)
$sugarCallObject = array('accounts','contacts','leads'); $searchPhone = $rawData['callerID']; $assoSugarObject = 0; foreach ($sugarCallObject as $beanType) { if ($assoSugarObject == FALSE) { logLine("Line 609 - Looking for $beanType with number \n"); $assoSugarObject = findSugarModuleByPhoneNumber($beanType, $searchPhone); if ($assoSugarObject) { $beanID = $assoSugarObject['values']['id']; $beanType = $assoSugarObject['type']; $parentType = $beanType; $parentID = $beanID; } } }
UPDATE - just had a thought about associating an outbound call with the correct sugar object... perhaps an asterisk_outbound_log, that contains module / id / phonenumber / userid, then when an inbound call is detected, and it's actual phone number is assigned, a quick lookup to that table would make sure the call is associated with the correct object ie- target / contact / lead / account / etc.
will take a look @ callCreate.php ...
@dbAN Did you ever get a completely working AMI 1.0 solution together? I'd like to merge your changes into the master branch.
BTW - We fixed the time sync issue in a recent commit.
Actually got pulled off using asterisk for touchstar instead, and at this point I'm afraid I don't recall how far I got.
Attached is the custom/modules/Asterisk directory etc. with my hacks . er. changes.
Feel free to incorporate any changes you like, and let me know if they need some explanation.
I'm hoping we'll need an Asterisk solution in the near future, I really like your project. Very easy to work with, and much better documented than my changes LOL.
I'm still relatively new to doing Sugar customizations, but just did some stuff in a completely unrelated project that I might try to apply here.
Will definitely keep you up to date on how it goes, if I'm able to get back to it.
Shoot me an email when you get a new version ready, I'll be happy to check it out!
Thanks for all your help, working with a well maintained OpenSource project definitely beats dealing with Activex controls LOL!
From: Blake Robertson [mailto:[email protected]] Sent: Tuesday, October 02, 2012 3:53 AM To: blak3r/yaai Cc: dbAN Subject: Re: [yaai] Popup Not Working / Call not recorded in Sugar (#57)
@dbAN https://github.com/dbAN Did you ever get a completely working AMI 1.0 solution together? I'd like to merge your changes into the master branch.
Reply to this email directly or view it on https://github.com/blak3r/yaai/issues/57#issuecomment-9061683 GitHub.
<https://github.com/notifications/beacon/J6T91GIPIyhU-8ti4GCGP2F-ZTAT_r3tBeD RYK1t__RUJVBvPfbbZhHf-_QiZizl.gif>