3CXObjectModel Modify user profiles

Status
Not open for further replies.

TD Rigus

Customer
Joined
Jan 24, 2022
Messages
6
Reaction score
0
http://downloads.3cx.com/downloads/misc/callcontrolapi/3CXCallControlAPI_v18.zip

There was a problem programmatically modifying user call forwarding rules (3CXObjectModel)
On the local 3cx server, I run a powershell script to change the phone to which the call is forwarded
The rest of the user's parameters are saved when changing, but for some reason the routes are not.
Well, or is it possible to re-read the data from the database (For example, by directly changing the data in sql and then calling some method so that 3cx gets it (this method works interactively through the web form, but not through the Save () method))?

Add-Type -Path "C:\Program Files\3CX Phone System\Bin\3cxpscomcpp2.dll"
$PS=[TCX.Configuration.PhoneSystem]
$PS::CfgServerHost="127.0.0.1"
$PS::CfgServerPort=5485
$PS::CfgServerUser="cfguser_default"
$PS::CfgServerPassword="passs"
$PS::ApplicationName="ContactApp"
$t=($PS::Root)
$t.WaitForConnect((New-TimeSpan -Seconds 30))
$SotrTo = $t.GetExtensions() |Where-Object {$_.Number -eq 155}
$Sotr = $t.GetExtensions() |Where-Object {$_.Number -eq 162}
$extProfile = $Sotr.FwdProfiles |Where-Object {$_.Name -eq "Available"}
$route = $extProfile.AvailableRoute
$route.NoAnswer.AllCalls.Internal = $SotrTo
$route.NoAnswer.Internal.Internal = $SotrTo
$route.Busy.AllCalls.Internal = $SotrTo
$route.Busy.Internal.Internal = $SotrTo
$route.NotRegistered.AllCalls.Internal = $SotrTo
$route.NotRegistered.Internal.Internal = $SotrTo
$Sotr.Save()
$t.Disconnect()
 
Status
Not open for further replies.

Forum statistics

Threads
112,314
Messages
591,847
Members
165,458
Latest member
Kayla Norris