[YMCS/YDMP Free Trial Program]Yealink would like to offer Free Trial Program of Yealink device management service for our current eligible customers. You can see the details below.
https://www.yealink.com/ydmp-freetrial-2020


Post Reply 
 
Thread Rating:
  • 1 Votes - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
T38 wallpaper change
Author Message
cptjack Offline
Member
***

Posts: 97
Joined: Jan 2014
Reputation: 8
Post: #11
RE: T38 wallpaper change
There are several ways to achieve this. Either all in the dialplan, or all in the PHP script or a combination of both. I haven't played around with AGI, but I'm sure you it can also call the curl script from the dialplan if needed.

1) You can include this macro-wallaper in your dialplan and call it from the night-mode extensions like this:
Code:
[macro-wallpaper]
exten => s,1,NoOp(Setting wallpaper of phone ${CHANNEL(peerip)} to ${ARG1})
     same => n,Set(options=profileOpen("/phone/config/user.ini")profileSetString("PhoneSetting","BackGrounds","Config:${ARG1}")profileSave()msgBroadcastPostMessage("0x10007","43","0")))
     same => n,System(curl --form-string 'postCommands=${options}' http://${CHANNEL(peerip)}/cgi-bin/cgiServer.exx)

[night-mode-ext]
exten => *32,1,NoOp(CLOSED - Nightmode)
     same => n,Macro(wallpaper,wall01.jpg)
     same => n,Hangup()
exten => *34,1,NoOp(BACK - Backline-Group/Weekend)
     same => n,Macro(wallpaper,wall02.jpg)
     same => n,Hangup()
exten => *30,1,NoOp(HERE - Recept answering)
     same => n,Macro(wallpaper,wall03.jpg)
     same => n,Hangup()
exten => *31,1,NoOp(AWAY - Ring-Group answering (Lunch))
     same => n,Macro(wallpaper,wall04.jpg)
     same => n,Hangup()
Note: this uses the System() call and will execute the parameters passed to it in the shell. So, make sure the command is secure and do NOT pass anything to it that is not verified as safe. In this case we use ${CHANNEL(peerip)} to get the phone ip address and ${ARG1} to pass the name of the wallpaper to set.

2) You can change the PHP script above to use URI=DIAL:*3x instead of URI=Key:Cancel. It will accomplish the same thing, but via the external script:
PHP Code:
<?php
ini_set
('error_reporting'E_ALL);
ini_set('display_errors''0');

// Server and Phone URI
$scripturl 'http://' $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
$phoneip $_SERVER['REMOTE_ADDR'];    // Your phone IP

$maxnum 4;
$username"admin";
$password"admin";
$extensions = array(1=>"*32",2=>"*34",3=>"*30",4=>"*31");

$id 0;
if (isset(
$_GET["id"])) { $id += $_GET["id"]; }
if (isset(
$_GET["phoneip"])) { $phoneip $_GET["phoneip"]; }

if ((
$id>0) && ($id<=$maxnum)) {
    
// Change the Wallpaper and dial extension
    
setWallpaper("wall0$id.jpg"$phoneip$username$password);
    echo 
'<YealinkIPPhoneExecute Beep="no"><ExecuteItem URI="Dial:'.$extensions[$id].'"/></YealinkIPPhoneExecute>';
} else {
    
// List Options
    
echo '
    <?xml version="1.0" encoding="ISO-8859-1"?>
<YealinkIPPhoneTextScreen
        Beep="no"
        defaultIndex=""
        cancelAction=""
        doneAction=""
        Timeout="10000"
        LockIn="no">
<Title wrap="yes">RECEPTIONIST STATUS</Title>
<Text>
CLOSED'
."\t".'Nightmode
BACK'
."\t".'Backline-Group/Weekend
HERE'
."\t".'Recept answering
AWAY'
."\t".'Ring-Group answering (Lunch)
</Text>

<SoftKey index="1">
<Label>CLOSED</Label>
<URI>'
.$scripturl."?id=1".'</URI>
</SoftKey>

<SoftKey index="2">
<Label>BACK</Label>
<URI>'
.$scripturl."?id=2".'</URI>
</SoftKey>

<SoftKey index="3">
<Label>HERE</Label>
<URI>'
.$scripturl."?id=3".'</URI>
</SoftKey>


<SoftKey index="4">
<Label>AWAY</Label>
<URI>'
.$scripturl."?id=4".'</URI>
</SoftKey>

</YealinkIPPhoneTextScreen>'
;
    
 }
 
 
 function 
