Commit 1955c8a9 authored by Kulya's avatar Kulya 😊

sip_reg_period_to_10_3

parent 2ee9c3c0
......@@ -1587,6 +1587,7 @@ class AloVoiceConnector
public function getUserSoftphoneExe($num){
$configs = self::getConfigs();
$title = $configs["bitrix_domain"];
$nowTime = time();
$ip = (!empty($configs["sipaddress_local"])) ? $configs["sipaddress_local"] : '192.168.123.6';
$port = (!empty($configs["sipport_local"])) ? $configs["sipport_local"] : '5060';
......@@ -1611,36 +1612,48 @@ class AloVoiceConnector
}
$softfoneUserExe = $newUseSoftfoneDir.'phonerlite.exe';
$softfoneUserDownExe = $newUseSoftfoneDir.'phonerlite_'.$nowTime.'.exe';
$newUseSoftfoneLink = $configs["alovoice_host"].'files/phonerlite_'.$num.'/phonerlite.exe';
$userSoftphoneLinkDownLink = $configs["alovoice_host"].'files/phonerlite_'.$num.'/phonerlite_'.$nowTime.'.exe';
$qrPng = self::make_qraccount($configs,$out_ip.":".$out_port,$num,$passPeer);
if(file_exists($softfoneUserExe)){
return ["link"=>$newUseSoftfoneLink,"qrpng"=>$qrPng,"password"=>$passPeer];
$res = ["link"=>$newUseSoftfoneLink,"qrpng"=>$qrPng,"password"=>$passPeer];
}
$newUserSftSipperFile = $newUseSoftfoneDir.'sipper.ini';
$newUserSftProviderFile = $newUseSoftfoneDir.'provider.ini';
$sipperPutRes = file_put_contents( $newUserSftSipperFile, self::make_sipperini($ip,$port,$out_ip,$out_port,$num,$passPeer) );
$providerPutRes = file_put_contents( $newUserSftProviderFile, self::make_providerini($title,$ip,$bxaddr) );
if(file_exists($sampleSoftfoneExe)){
copy($sampleSoftfoneExe,$softfoneUserExe);
$exeChRes = exec($sampleSoftfoneExeMaker.' '.$softfoneUserExe.' '.$newUserSftSipperFile);
$exeChPrRes = exec($sampleSoftfoneExeMaker.' '.$softfoneUserExe.' '.$newUserSftProviderFile);
else {
$newUserSftSipperFile = $newUseSoftfoneDir.'sipper.ini';
$newUserSftProviderFile = $newUseSoftfoneDir.'provider.ini';
$res = [$title,$ip,$bxaddr,$port,$num,$passPeer,$newUseSoftfoneDir,$sipperPutRes,$providerPutRes,"qrpng"=>$qrPng,"exeChRes"=>$exeChRes,"exeChPrRes"=>$exeChPrRes,"link"=>$newUseSoftfoneLink,"password"=>$passPeer];
}
else{
$res = ["result"=>"Directory Ready","dir"=>$sampleSoftfoneExe,"isSample"=>file_exists($sampleSoftfoneExe),"password"=>$passPeer];
$sipperPutRes = file_put_contents( $newUserSftSipperFile, self::make_sipperini($ip,$port,$out_ip,$out_port,$num,$passPeer) );
$providerPutRes = file_put_contents( $newUserSftProviderFile, self::make_providerini($title,$ip,$bxaddr) );
if(file_exists($sampleSoftfoneExe)){
copy($sampleSoftfoneExe,$softfoneUserExe);
$exeChRes = exec($sampleSoftfoneExeMaker.' '.$softfoneUserExe.' '.$newUserSftSipperFile);
$exeChPrRes = exec($sampleSoftfoneExeMaker.' '.$softfoneUserExe.' '.$newUserSftProviderFile);
$res = [$title,$ip,$bxaddr,$port,$num,$passPeer,$newUseSoftfoneDir,$sipperPutRes,$providerPutRes,"qrpng"=>$qrPng,"exeChRes"=>$exeChRes,"exeChPrRes"=>$exeChPrRes,"link"=>$newUseSoftfoneLink,"password"=>$passPeer];
}
else{
$res = ["result"=>"Directory Ready","dir"=>$sampleSoftfoneExe,"isSample"=>file_exists($sampleSoftfoneExe),"password"=>$passPeer];
}
}
if(!empty($res["link"])){
if (is_dir($newUseSoftfoneDir)) {
array_map('unlink', glob($newUseSoftfoneDir.'phonerlite_*.exe'));
}
copy($softfoneUserExe,$softfoneUserDownExe);
$res["link"] = $userSoftphoneLinkDownLink;
}
return $res;
// $provider_init = self::make_providerini($title,$ip,$bxaddr);
// $sipper_init = self::make_sipperini($ip,$port,$num,$pass);
}
......@@ -1765,163 +1778,7 @@ CFU=';
return $iniText;
}
public function OLD_make_sipperini($addr,$port='5060',$addr_out,$port_out='5060',$num,$pass){
$iniText = '[Profile]
Profile=Alovoice_'.$num.'
[Office_local_'.$num.']
UserName='.$num.'|'.$num.'
DisplayName=Technounit
Password='.$pass.'
LocalPort='.$port.'
Gateway='.$addr.'
STUN=
Realm='.$addr.'
Register=1
Codecs=9,-107,8,0,-2,-3,-97,-110,-111,18,-112,-113,-114,101,-11,-118
UseAppGUID=1
AppGUID=00DE6AE6-4E26-EB11-ACBB-6D762EC99F4D
Mailbox=
PhoneNumber=
MWI=1
RegisterPeriod=10
ConnectionType=0
NoFallback=0
Alias=0
SessionTimers=0
MDNS=1
MDNS_sipuri=0
UPnP=0
ResolveDefaultGateway=1
IPv6=0
DualStackIPv6=0
QoS=1
GRUU=1
CheckUsername=1
CheckFirewall=0
MirrorRTP=0
ForceOwnCodecPriority=0
ForceOldCodecPriority=0
AllowAutoAnswer=0
SendEmptyInvite=0
PEarlyMedia=0
SendRingbackTone=0
EchoTail=100
EchoOffset=60
SpeexBandwidth=15
ENUM=e164.org, e164.arpa, e164.info
SRTP=0
UNENCRYPTED_SRTCP=0
UNAUTHENTICATED_SRTP=0
MediaSec=0
ZRTP=0
ZRTP_MASQUERADE=0
SAVP=0
MOH=2
G726_AAL2=1
G722_16000=0
Silence=0
ServerCertificate=
ServerKey=
ClientCertificate=
CheckCertificate=0
LoadWindowsCA=0
AGC_in=0
AGC_out=0
Denoise_in=0
Denoise_out=1
NoiseSuppress_in=15
NoiseSuppress_out=15
DeclineNotBusy=0
RTPoverSIPFallback=5
RTP_auto_STUN=0
STUNoverSIP=0
DoOverrideIP=1
DelayedHoldRetrieve=0
IgnoreDomainForIncomingCalls=0
BNC=0
FetchBindings=0
HTTP=1
ActivationCount=28
CFU=
[Office_out_'.$num.']
UserName='.$num.'|'.$num.'
DisplayName=Technounit
Password='.$pass.'
LocalPort='.$port_out.'
Gateway='.$addr_out.'
STUN=
Realm='.$addr_out.'
Register=1
Codecs=9,-107,8,0,-2,-3,-97,-110,-111,18,-112,-113,-114,101,-11,-118
UseAppGUID=1
AppGUID=00DE6AE6-4E26-EB11-ACBB-6D762EC99F4D
Mailbox=
PhoneNumber=
MWI=1
RegisterPeriod=600
ConnectionType=0
NoFallback=0
Alias=0
SessionTimers=0
MDNS=1
MDNS_sipuri=0
UPnP=0
ResolveDefaultGateway=1
IPv6=0
DualStackIPv6=0
QoS=1
GRUU=1
CheckUsername=1
CheckFirewall=0
MirrorRTP=0
ForceOwnCodecPriority=0
ForceOldCodecPriority=0
AllowAutoAnswer=0
SendEmptyInvite=0
PEarlyMedia=0
SendRingbackTone=0
EchoTail=100
EchoOffset=60
SpeexBandwidth=15
ENUM=e164.org, e164.arpa, e164.info
SRTP=0
UNENCRYPTED_SRTCP=0
UNAUTHENTICATED_SRTP=0
MediaSec=0
ZRTP=0
ZRTP_MASQUERADE=0
SAVP=0
MOH=2
G726_AAL2=1
G722_16000=0
Silence=0
ServerCertificate=
ServerKey=
ClientCertificate=
CheckCertificate=0
LoadWindowsCA=0
AGC_in=0
AGC_out=0
Denoise_in=0
Denoise_out=1
NoiseSuppress_in=15
NoiseSuppress_out=15
DeclineNotBusy=0
RTPoverSIPFallback=5
RTP_auto_STUN=0
STUNoverSIP=0
DoOverrideIP=1
DelayedHoldRetrieve=0
IgnoreDomainForIncomingCalls=0
BNC=0
FetchBindings=0
HTTP=1
ActivationCount=28
CFU=';
return $iniText;
}
public function recurse_copy($src,$dst) {
$dir = opendir($src);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment