Corrected new code If transferred call is not connected
Showing
1 changed file
with
21 additions
and
7 deletions
| ... | @@ -460,8 +460,6 @@ class KPAMIListen implements IEventListener | ... | @@ -460,8 +460,6 @@ class KPAMIListen implements IEventListener |
| 460 | 460 | ||
| 461 | $cause=$event->getKey("Cause"); | 461 | $cause=$event->getKey("Cause"); |
| 462 | $causetxt=$event->getKey("Cause-txt"); | 462 | $causetxt=$event->getKey("Cause-txt"); |
| 463 | Log::info("$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt\n"); | ||
| 464 | Log::info("Hangup".$accountcode); | ||
| 465 | if($accountcode!="") | 463 | if($accountcode!="") |
| 466 | { | 464 | { |
| 467 | //echo "$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt\n"; | 465 | //echo "$accountcode:HangupEvent : $eventname $channelstate:$channelstatedesc $uniqueid $exten:$priority $channel $cause:$causetxt\n"; |
| ... | @@ -484,6 +482,21 @@ class KPAMIListen implements IEventListener | ... | @@ -484,6 +482,21 @@ class KPAMIListen implements IEventListener |
| 484 | $crmcall=CRMCall::find($accountcodearr[2]); | 482 | $crmcall=CRMCall::find($accountcodearr[2]); |
| 485 | if($crmcall) | 483 | if($crmcall) |
| 486 | { | 484 | { |
| 485 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 486 | |||
| 487 | if(stristr($channel, "initiateTransfer")) | ||
| 488 | { | ||
| 489 | if($dialline) | ||
| 490 | { | ||
| 491 | $dialline->channel=$_SESSION['prev_channel']; | ||
| 492 | $dialline->save(); | ||
| 493 | |||
| 494 | unset($_SESSION['prev_channel']); | ||
| 495 | } | ||
| 496 | |||
| 497 | exit; | ||
| 498 | } | ||
| 499 | |||
| 487 | $nowts=microtime(true)*1000; | 500 | $nowts=microtime(true)*1000; |
| 488 | 501 | ||
| 489 | $crmcall->setTs('ts_Recend',$nowts); | 502 | $crmcall->setTs('ts_Recend',$nowts); |
| ... | @@ -492,9 +505,6 @@ class KPAMIListen implements IEventListener | ... | @@ -492,9 +505,6 @@ class KPAMIListen implements IEventListener |
| 492 | $crmcall->statuscode=$cause; | 505 | $crmcall->statuscode=$cause; |
| 493 | $crmcall->substatus=$causetxt; | 506 | $crmcall->substatus=$causetxt; |
| 494 | 507 | ||
| 495 | |||
| 496 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 497 | |||
| 498 | if($dialline) | 508 | if($dialline) |
| 499 | { | 509 | { |
| 500 | Dialline::where('status', '=', 'transfer') | 510 | Dialline::where('status', '=', 'transfer') |
| ... | @@ -832,6 +842,10 @@ class KPAMIListen implements IEventListener | ... | @@ -832,6 +842,10 @@ class KPAMIListen implements IEventListener |
| 832 | $crmcall->status=$dialstatus; | 842 | $crmcall->status=$dialstatus; |
| 833 | 843 | ||
| 834 | $dialline=Dialline::find($crmcall->dialline_id); | 844 | $dialline=Dialline::find($crmcall->dialline_id); |
| 845 | |||
| 846 | if(!isset($_SESSION['prev_channel'])) | ||
| 847 | $_SESSION['prev_channel'] = $dialline->channel; | ||
| 848 | |||
| 835 | if($dialline) | 849 | if($dialline) |
| 836 | { | 850 | { |
| 837 | $dialline->channel=$channel; | 851 | $dialline->channel=$channel; |
| ... | @@ -844,7 +858,7 @@ class KPAMIListen implements IEventListener | ... | @@ -844,7 +858,7 @@ class KPAMIListen implements IEventListener |
| 844 | 858 | ||
| 845 | //start recording | 859 | //start recording |
| 846 | $newqueue=new Kqueue(); | 860 | $newqueue=new Kqueue(); |
| 847 | $newqueue->recordChannel($tsip->server,$dchannel,$recfile); | 861 | $newqueue->recordChannel($tsip->server,$channel,$recfile); |
| 848 | 862 | ||
| 849 | $crmcall->setTs('ts_Recstart',$nowts); | 863 | $crmcall->setTs('ts_Recstart',$nowts); |
| 850 | 864 | ||
| ... | @@ -852,7 +866,7 @@ class KPAMIListen implements IEventListener | ... | @@ -852,7 +866,7 @@ class KPAMIListen implements IEventListener |
| 852 | $newqueue=new Kqueue(); | 866 | $newqueue=new Kqueue(); |
| 853 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); | 867 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); |
| 854 | 868 | ||
| 855 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | 869 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $channel $dialstatus"); |
| 856 | 870 | ||
| 857 | $crmcall->save(); | 871 | $crmcall->save(); |
| 858 | } | 872 | } | ... | ... |
-
Please register or sign in to post a comment