Avaya Support Forums  

Go Back   Avaya Support Forums > Telephones, Adjuncts, and Adapters

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-01-2012, 11:33 AM
rfisher1008 rfisher1008 is offline
Member
 
Join Date: Feb 2012
Posts: 3
rfisher1008 has 10 reputation points
Default subscribe.php issues

I am having an issue when phones are rebooted the subscribe.php runs and over writes the existing line on the phone_db.txt file. The subscribe file is as follows.

<?php
/* This file captures the extension, IP, MAC and SetID during the Boot-up process.
These values are obtained as part of the Subscription feature of the Avaya IP Phones*/
$EXT = $_GET["Extn"]; //capture the extension
$IP = $_GET["ip"]; //capture the ip-address
$MAC = $_GET["MAC"]; //capture the MAC Address
$SET_ID = $_GET["SetID"]; //capture the Set ID
$CWD = getcwd(); // returns the current working directory
/* For simplicity the database is a simple text file (Phone_db.txt), in a real world application
any database such as MySQL, SQL Server, Oracle, etc. would be used */
// Phone_db.txt is a file of CSV lines: ext,ip
$handle = fopen("$CWD\\Phone_db.txt", "r");
// read the contents of file
if ($handle) {
while (!feof($handle)) {
// $line is an array of where each element is one of the CSV fields of the file
// Note that the newline chars have been stripped
$line = explode("\n", rtrim(fgets($handle)));
// $lines[] is an array of arrays, i.e., each element is one of the line arrays
$lines[] = $line;
}
}
fclose($handle);
// create the new file with old references to EXT or IP removed and the new one added
$handle = fopen("$CWD\\Phone_db.txt", "w");
foreach($lines as $line) {
// note: $line[0] = ext, $line[1] = ip etc.
// skip any line that has either the same IP or the same EXT
// as these are being replaced with the new values
if($EXT == $line[0] || $IP == $line[1] || $MAC == $line[2] || $SET_ID == $line[3])
continue;
fwrite($handle, $line[0] . "," . $line[1] . "," . $line[2] . "," . $line[3] . "\r\n");
}
// now write the new record
fwrite($handle, $EXT . "," . $IP . "," . $MAC . "," . $SET_ID);
fclose($handle); //close the file
?>

Thank you in advance for your help.
Reply With Quote
  #2  
Old 04-03-2012, 03:46 AM
aviswanathan's Avatar
aviswanathan aviswanathan is offline
Hot Shot
.
 
Join Date: Feb 2010
Location: Pune
Posts: 19
aviswanathan has 11 reputation points
Default

Which phones are you using and where is this file located ?
Reply With Quote
  #3  
Old 04-09-2012, 05:54 AM
rfisher1008 rfisher1008 is offline
Member
 
Join Date: Feb 2012
Posts: 3
rfisher1008 has 10 reputation points
Default

We have 9611's and the file is located on the web server itself.
Thank you.
Reply With Quote
  #4  
Old 04-09-2012, 07:17 AM
aviswanathan's Avatar
aviswanathan aviswanathan is offline
Hot Shot
.
 
Join Date: Feb 2010
Location: Pune
Posts: 19
aviswanathan has 11 reputation points
Default

Seems this would need modification of existing script. Recommend opening a Service Request with Avaya Support. Please go to support.avaya.com and open a new Service Request.
Reply With Quote
  #5  
Old 04-09-2012, 07:26 AM
rfisher1008 rfisher1008 is offline
Member
 
Join Date: Feb 2012
Posts: 3
rfisher1008 has 10 reputation points
Default

Thank you for your help. I will try that.
Reply With Quote
Reply

Tags
96xx, php, subscribe, subscription

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:57 PM.

This Forum is provided solely for the use and convenience of Avaya customers and partners. Use of the Forum is subject to the Terms and Use and Privacy Statement found at www.avaya.com. No other use is permitted. The Forum including all content posted is “AS IS” and Avaya expressly disclaims all warranties and/or guarantees as to its accuracy, reliability, usefulness, quality or non-infringement of intellectual property. Avaya reserves the right to remove any content posted on the Forum at any time and for whatever reason.

Avaya will not be liable for any content posted on this Forum, including, without limitation, any errors or omissions or for any losses or damages of any kind incurred as a result of use or reliance on any content, regardless of its origin.

You expressly understand and agree that you assume all risks associated with use or reliance on this content.