Updated Hangup event condition and source, Added incoming tone when call is getting connected
Showing
6 changed files
with
115 additions
and
17 deletions
| ... | @@ -57,7 +57,7 @@ class PredictiveCallHangUp extends Command { | ... | @@ -57,7 +57,7 @@ class PredictiveCallHangUp extends Command { |
| 57 | public function runHangUp() | 57 | public function runHangUp() |
| 58 | { | 58 | { |
| 59 | try { | 59 | try { |
| 60 | $breathingTime = 30; | 60 | $breathingTime = 5; |
| 61 | $avgringsec = 30; | 61 | $avgringsec = 30; |
| 62 | 62 | ||
| 63 | $avgringsec = Cutoff::select(DB::Raw('avg(avg_ring) as avgringsec'))->first(); | 63 | $avgringsec = Cutoff::select(DB::Raw('avg(avg_ring) as avgringsec'))->first(); | ... | ... |
| ... | @@ -659,9 +659,11 @@ class DialerController extends Controller { | ... | @@ -659,9 +659,11 @@ class DialerController extends Controller { |
| 659 | $dialline=Dialline::find($crmcall->dialline_id); | 659 | $dialline=Dialline::find($crmcall->dialline_id); |
| 660 | if($dialline) | 660 | if($dialline) |
| 661 | { | 661 | { |
| 662 | if($crmcall->state!='Hangup') | 662 | $hsource = "Telecaller"; |
| 663 | |||
| 664 | if($crmcall->hsource=="") | ||
| 663 | { | 665 | { |
| 664 | $crmcall->hsource='User'; | 666 | $crmcall->hsource=$hsource; |
| 665 | $crmcall->save(); | 667 | $crmcall->save(); |
| 666 | } | 668 | } |
| 667 | 669 | ... | ... |
| ... | @@ -433,6 +433,8 @@ class KPAMIListen implements IEventListener | ... | @@ -433,6 +433,8 @@ class KPAMIListen implements IEventListener |
| 433 | $cause=$event->getKey("Cause"); | 433 | $cause=$event->getKey("Cause"); |
| 434 | $causetxt=$event->getKey("Cause-txt"); | 434 | $causetxt=$event->getKey("Cause-txt"); |
| 435 | 435 | ||
| 436 | $hsource = ""; | ||
| 437 | |||
| 436 | if($accountcode!="") | 438 | if($accountcode!="") |
| 437 | { | 439 | { |
| 438 | //echo "$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt\n"; | 440 | //echo "$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt\n"; |
| ... | @@ -463,7 +465,6 @@ class KPAMIListen implements IEventListener | ... | @@ -463,7 +465,6 @@ class KPAMIListen implements IEventListener |
| 463 | $crmcall->statuscode=$cause; | 465 | $crmcall->statuscode=$cause; |
| 464 | $crmcall->substatus=$causetxt; | 466 | $crmcall->substatus=$causetxt; |
| 465 | 467 | ||
| 466 | |||
| 467 | $dialline=Dialline::find($crmcall->dialline_id); | 468 | $dialline=Dialline::find($crmcall->dialline_id); |
| 468 | if($dialline && $dialline->status != "Auto" && $dialline->status != "AutoCall") | 469 | if($dialline && $dialline->status != "Auto" && $dialline->status != "AutoCall") |
| 469 | { | 470 | { |
| ... | @@ -486,6 +487,26 @@ class KPAMIListen implements IEventListener | ... | @@ -486,6 +487,26 @@ class KPAMIListen implements IEventListener |
| 486 | $tsip->save(); | 487 | $tsip->save(); |
| 487 | } | 488 | } |
| 488 | 489 | ||
| 490 | if($crmcall->hsource == "") { | ||
| 491 | if(strstr($channel, "Local") != "") { | ||
| 492 | $localChannlArr = explode(";", $channel); | ||
| 493 | |||
| 494 | if($localChannlArr[1]==1) | ||
| 495 | $hsource = "Telecaller"; | ||
| 496 | else if($localChannlArr[1]==2) | ||
| 497 | $hsource = "Customer"; | ||
| 498 | } | ||
| 499 | else if($crmcall->status != "ANSWER") { | ||
| 500 | $hsource = "System"; | ||
| 501 | } | ||
| 502 | else | ||
| 503 | { | ||
| 504 | $hsource = "Customer"; | ||
| 505 | } | ||
| 506 | |||
| 507 | $crmcall->hsource=$hsource; | ||
| 508 | } | ||
| 509 | |||
| 489 | //$newqueue=new Kqueue(); | 510 | //$newqueue=new Kqueue(); |
| 490 | //$newqueue->playhangupfile($dialline->channel,$dialline->server); | 511 | //$newqueue->playhangupfile($dialline->channel,$dialline->server); |
| 491 | 512 | ||
| ... | @@ -497,21 +518,26 @@ class KPAMIListen implements IEventListener | ... | @@ -497,21 +518,26 @@ class KPAMIListen implements IEventListener |
| 497 | $crmcall->save(); | 518 | $crmcall->save(); |
| 498 | } | 519 | } |
| 499 | } | 520 | } |
| 500 | else if($accountcodearr[1]=="a") // Code Added by AmolG: AutoDial | 521 | else if($accountcodearr[1]=="a") |
| 501 | {Log::info($accountcodearr); | 522 | { |
| 502 | Dialline::where('id', $accountcodearr[3]) | 523 | $affectedRows = Dialline::where('id', $accountcodearr[3]) |
| 503 | ->where(function ($query) use($channel) { | 524 | ->where(function ($query) use($channel) { |
| 504 | $query->where('channel', '=', $channel) | 525 | $query->where('channel', '=', $channel) |
| 505 | ->orWhere('status', '=', 'AutoCall'); | 526 | ->orWhere('status', '=', 'AutoCall'); |
| 506 | })->update(['status' => "Free", | 527 | }) |
| 507 | 'conf' => "", | 528 | ->update([ |
| 508 | 'number' => "", | 529 | 'user_id' => 0, |
| 509 | 'uniqueid'=> "", | 530 | 'status' => "Free", |
| 510 | 'channel' => "", | 531 | 'conf' => "", |
| 511 | 'regexstr'=> "", | 532 | 'number' => "", |
| 512 | 'did' => "", | 533 | 'uniqueid' => "", |
| 513 | ]); | 534 | 'src_channel' => "", |
| 514 | 535 | 'channel' => "", | |
| 536 | 'regexstr' => "", | ||
| 537 | 'did' => "", | ||
| 538 | ]); | ||
| 539 | |||
| 540 | if($affectedRows == 1) { | ||
| 515 | $crmcall=CRMCall::find($accountcodearr[2]); | 541 | $crmcall=CRMCall::find($accountcodearr[2]); |
| 516 | if($crmcall) | 542 | if($crmcall) |
| 517 | { | 543 | { |
| ... | @@ -528,6 +554,26 @@ class KPAMIListen implements IEventListener | ... | @@ -528,6 +554,26 @@ class KPAMIListen implements IEventListener |
| 528 | $newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | 554 | $newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); |
| 529 | } | 555 | } |
| 530 | 556 | ||
| 557 | if($crmcall->hsource == "") { | ||
| 558 | if(strstr($channel, "Local") != "") { | ||
| 559 | $localChannlArr = explode(";", $channel); | ||
| 560 | |||
| 561 | if($localChannlArr[1]==1) | ||
| 562 | $hsource = "Telecaller"; | ||
| 563 | else if($localChannlArr[1]==2) | ||
| 564 | $hsource = "Customer"; | ||
| 565 | } | ||
| 566 | else if($crmcall->status != "ANSWER") { | ||
| 567 | $hsource = "System"; | ||
| 568 | } | ||
| 569 | else | ||
| 570 | { | ||
| 571 | $hsource = "Customer"; | ||
| 572 | } | ||
| 573 | |||
| 574 | $crmcall->hsource=$hsource; | ||
| 575 | } | ||
| 576 | |||
| 531 | $crmcall->setTs('ts_Recend',$nowts); | 577 | $crmcall->setTs('ts_Recend',$nowts); |
| 532 | 578 | ||
| 533 | $crmcall->state=$eventname; | 579 | $crmcall->state=$eventname; |
| ... | @@ -591,6 +637,7 @@ class KPAMIListen implements IEventListener | ... | @@ -591,6 +637,7 @@ class KPAMIListen implements IEventListener |
| 591 | 637 | ||
| 592 | $crmcall->save(); | 638 | $crmcall->save(); |
| 593 | 639 | ||
| 640 | } | ||
| 594 | } | 641 | } |
| 595 | } | 642 | } |
| 596 | } | 643 | } |
| ... | @@ -1506,6 +1553,9 @@ class KPAMIListen implements IEventListener | ... | @@ -1506,6 +1553,9 @@ class KPAMIListen implements IEventListener |
| 1506 | $newqueue->recordChannel($dialline->server,$dialline->channel,$recfile); | 1553 | $newqueue->recordChannel($dialline->server,$dialline->channel,$recfile); |
| 1507 | 1554 | ||
| 1508 | $newqueue=new Kqueue(); | 1555 | $newqueue=new Kqueue(); |
| 1556 | $newqueue->userToConf($found); | ||
| 1557 | |||
| 1558 | $newqueue=new Kqueue(); | ||
| 1509 | $newqueue->channelRedirectToExten($found->server,$dialline->channel,"1000".$found->id,"kstychDialer","1"); | 1559 | $newqueue->channelRedirectToExten($found->server,$dialline->channel,"1000".$found->id,"kstychDialer","1"); |
| 1510 | 1560 | ||
| 1511 | $dialline->user_id = $found->user; | 1561 | $dialline->user_id = $found->user; | ... | ... |
| ... | @@ -330,6 +330,8 @@ function dialerAddConfCall() | ... | @@ -330,6 +330,8 @@ function dialerAddConfCall() |
| 330 | 330 | ||
| 331 | function incomingCall(calllog,crmid,numnchn) | 331 | function incomingCall(calllog,crmid,numnchn) |
| 332 | { | 332 | { |
| 333 | incomingbeep.play(); | ||
| 334 | |||
| 333 | //document.getElementById("hangup").play(); | 335 | //document.getElementById("hangup").play(); |
| 334 | $("#dialersearchresults").html('<div id=divworking></div><div style="clear:both"></div>'); | 336 | $("#dialersearchresults").html('<div id=divworking></div><div style="clear:both"></div>'); |
| 335 | 337 | ... | ... |
| ... | @@ -12,7 +12,7 @@ | ... | @@ -12,7 +12,7 @@ |
| 12 | if($vieportopt[0]=="responsive"){ ?> | 12 | if($vieportopt[0]=="responsive"){ ?> |
| 13 | <meta name="viewport" content="width=device-width, initial-scale={!!$vieportopt[1]!!}, maximum-scale={!!$vieportopt[2]!!}"> | 13 | <meta name="viewport" content="width=device-width, initial-scale={!!$vieportopt[1]!!}, maximum-scale={!!$vieportopt[2]!!}"> |
| 14 | <?php } ?> | 14 | <?php } ?> |
| 15 | <meta name="author" content="Siddharth Upmanyu"> | 15 | <meta name="author" content="Buzzworks"> |
| 16 | 16 | ||
| 17 | <?php if(isset($logo_s))$fico=$logo_s;else $fico="favicon.png"; ?> | 17 | <?php if(isset($logo_s))$fico=$logo_s;else $fico="favicon.png"; ?> |
| 18 | <link rel="icon" href="{!!url('/')!!}/custom/{!!$fico!!}" type="image/x-icon" /> | 18 | <link rel="icon" href="{!!url('/')!!}/custom/{!!$fico!!}" type="image/x-icon" /> | ... | ... |
kickConf.php
0 → 100755
| 1 | #!/usr/bin/php | ||
| 2 | <?php | ||
| 3 | $db = mysqli_connect("localhost", "root", "yb9738z", "flexydial_hdfc_beu"); | ||
| 4 | |||
| 5 | for ($i=0; $i < 1; $i++) { | ||
| 6 | $sql = $db->query("SELECT d.conf FROM diallines d JOIN sipids s ON d.conf = concat('1000',s.id) WHERE s.status=0"); | ||
| 7 | $confs = $sql->fetch_all(); | ||
| 8 | |||
| 9 | foreach($confs as $conf){ | ||
| 10 | print_r($conf); | ||
| 11 | exec('/usr/sbin/asterisk -rx "confbridge kick '.$conf[0].' all"'); | ||
| 12 | } | ||
| 13 | |||
| 14 | $sql = $db->query("SELECT channel FROM diallines WHERE status IN ('Inbound','Auto') AND conf='' AND UNIX_TIMESTAMP(updated_at) <= (".time()." - 60)"); | ||
| 15 | $channels = $sql->fetch_all(); | ||
| 16 | |||
| 17 | foreach($channels as $channel){ | ||
| 18 | print_r($channel); | ||
| 19 | exec('/usr/sbin/asterisk -rx "confbridge kick '.$channel[0].' all"'); | ||
| 20 | } | ||
| 21 | |||
| 22 | $sipIdStr = "'0'"; | ||
| 23 | exec("/usr/sbin/asterisk -rx 'confbridge list'",$activeConfs); | ||
| 24 | foreach($activeConfs as $activeConf){ | ||
| 25 | $activeConfArr = explode(" ", preg_replace('!\s+!', ' ', $activeConf) ); | ||
| 26 | $sipConf = $activeConfArr[0]; | ||
| 27 | |||
| 28 | if(!empty($sipConf) && !(strpos($sipConf, '1000')===false) ){ | ||
| 29 | $sipIdStr .= ",'".substr($sipConf, 4)."'"; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | |||
| 33 | $sql = $db->query("select * from sipids where status=0 and id in ($sipIdStr)"); | ||
| 34 | $sipids = $sql->fetch_all(); | ||
| 35 | |||
| 36 | foreach($sipids as $sipid){ | ||
| 37 | print_r('1000'. $sipid[0]); | ||
| 38 | exec('/usr/sbin/asterisk -rx "channel request hangup '.$sipid[0].'"'); | ||
| 39 | exec('/usr/sbin/asterisk -rx "confbridge kick 1000'.$sipid[0].' all"'); | ||
| 40 | } | ||
| 41 | echo "HI"; | ||
| 42 | # usleep(1000*1000*9); | ||
| 43 | } | ||
| 44 | ?> |
-
Please register or sign in to post a comment