[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:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to detect or manage expansion modules ?
Author Message
jolouis Offline
Moderator
*****

Posts: 339
Joined: Oct 2013
Reputation: 6
Post: #15
RE: How to detect or manage expansion modules ?
(04-18-2017 03:41 AM)Kevin_Yealink Wrote:  I know totally what you need. I have 1 question, would you mind kindly guiding me who to create cfg/config file on the server side.

....So I don't think it is convenience.
Hi Kevin,

You're still thinking static config files my friend... Oliv and I are talking about dynamically generated ones. So in our case, the server will generate the configs on demand, based on the request.

For example:
1) Configure webserver so that all requests to a given path are forwarded to a dynamic generator (in this case PHP script). In Apache you can do something like this in an htaccess file:
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ master.php?file=$1 [L,QSA]
This takes all incoming requests and says if the requested file doesn't exist, make the request to master.php, and pass the filename as the "file=" argument.
2) Now write master.php to generate the appropriate configuration based on the requested file. Usually this involves pulling information from a database, or some pre-set cache. Once the data is loaded, appropriate config information is written out. A simple example:
Code:
<?php

//Get the name of the requested file
$targetFN = $_REQUEST["file"];

if ($targetFN == "y000000000046.cfg") {
        //Generate or import generic config for T29G

} else if (preg_match("/^([0-9A-Fa-f]{2}){6}\.cfg$/", $targetFN)) {
        //Regular expressoin matches any MAC.cfg file requests.

        //connect to database and load information for this device...
        //Fake this in our example
        if ($targetFN == "001565297016.cfg") {
                $myExt = "420";
        } else {
                //..other definitions based on other MACs
        }


        //Now generate config as it will be seen by phone
        echo '#!version:1.0.0.1

##File header "#!version:1.0.0.1" can not be edited or deleted, and must be placed in the first line.##
';

        //Output basic config for first 3 line keys
        echo "linekey.1.line = 1
linekey.1.type = 15
linekey.1.label = $myExt
linekey.2.line = 1
linekey.2.type = 15
linekey.2.label = $myExt
linekey.3.line = 1
linekey.3.type = 15
linekey.3.label = $myExt
";

        //Now, let's output BLF depending on what is in user agent.
        $ua = $_SERVER['HTTP_USER_AGENT'];

        //If the user agent contained expander information, we could search for that and adjust our BLF output based on it.
        if (strpos($ua, "Exp") !== false) {
                //Expander is included in UA, so must be present. Put exp button config out
                echo "expansion_module.1.key.1.type = 16
                      expansion_module.1.key.1.line = 1
                      expansion_module.1.key.1.value = 254
                      expansion_module.1.key.1.label = Jim Bob
                ";

        } else {
                //No Expander present, so put this as a BLF on normal phone key instead
                echo "linekey.8.line = 1
                      linekey.8.type = 16
                      linekey.8.value = 254
                      linekey.8.label = Jim Bob
                ";

        }
}

?>
3) Setup phones to request provisioning from the above server.

If Yealink updated firmware to add expander information to user agent in some way (i.e. add "Exp1:EXP20" if a EXP20 was connected), then the script from would adjust it's output. Phone without EXP would get:
Code:
#!version:1.0.0.1

##File header "#!version:1.0.0.1" can not be edited or deleted, and must be placed in the first line.##
linekey.1.line = 1
linekey.1.type = 15
linekey.1.label = 420
linekey.2.line = 1
linekey.2.type = 15
linekey.2.label = 420
linekey.3.line = 1
linekey.3.type = 15
linekey.3.label = 420
linekey.8.line = 1
linekey.8.type = 16
linekey.8.value = 254
linekey.8.label = Jim Bob

While alternatively, phone with EXP would automatically get:
Code:
#!version:1.0.0.1

##File header "#!version:1.0.0.1" can not be edited or deleted, and must be placed in the first line.##
linekey.1.line = 1
linekey.1.type = 15
linekey.1.label = 420
linekey.2.line = 1
linekey.2.type = 15
linekey.2.label = 420
linekey.3.line = 1
linekey.3.type = 15
linekey.3.label = 420
expansion_module.1.key.1.type = 16
expansion_module.1.key.1.line = 1
expansion_module.1.key.1.value = 254
expansion_module.1.key.1.label = Jim Bob

That of course is an overly simplified piece of coding but it works for demonstration.

These type of cfg generators are usually included as part of PBX software, implemented through "Auto Provisioning" or "Provision generator templates". Other times people like me write our own to fit custom needs or requirements for our customers and different types of installations.
(This post was last modified: 04-18-2017 02:42 PM by jolouis.)
04-18-2017 02:36 PM
Find all posts by this user    like0    dislike0 Quote this message in a reply
Post Reply 


Messages In This Thread
RE: How to detect or manage expansion modules ? - jolouis - 04-18-2017 02:36 PM

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Question why phone send gateway ip detect packet pig_tails 1 5,172 06-04-2021 08:38 PM
Last Post: KaithlynMoore
  My T27G does not detect BT40 or WF40 oliv 4 14,671 04-12-2017 01:30 PM
Last Post: oliv
  Detect a yealinkphone cuongvc93 1 6,758 04-22-2015 01:51 PM
Last Post: Elaine_Yealink
  Do not detect inband DTMF aron 0 5,751 03-21-2015 05:38 AM
Last Post: aron

Forum Jump:


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

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