setWallpaper($rname$host$username$password) {
        
$ch curl_init();
        
        
// Login to the web interface
        
curl_setopt($chCURLOPT_USERPWD$username ":" $password);
        
curl_setopt($chCURLOPT_URL'http://'.$host);
        
curl_setopt($chCURLOPT_COOKIEFILE'/dev/null');
        
curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
$store curl_exec($ch);
        
        
// Post Wallpaper Choice
        
curl_setopt($chCURLOPT_URL'http://'.$host.'/cgi-bin/cgiServer.exx');
        
$postCommands='profileOpen("/phone/config/user.ini")profileSetString("PhoneSetting","BackGrounds","Config:'.$rname.'")profileSave()msgBroadcastPostMessage("0x10007","43","0"))';
        
$fields = array('postCommands' => $postCommands);
        
curl_setopt($chCURLOPT_POSTFIELDS$fields);
        
$content curl_exec($ch);

        return 
$content;
}
?>

3) Lastly, you can call the php script from the dialplan too:
Code:
exten => *32,1,NoOp(CLOSED - Nightmode)
     same => n,Set(Result=${CURL(http://serverip/script.php?id=1&phoneip=${CHANNEL(peerip)})})
     same => n,Hangup()
exten => *34,1,NoOp(BACK - Backline-Group/Weekend)
     same => n,Set(Result=${CURL(http://serverip/script.php?id=2&phoneip=${CHANNEL(peerip)})})
     same => n,Hangup()
exten => *30,1,NoOp(HERE - Recept answering)
     same => n,Set(Result=${CURL(http://serverip/script.php?id=3&phoneip=${CHANNEL(peerip)})})
     same => n,Hangup()
exten => *31,1,NoOp(AWAY - Ring-Group answering (Lunch))
     same => n,Set(Result=${CURL(http://serverip/script.php?id=4&phoneip=${CHANNEL(peerip)})})
     same => n,Hangup()

Please use the reputation button below if you like this post.
(This post was last modified: 06-19-2014 04:12 PM by cptjack.)
06-19-2014 06:48 AM
Find all posts by this user    like0    dislike0 Quote this message in a reply
CWR Offline
Moderator
*****

Posts: 717
Joined: May 2013
Reputation: 7
Post: #12
RE: T38 wallpaper change
So the code in section 2 makes the call to the 83x number - but doesn't seem to change my wallpaper.

I have 4 loaded on the phone and confirm they work.
wall01.jpg
wall02.jpg
wall03.jpg
wall04.jpg

If I put these 2 lines back in - nothing occurs.
Code:
setWallpaper("wall0$id.jpg", $phoneip, $username, $password);
echo '<YealinkIPPhoneExecute Beep="no"><ExecuteItem URI="Key:CANCEL"/></YealinkIPPhoneExecute>';

Craig Reilly
MCSA, 3cx Advanced Certified
Scottsdale, AZ
(This post was last modified: 06-19-2014 08:08 AM by CWR.)
06-19-2014 07:49 AM
Find all posts by this user    like0    dislike0 Quote this message in a reply
cptjack Offline
Member
***

Posts: 97
Joined: Jan 2014
Reputation: 8
Post: #13
RE: T38 wallpaper change
Hi, I updated the PHP in section 2) and replaced the setWallpaper function with the one I posted before. Seems some tweaks didn't work out the way I expected. I have been testing with serveral methods and this one should be the most robust. First make sure the wallpaper gets changed, then you can test the Dial URI string.

If it doesn't work, try calling the script from a webbrowser directly using http://server/script.php?id1&phoneip=10.x.x.x

Please use the reputation button below if you like this post.
06-19-2014 04:19 PM
Find all posts by this user    like0    dislike0 Quote this message in a reply
CWR Offline
Moderator
*****

Posts: 717
Joined: May 2013
Reputation: 7
Post: #14
RE: T38 wallpaper change
thank you... just needed to change this to 1 line... the formatting was adding unwanted spaces at the beginning of each line.

Code:
    CLOSED'."\t".'Nightmode'."\n".'BACK'."\t".'Backline-Group/Weekend'."\n".'HERE'."\t".'Recept answering'."\n".'AWAY'."\t".'Ring-Group answering (Lunch)

Craig Reilly
MCSA, 3cx Advanced Certified
Scottsdale, AZ
(This post was last modified: 06-19-2014 10:53 PM by CWR.)
06-19-2014 10:53 PM
Find all posts by this user    like0    dislike0 Quote this message in a reply
cptjack Offline
Member
***

Posts: 97
Joined: Jan 2014
Reputation: 8
Post: #15
RE: T38 wallpaper change
Your welcome. I'm glad it worked out the way you wanted. Smile

Please use the reputation button below if you like this post.
06-21-2014 04:22 AM
Find all posts by this user    like0    dislike0 Quote this message in a reply
lorn10 Offline
Junior Member
**

Posts: 43
Joined: Feb 2014
Reputation: 0
Post: #16
RE: T38 wallpaper change
Hi to all

Little and somewhat stupid question, - into which config file I have to put the "wallpaper_upload.url = " auto provision parameter rightly?

Into the y0000000000x8.cfg or the mac.cfg or into both of them?

Some people write it into y0000000000x8.cfg while others into mac.cfg, and another into both. Very confusing... Whats here Yealink's position?

Thanks for any hints!
01-22-2015 11:35 PM
Find all posts by this user    like0    dislike0 Quote this message in a reply
CWR Offline
Moderator
*****

Posts: 717
Joined: May 2013
Reputation: 7
Post: #17
RE: T38 wallpaper change
the "y" file is common file. so if you want same wallpaper on all phones put it in here.

Craig Reilly
MCSA, 3cx Advanced Certified
Scottsdale, AZ
01-23-2015 12:15 AM
Find all posts by this user    like1    dislike0 Quote this message in a reply
lorn10 Offline
Junior Member
**

Posts: 43
Joined: Feb 2014
Reputation: 0
Post: #18
RE: T38 wallpaper change
(01-23-2015 12:15 AM)craigreilly Wrote:  the "y" file is common file. so if you want same wallpaper on all phones put it in here.

Great, thanks for this information. Now I understand, the "y" config is for all phones of same type / model. While the "mac" config file is individual for each phone specific.
01-24-2015 01:03 AM
Find all posts by this user    like0    dislike0 Quote this message in a reply
CWR Offline
Moderator
*****

Posts: 717
Joined: May 2013
Reputation: 7
Post: #19
RE: T38 wallpaper change
(01-24-2015 01:03 AM)lorn10 Wrote:  
(01-23-2015 12:15 AM)craigreilly Wrote:  the "y" file is common file. so if you want same wallpaper on all phones put it in here.

Great, thanks for this information. Now I understand, the "y" config is for all phones of same type / model. While the "mac" config file is individual for each phone specific.

In case you did not get this... the mac.cfg is usually more like 00156548f407.cfg - uses the actual phone MAC address.

Craig Reilly
MCSA, 3cx Advanced Certified
Scottsdale, AZ
01-24-2015 01:09 AM
Find all posts by this user    like0    dislike0 Quote this message in a reply
lorn10 Offline
Junior Member
**

Posts: 43
Joined: Feb 2014
Reputation: 0
Post: #20
RE: T38 wallpaper change
(01-23-2015 12:15 AM)craigreilly Wrote:  In case you did not get this... the mac.cfg is usually more like 00156548f407.cfg - uses the actual phone MAC address.

Yes, it's a dynamic $mac.cfg file. So OSS PBX End Point Manager in FreePBX will automatically assign the corresponding MAC address of the relevant phone. Wink
01-24-2015 01:20 AM
Find all posts by this user    like0    dislike0 Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Register Failed after network change pdoerr 6 57,348 02-01-2015 06:03 AM
Last Post: CWR
  T32 and 38 wallpaper size aboodoo 1 10,061 02-20-2014 07:00 PM
Last Post: Yealink Support

Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us   Yealink   Return to Top   Return to Content   Lite (Archive) Mode   RSS Syndication