添加更新分机状态

This commit is contained in:
lilong@dgg.net 2021-04-01 09:13:15 +08:00
parent 033156a55f
commit 95768ae9be
1 changed files with 10 additions and 0 deletions

View File

@ -53,6 +53,7 @@ class EslListen
$originate = sprintf("originate {origination_uuid=%s}user/%s &bridge({origination_uuid=%s}user/%s)",
$this->cdr->aleg_uuid,$this->cdr->caller,$this->cdr->bleg_uuid,$this->cdr->callee
);
$local_call = true;
}
$this->fs->events("CHANNEL_ANSWER CHANNEL_HANGUP_COMPLETE");
@ -80,10 +81,14 @@ class EslListen
'answer_time' => date('Y-m-d H:i:s'),
'record_file' => str_replace($fs_dir, $record_url, $fullfile),
]);
if (isset($local_call)&&$local_call===true){
Sip::query()->where('username',$this->cdr->callee)->update(['state'=>'active']);
}
}else{
$this->cdr->update([
'start_time' => date('Y-m-d H:i:s'),
]);
Sip::query()->where('username',$this->cdr->caller)->update(['state'=>'active']);
}
break;
case 'CHANNEL_HANGUP_COMPLETE':
@ -100,6 +105,11 @@ class EslListen
'billsec' => $billsec,
]);
}
if (isset($local_call)&&$local_call===true){
Sip::query()->whereIn('username',[$this->cdr->caller,$this->cdr->callee])->update(['state'=>'down']);
}else{
Sip::query()->where('username',$this->cdr->caller)->update(['state'=>'down']);
}
break 2;
default:
break;