Yealink Forums
[SOLVED] cant get XML to display during startup sequence. - Printable Version

+- Yealink Forums (http://forum.yealink.com/forum)
+-- Forum: IP Phone Series (/forumdisplay.php?fid=4)
+--- Forum: Auto Provisioning (/forumdisplay.php?fid=14)
+--- Thread: [SOLVED] cant get XML to display during startup sequence. (/showthread.php?tid=3251)



[SOLVED] cant get XML to display during startup sequence. - cadillackid - 02-03-2015 06:09 AM

I have a custom script that I run to configure my new phones to my system. it basically looks for the input of an extension number from the user and then builds the MAC.cfg file based on what is input. the script works great, except that it will not run automatically when a new phone is plugged into the system or one is factory defaulted.

my y000000000028.cfg is as follows
Code:
#!version:1.0.0.1
# action_url.setup_completed = http://172.16.4.2/yealink/newphone.php?user=none
# action_url.ip_change = http://172.16.4.2/yealink/newphone.php
action_url.register_failed = http://172.16.4.2/yealink/newphone.php?user=none
# sip account
account.1.enable = 1
account.1.label = Unregistered
account.1.auth_name = unregistered
account.1.user_name = unregistered
account.1.password = none
account.1.sip_server.1.address = 172.16.4.2
account.1.sip_server.1.expires = 300
account.1.sip_server.1.retry_counts = 0
push_xml.server = 172.16.4.2
features.action_uri_limit_ip = any
#syslog.mode = 1
#syslog.server = 172.16.4.2
#syslog.level = 6
phone_setting.custom_softkey_enable = 1
programablekey.2.type = 27
programablekey.2.value = http://172.16.4.2/yealink/newphone.php?user=none

the script worlks perfectly if it is placed in a softkey or linekey on the phone, but wont display when the phone boots up.

the setup_completed uri would NEVER trigger it..
I then put in a fake SIP account and a trigger on register failed, I can see the script being requested from my web server but it still never displays on the phone screen.

below is the GET from my apache.. it is identical whether automatically called from the register fail or the Softkey.. yet only the softkey one works..
Code:
172.16.4.122 - - [02/Feb/2015:17:06:16 -0500] "GET /yealink/newphone.php?user=none HTTP/1.1" 200 254 "-" "Yealink SIP-T46G 28.72.0.26 00:15:65:76:3d:21"
if I wait for the phone to come up then Manually call the script by pressing my Softkey (as you see I have progammed). the script works perfect. so I know the script is coded right..

is it not possible to display XML to the phone on startup or register fail?

as mentioned above the script is requested from the web server just not displayed. I did not see anything regarding auto provisioning in my syslog and I have set to syslog level 6..

below is the XML being output from the server to the phone. again it works when used with softkey but not from register fail. even though the call makes itto my web server
Code:
<?xml version="1.0" encoding="utf-8"?>
<YealinkIPPhoneInputScreen type = "number" Timeout = "0">
<Title>New Phone</Title>
<Prompt>NewExt:</Prompt>
<URL>http://172.16.4.2/yealink/newphone.php</URL>
<Parameter>user</Parameter>
</YealinkIPPhoneInputScreen>



RE: cant get XML to display during startup sequence. - CWR - 02-03-2015 06:52 AM

Maybe the RPS could be helpful in your case:
http://yealink.com/product_info.aspx?ProductsCateID=227&CateId=217&BaseInfoCateId=227&Cate_Id=227&parentcateid=217


RE: cant get XML to display during startup sequence. - cadillackid - 02-03-2015 07:00 AM

the only issue with using RPS is that not always upon initial installation is there internet access at the site. we want to simply drop ship phones.. (or allow customer to buy their own phones), and not tie a specific extension to a MAC address..

with our aastra phones, we plug them in, they get the new phone screen, they type the extension in, if the extension is already registered to another phone, they are asked if they wish to replace the existing phone.. if they say yes and the existing phone is plugged in, it will delete the existing config file, and send a reboot to the phone.. the phone reboots to a bare master config which nullifies all Account values so the old phone doesnt try to register to the server... (we do this Now with our aastras)

obviously a workaround in my case is to blank the phone and put a button on it that says 'NewPhone' and lock out anything else.. im just trying to make it similar for training purposes in a customer site that has mixed phone types.

FWIW.. Aastra XML and Yealink XML are darn near identical.. in fact an Aastra Formatted XML file will display on a Yealink... interesting tidbit...
-Christopher


RE: cant get XML to display during startup sequence. - CWR - 02-03-2015 07:11 AM

That makes a lot of sense... was just throwing it out there.

Good luck on this endeavor... I love the idea.


[SOLVED] RE: cant get XML to display during startup sequence. - cadillackid - 02-04-2015 06:31 PM

Ok I solved this issue. the simple solution is that for XML to display automatically after the startup, I have to Push it to the phone as opposed to the phone going into browser mode to request the startup URI.

so my action URI stays the same, I still have to use the "Fake" SIP account as the setup_completed URI never executes.. (im guessing because the <MAC>.cfg doesnt exist so it considers it a "failed" setup_completed..

a sample PHP i use to push data to the phone is this:
Code:
############################################################
# Function to push XML data to the phone
############################################################
function phonepush($server_ip,$phone_ip,$data)
{
$xmldata = "xml=".$data;
$postheader = "POST / HTTP/1.1\r\n";
$postheader .= "Host: $phone_ip\r\n";
$postheader .= "Referer: $server_ip\r\n";
$postheader .= "Connection: Keep-Alive\r\n";
$postheader .= "Content-Type: text/xml\r\n";
$postheader .= "Content-Length: ".strlen($xmldata)."\r\n\r\n";
$fp = @fsockopen ( $phone_ip, 80, $errno, $errstr, 5);
if($fp)
{
fputs($fp, $postheader.$xmldata);
flush();
fclose($fp);
}
}

and then sample XML data that is pushed to the phone.

Code:
###########################################################
# Function to display select menu to phone.
###########################################################
function selectnum()
{
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$xml .= "<YealinkIPPhoneInputScreen type = \"number\" Timeout = \"0\">\n";
$xml .= "<Title>New Phone</Title>\n";
$xml .= "<Prompt>NewExt:</Prompt>\n";
$xml .= "<URL>http://www.someurl.here</URL>\n";
$xml .= "<Parameter>user</Parameter>\n";
$xml .= "</YealinkIPPhoneInputScreen>\n";
phonepush("server.ip.here","phone.ip.her",$xml);

}

hope this helps someone out that wants to display an XML form on startup.

since I put this in my Model specific config, it loads this XML anytime the phone loads. however once my system generates a <MAC>.cfg for the phone, I blank the values out in the config for
action url setup completed and for action_url register failed. because the phone <MAC>.cfg supercedes the model config file the newphone message is never displayed on a phone that has been configured...

-Christopher


RE: [SOLVED] cant get XML to display during startup sequence. - lukak - 08-03-2015 07:26 PM

(02-04-2015 06:31 PM)cadillackid Wrote:  Ok I solved this issue. the simple solution is that for XML to display automatically after the startup, I have to Push it to the phone as opposed to the phone going into browser mode to request the startup URI.

so my action URI stays the same, I still have to use the "Fake" SIP account as the setup_completed URI never executes.. (im guessing because the <MAC>.cfg doesnt exist so it considers it a "failed" setup_completed..

a sample PHP i use to push data to the phone is this:
Code:
############################################################
# Function to push XML data to the phone
############################################################
function phonepush($server_ip,$phone_ip,$data)
{
$xmldata = "xml=".$data;
$postheader = "POST / HTTP/1.1\r\n";
$postheader .= "Host: $phone_ip\r\n";
$postheader .= "Referer: $server_ip\r\n";
$postheader .= "Connection: Keep-Alive\r\n";
$postheader .= "Content-Type: text/xml\r\n";
$postheader .= "Content-Length: ".strlen($xmldata)."\r\n\r\n";
$fp = @fsockopen ( $phone_ip, 80, $errno, $errstr, 5);
if($fp)
{
fputs($fp, $postheader.$xmldata);
flush();
fclose($fp);
}
}

and then sample XML data that is pushed to the phone.

Code:
###########################################################
# Function to display select menu to phone.
###########################################################
function selectnum()
{
$xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$xml .= "<YealinkIPPhoneInputScreen type = \"number\" Timeout = \"0\">\n";
$xml .= "<Title>New Phone</Title>\n";
$xml .= "<Prompt>NewExt:</Prompt>\n";
$xml .= "<URL>http://www.someurl.here</URL>\n";
$xml .= "<Parameter>user</Parameter>\n";
$xml .= "</YealinkIPPhoneInputScreen>\n";
phonepush("server.ip.here","phone.ip.her",$xml);

}

hope this helps someone out that wants to display an XML form on startup.

since I put this in my Model specific config, it loads this XML anytime the phone loads. however once my system generates a <MAC>.cfg for the phone, I blank the values out in the config for
action url setup completed and for action_url register failed. because the phone <MAC>.cfg supercedes the model config file the newphone message is never displayed on a phone that has been configured...

-Christopher

Hi Christopher,

Can you please send me this code? I want to make auto configuration of mac.cfg files, when username and password are inserted.

BR,

Luka