3CX Update all Phone Logos

If you have ever managed a 3CX instance you will understand that there are many little things that could be much easier.

One of these is changing the logo on all the phones in the system.

Sure, you could go ahead and SSH into the server if its a Debian instance or browse the files if its in windows and modify the files in the server or make a custom template. However, these both have their downsides.

If you modify the files then there is a chance that when the next update is rolled out your changes will be lost the same if you modify the template and a new version is deployed. another option is a custom template. This can work well but if your phone vendor releases new features that are available with a firmware & template update, you will have to go and update the template again.

Also if you ever require 3CX support and they see you have custom templates, they will ask you to revert back to default ones before continuing with the support ticket.

The “correct” way to update the logo is to edit each extension one at a time, go the the phone provisioning tab and then choose the new logo.

The first time you do this you will need to upload it, and if you have several models of phone you may need to upload a few different versions for the different screen sizes etc.

Checkout the script code below, also visit my GitHub Repo to make sure you get the latest version etc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
################################################################
#                                                              #
#           3CX Logo Upadter Information Script                # 
#                                                              #
# Note: 1. Storing Credentials in a script is not recommended! #
#       2. Running this script is at your own risk             #
#                                                              #
#                                                              #
# Script By: Yourit.online                                     #
################################################################
 
### Update the details here:
 
$3cxurl  = '' #Enter your url here including the trailing forward slash (eg. https://xyz.3cx.com.au/)
$3cxuser = '' #3cx admin user, consider creating a restricterd admin user 
$3cxpass = '' #3cx Password
#commented line out as line 71 now looks up the logo filename from the system
#$logo="" #set this to match the logo file name in 3CX
 
 
### Start Script
 
 
$3cxcreds = "{`"Username`":`"$3cxuser`",`"Password`":`"$3cxpass`"}"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
 
$headers = @{
    "Accept"="application/json, text/plain, */*"; 
    "Referer"="$($3cxurl)"; 
    "Origin"="$($3cxurl)"; 
    "User-Agent"="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"
    }
 
#try to login    
$login = Invoke-WebRequest -Uri "$($3cxurl)api/login" `
    -Method "POST" -Headers $headers -ContentType "application/json;charset=UTF-8" -Body $3cxcreds -SessionVariable sesh
 
if ($login.StatusCode -ne "200") {
    throw "Login to 3CX failed: $($login.content)"
    exit #exit if login failed
} else { 
 
#continue if login successful
 
# get list of all extensions / users
$Extns = (irm -Uri "$($3cxurl)api/ExtensionList" -websession $sesh).list
 
}
 
# Loop through the extensions
$Extns |% {
    Write-Host "Checking Logo for:" -ForegroundColor Green
    Write-host "ID: $($_.id)"
    Write-host "Name: $($_.FirstName)"
    Write-host "Ext: $($_.Number)"
    $Ext = iwr -Uri "$($3cxurl)api/ExtensionList/set" -Method Post -websession $sesh -Body "{`"Id`":$($_.id)}" -ContentType "application/json;charset=UTF-8" 
    $customProfiles = iwr -uri "$($3cxurl)api/CustomParametersList/getCustomProfileNames" -Method Get -websession $sesh -ContentType "application/json;charset=UTF-8" 
    $queues = iwr -uri "$($3cxurl)api/queueList/getQueuesByAgent?extensionNumber=$($_.number)" -Method Get -websession $sesh -ContentType "application/json;charset=UTF-8" 
    $ExtID = ($Ext.Content |ConvertFrom-Json).id
    $PhoneDevices = ($Ext.Content |ConvertFrom-Json).activeobject.PhoneDevices 
    $phones = $PhoneDevices._value
    $phones | % {
        Write-host "phone ID: $($_.id)"
        Write-host "phone model: $($_.model._value)"
        Write-host "phone Logo: $($_.PhoneLogo.selected)"
        Write-host "phone Logos available: $($_.PhoneLogo.possibleValues)"
        if ($null -eq $($_.PhoneLogo.possibleValues)){
            write-host "Phone does not support logos" -ForegroundColor Magenta
            return
        }
        $readPropertyBody = "{`"Path`":{`"ObjectId`":$ExtID,`"PropertyPath`":[{`"Name`":`"PhoneDevices`",`"IdInCollection`":$($_.id)},{`"Name`":`"PhoneLogo`"}]},`"State`":{`"Start`":0,`"Search`":`"`"},`"Count`":1000}"
        #lookup the Possible Values for logos
        $readProperty = iwr -Uri "$($3cxurl)api/edit/readProperty" -Method Post -Headers $headers -websession $sesh -Body $readPropertyBody -ContentType "application/json;charset=UTF-8" 
        #set the logo to the 2nd option (index #1)
        $logo = ($readProperty.Content |convertfrom-json).PossibleValues[1]
        $logobody = "{`"Path`":{`"ObjectId`":$ExtID,`"PropertyPath`":[{`"Name`":`"PhoneDevices`",`"IdInCollection`":$($_.id)},{`"Name`":`"PhoneLogo`"}]},`"PropertyValue`":`"$logo`"}"
        $UpdateLogo = iwr -Uri "$($3cxurl)api/edit/update" -Method Post -Headers $headers -websession $sesh -Body $logobody -ContentType "application/json;charset=UTF-8" 
        # write-host "test body: $logobody"
    }
   $Save = iwr -Uri "$($3cxurl)api/edit/save" -Method Post -websession $sesh -Body "$extID" -ContentType "application/json;charset=UTF-8" 
 
    }

3CX Update all Phone Logos
Scroll to top