Added Attended Transfer Logic and made required changes
Showing
6 changed files
with
20 additions
and
59 deletions
| ... | @@ -497,18 +497,18 @@ if($action=="transfercall") | ... | @@ -497,18 +497,18 @@ if($action=="transfercall") |
| 497 | $olddialline=Dialline::find($oldcrmcall->dialline_id); | 497 | $olddialline=Dialline::find($oldcrmcall->dialline_id); |
| 498 | $dspan="1";if($olddialline)$dspan=$olddialline->dspan; | 498 | $dspan="1";if($olddialline)$dspan=$olddialline->dspan; |
| 499 | 499 | ||
| 500 | $dialline=Dialline::where("status","=","Free")->where("enabled","=","1"); | 500 | // $dialline=Dialline::where("status","=","Free")->where("enabled","=","1"); |
| 501 | if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); | 501 | // if($dspan!="")$dialline=$dialline->where('dspan','=',$dspan); |
| 502 | $dialline=$dialline->orderBy('updated_at','ASC')->first(); | 502 | // $dialline=$dialline->orderBy('updated_at','ASC')->first(); |
| 503 | 503 | ||
| 504 | if($dialline) | 504 | if($olddialline) |
| 505 | { | 505 | { |
| 506 | 506 | ||
| 507 | $callerid=$oldcrmcall->did; | 507 | $callerid=$oldcrmcall->did; |
| 508 | 508 | ||
| 509 | $dialline->status="transfer"; | 509 | // $dialline->status="transfer"; |
| 510 | $dialline->channel=$olddialline->channel; | 510 | // $dialline->channel=$olddialline->channel; |
| 511 | $dialline->save(); | 511 | // $dialline->save(); |
| 512 | 512 | ||
| 513 | $nowts=microtime(true)*1000; | 513 | $nowts=microtime(true)*1000; |
| 514 | 514 | ||
| ... | @@ -521,10 +521,10 @@ if($action=="transfercall") | ... | @@ -521,10 +521,10 @@ if($action=="transfercall") |
| 521 | $crmcall->client=$oldcrmcall->client; | 521 | $crmcall->client=$oldcrmcall->client; |
| 522 | $crmcall->department=$oldcrmcall->department; | 522 | $crmcall->department=$oldcrmcall->department; |
| 523 | $crmcall->state='New'; | 523 | $crmcall->state='New'; |
| 524 | $crmcall->userstatus='Conference'; | 524 | $crmcall->userstatus='Transfer'; |
| 525 | $crmcall->usersubstatus='Conference'; | 525 | $crmcall->usersubstatus='Transfer'; |
| 526 | $crmcall->type='Conference'; | 526 | $crmcall->type='Transfer'; |
| 527 | $crmcall->dialline_id=$dialline->id; | 527 | //$crmcall->dialline_id=$dialline->id; |
| 528 | 528 | ||
| 529 | $crmcall->setTs('ts_Wait',$nowts); | 529 | $crmcall->setTs('ts_Wait',$nowts); |
| 530 | $crmcall->setTs('ts_Call',$nowts); | 530 | $crmcall->setTs('ts_Call',$nowts); |
| ... | @@ -537,7 +537,7 @@ if($action=="transfercall") | ... | @@ -537,7 +537,7 @@ if($action=="transfercall") |
| 537 | 537 | ||
| 538 | 538 | ||
| 539 | $newqueue=new Kqueue(); | 539 | $newqueue=new Kqueue(); |
| 540 | $newqueue->transferCall($sipid,$callnumber,$callerid,$crmcall,$dialline); | 540 | $newqueue->transferCall($sipid,$callnumber,$callerid,$crmcall,$olddialline); |
| 541 | 541 | ||
| 542 | //start actual calls | 542 | //start actual calls |
| 543 | // $newqueue=new Kqueue(); | 543 | // $newqueue=new Kqueue(); | ... | ... |
| ... | @@ -850,7 +850,7 @@ class KPAMIListen implements IEventListener | ... | @@ -850,7 +850,7 @@ class KPAMIListen implements IEventListener |
| 850 | 850 | ||
| 851 | //notify UI (only the sip id) | 851 | //notify UI (only the sip id) |
| 852 | $newqueue=new Kqueue(); | 852 | $newqueue=new Kqueue(); |
| 853 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($dchannel)); | 853 | $newqueue->sipNotify($tsip,"dialerUI","dialend","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel)); |
| 854 | 854 | ||
| 855 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | 855 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); |
| 856 | 856 | ||
| ... | @@ -886,40 +886,6 @@ class KPAMIListen implements IEventListener | ... | @@ -886,40 +886,6 @@ class KPAMIListen implements IEventListener |
| 886 | } | 886 | } |
| 887 | 887 | ||
| 888 | } | 888 | } |
| 889 | else if($accountcodearr[1]=="t") // Code Added by AmolG: AutoDial | ||
| 890 | { | ||
| 891 | $crmcall=CRMCall::find($accountcodearr[2]); | ||
| 892 | if($crmcall) | ||
| 893 | { | ||
| 894 | $nowts=microtime(true)*1000; | ||
| 895 | |||
| 896 | $crmcall->setTs('ts_Talk',$nowts); | ||
| 897 | |||
| 898 | $crmcall->state=$eventname; | ||
| 899 | $crmcall->status=$dialstatus; | ||
| 900 | $crmcall->uniqueid=$uniqueid; | ||
| 901 | |||
| 902 | $dialline=Dialline::find($crmcall->dialline_id); | ||
| 903 | if($dialline && $dialstatus=="ANSWER") | ||
| 904 | { | ||
| 905 | // $tsip=Sipid::find($crmcall->sipid_id); | ||
| 906 | |||
| 907 | // $newqueue=new Kqueue(); | ||
| 908 | // $newqueue->channelRedirectToExten($tsip->server,$dchannel,"1004".$tsip->id."|".$dialline->channel,"confTransfer","1"); | ||
| 909 | |||
| 910 | $dialline->channel=$dchannel; | ||
| 911 | $dialline->uniqueid=$uniqueid; | ||
| 912 | $dialline->status="transfer"; | ||
| 913 | $dialline->save(); | ||
| 914 | } | ||
| 915 | |||
| 916 | $crmcall->addEventLog($nowts,"$accountcode:Unknown : $eventname $dchannelstate:$dchannelstatedesc $duniqueid $dexten:$dpriority $dchannel $dialstatus"); | ||
| 917 | |||
| 918 | $crmcall->type="transferred"; | ||
| 919 | $crmcall->save(); | ||
| 920 | } | ||
| 921 | |||
| 922 | } | ||
| 923 | } | 889 | } |
| 924 | } | 890 | } |
| 925 | } | 891 | } |
| ... | @@ -1780,7 +1746,7 @@ if($crmcall->did=='46130234'){ | ... | @@ -1780,7 +1746,7 @@ if($crmcall->did=='46130234'){ |
| 1780 | } | 1746 | } |
| 1781 | else if($tqueue->key=="transfer") | 1747 | else if($tqueue->key=="transfer") |
| 1782 | { | 1748 | { |
| 1783 | $blindtransferaction=new BlindTransferAction($data['channel'],$data['exten'],$data['context']); | 1749 | $blindtransferaction=new AttendedTransferAction($data['channel'],$data['exten'],$data['context'],"1"); |
| 1784 | $res=$this->_client->send($blindtransferaction); | 1750 | $res=$this->_client->send($blindtransferaction); |
| 1785 | } | 1751 | } |
| 1786 | 1752 | ... | ... |
| ... | @@ -88,7 +88,7 @@ class Kqueue extends Model{ | ... | @@ -88,7 +88,7 @@ class Kqueue extends Model{ |
| 88 | $odata['VARS']['callnumber']=$callnumber;*/ | 88 | $odata['VARS']['callnumber']=$callnumber;*/ |
| 89 | 89 | ||
| 90 | $odata['channel']=$channel; | 90 | $odata['channel']=$channel; |
| 91 | $odata['exten']="1003".$dialline->dialstr.$callnumber; | 91 | $odata['exten']="1003".$callnumber; |
| 92 | $odata['context']="initiateTransfer"; | 92 | $odata['context']="initiateTransfer"; |
| 93 | $odata['priority']=1; | 93 | $odata['priority']=1; |
| 94 | 94 | ... | ... |
| ... | @@ -49,8 +49,8 @@ exten => _X!,n,ConfBridge(${CHANNEL}) | ... | @@ -49,8 +49,8 @@ exten => _X!,n,ConfBridge(${CHANNEL}) |
| 49 | exten => _X!,n,Hangup | 49 | exten => _X!,n,Hangup |
| 50 | 50 | ||
| 51 | [initiateTransfer] | 51 | [initiateTransfer] |
| 52 | exten => _X!,n,Dial(${EXTEN:4},30,tT) | 52 | exten => _1003XXXXXXXXXX!,1,Dial(SIP/GATEWAY/${EXTEN:4},30,tT) |
| 53 | exten => _X!,n,Hangup | 53 | exten => _1003XXXXXXXXXX!,n,Hangup |
| 54 | 54 | ||
| 55 | ;exten => _X!,1,Answer | 55 | ;exten => _X!,1,Answer |
| 56 | ;exten => _X!,n,Verbose(${CALLERID(num)}${dialstr}${chnl}) | 56 | ;exten => _X!,n,Verbose(${CALLERID(num)}${dialstr}${chnl}) | ... | ... |
| ... | @@ -1247,11 +1247,6 @@ function dialerTimersUpdate() | ... | @@ -1247,11 +1247,6 @@ function dialerTimersUpdate() |
| 1247 | saveCloseDialerCall('AUTOWRAPUP'); | 1247 | saveCloseDialerCall('AUTOWRAPUP'); |
| 1248 | } | 1248 | } |
| 1249 | 1249 | ||
| 1250 | if(thiswraptime==90 || thiswraptime==300) | ||
| 1251 | { | ||
| 1252 | showWrapUp(); | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | dispD="Wrapup : "+thiswraptime; | 1250 | dispD="Wrapup : "+thiswraptime; |
| 1256 | $("#spandialer_ts").html(dispD); | 1251 | $("#spandialer_ts").html(dispD); |
| 1257 | $("#dialertimes1").removeClass("btn-default").addClass("btn-primary"); | 1252 | $("#dialertimes1").removeClass("btn-default").addClass("btn-primary"); |
| ... | @@ -2247,7 +2242,7 @@ function dialerSipMsg(omsg) | ... | @@ -2247,7 +2242,7 @@ function dialerSipMsg(omsg) |
| 2247 | { | 2242 | { |
| 2248 | try | 2243 | try |
| 2249 | { | 2244 | { |
| 2250 | if(omsg.ao_headers[6].s_name=='kstych-data') | 2245 | if(omsg.ao_headers[6].s_name=='kstych-Data') |
| 2251 | { | 2246 | { |
| 2252 | var vparts=omsg.ao_headers[6].s_value.split("|"); | 2247 | var vparts=omsg.ao_headers[6].s_value.split("|"); |
| 2253 | 2248 | ... | ... |
| ... | @@ -380,8 +380,8 @@ $("#"+divid).html(searchRecordDivHTML); | ... | @@ -380,8 +380,8 @@ $("#"+divid).html(searchRecordDivHTML); |
| 380 | doAjax('dialer?action=transfercall&confnumber='+confnumber,datastr,'__fake__div__', 'ajax_confdial','singlefail','POST', function(retstr){ | 380 | doAjax('dialer?action=transfercall&confnumber='+confnumber,datastr,'__fake__div__', 'ajax_confdial','singlefail','POST', function(retstr){ |
| 381 | if(retstr.responseText.indexOf('Error')<0) | 381 | if(retstr.responseText.indexOf('Error')<0) |
| 382 | { | 382 | { |
| 383 | kcallSetConnection(confnumber,'callid',retstr.responseText); | 383 | // kcallSetConnection(confnumber,'callid',retstr.responseText); |
| 384 | kcallSetConnection(confnumber,'ts_Call',getNowTS()); | 384 | // kcallSetConnection(confnumber,'ts_Call',getNowTS()); |
| 385 | 385 | ||
| 386 | updateDialerState(); | 386 | updateDialerState(); |
| 387 | } | 387 | } | ... | ... |
-
Please register or sign in to post a comment