<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Grimsy&#039;s Blog &#187; Uncategorized</title>
	<atom:link href="http://blog.grimsy.net/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.grimsy.net</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 20 May 2010 04:51:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>More fishtank photos</title>
		<link>http://blog.grimsy.net/2009/11/12/more-fishtank-photos/</link>
		<comments>http://blog.grimsy.net/2009/11/12/more-fishtank-photos/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 00:07:34 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.grimsy.net/?p=141</guid>
		<description><![CDATA[Just a few more photos now that I have the tank up and running and my fish moved across. Sorry about the quality of the photos, my fish don&#8217;t seem to like posing so most of them are slightly blurry.]]></description>
			<content:encoded><![CDATA[<p>Just a few more photos now that I have the tank up and running and my fish moved across.<br />
Sorry about the quality of the photos, my fish don&#8217;t seem to like posing so most of them are slightly blurry.</p>

<a href='http://blog.grimsy.net/2009/11/12/more-fishtank-photos/sdcarddcimcamera2009-11-02-21-00-21/' title='sdcarddcimcamera2009-11-02 21.00.21'><img width="150" height="150" src="http://blog.grimsy.net/wp-content/uploads/2009/11/sdcarddcimcamera2009-11-02-21.00.21-150x150.jpg" class="attachment-thumbnail" alt="sdcarddcimcamera2009-11-02 21.00.21" title="sdcarddcimcamera2009-11-02 21.00.21" /></a>
<a href='http://blog.grimsy.net/2009/11/12/more-fishtank-photos/sdcarddcimcamera2009-11-02-21-00-42/' title='sdcarddcimcamera2009-11-02 21.00.42'><img width="150" height="150" src="http://blog.grimsy.net/wp-content/uploads/2009/11/sdcarddcimcamera2009-11-02-21.00.42-150x150.jpg" class="attachment-thumbnail" alt="sdcarddcimcamera2009-11-02 21.00.42" title="sdcarddcimcamera2009-11-02 21.00.42" /></a>
<a href='http://blog.grimsy.net/2009/11/12/more-fishtank-photos/sdcarddcimcamera2009-11-07-19-01-09/' title='sdcarddcimcamera2009-11-07 19.01.09'><img width="150" height="150" src="http://blog.grimsy.net/wp-content/uploads/2009/11/sdcarddcimcamera2009-11-07-19.01.09-150x150.jpg" class="attachment-thumbnail" alt="sdcarddcimcamera2009-11-07 19.01.09" title="sdcarddcimcamera2009-11-07 19.01.09" /></a>
<a href='http://blog.grimsy.net/2009/11/12/more-fishtank-photos/sdcarddcimcamera2009-11-07-19-04-51/' title='sdcarddcimcamera2009-11-07 19.04.51'><img width="150" height="150" src="http://blog.grimsy.net/wp-content/uploads/2009/11/sdcarddcimcamera2009-11-07-19.04.51-150x150.jpg" class="attachment-thumbnail" alt="sdcarddcimcamera2009-11-07 19.04.51" title="sdcarddcimcamera2009-11-07 19.04.51" /></a>
<a href='http://blog.grimsy.net/2009/11/12/more-fishtank-photos/sdcarddcimcamera2009-11-08-18-26-39/' title='sdcarddcimcamera2009-11-08 18.26.39'><img width="150" height="150" src="http://blog.grimsy.net/wp-content/uploads/2009/11/sdcarddcimcamera2009-11-08-18.26.39-150x150.jpg" class="attachment-thumbnail" alt="sdcarddcimcamera2009-11-08 18.26.39" title="sdcarddcimcamera2009-11-08 18.26.39" /></a>

]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2009/11/12/more-fishtank-photos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A few svn pre-commit hooks</title>
		<link>http://blog.grimsy.net/2008/07/03/a-few-svn-pre-commit-hooks/</link>
		<comments>http://blog.grimsy.net/2008/07/03/a-few-svn-pre-commit-hooks/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 01:34:00 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://grimsy.net/?p=22</guid>
		<description><![CDATA[I&#8217;ve recently been looking around for some pre-commit hooks for our subversion repositories. I figured that since I have them all up and running now, I might as well share them. I can&#8217;t remember where I got all of these from, so if it&#8217;s one of yours, then I apologise. Feel free to contact me [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been looking around for some pre-commit hooks for our subversion repositories. I figured that since I have them all up and running now, I might as well share them.<br />
I can&#8217;t remember where I got all of these from, so if it&#8217;s one of yours, then I apologise. Feel free to contact me and I&#8217;ll give you credit for it.</p>
<p><span style="font-weight:bold;">Check for blank/empty commit messages and reject</span><br />
This goes in hooks/pre-commit</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">REPOS</span>=<span style="color: #ff0000;">&quot;$1&quot;</span><br />
<span style="color: #007800;">TXN</span>=<span style="color: #ff0000;">&quot;$2&quot;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Make sure that the log message contains some text.</span><br />
<span style="color: #007800;">SVNLOOK</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svnlook</span><br />
<span style="color: #007800;">SVNLOOKOK</span>=<span style="color: #000000;">1</span><br />
<span style="color: #007800;">$SVNLOOK</span> log <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TXN</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$REPOS</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> \<br />
<span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;[a-zA-Z0-9]&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">SVNLOOKOK</span>=<span style="color: #000000;">0</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$SVNLOOKOK</span> = <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> Empty log messages are not allowed. Please provide a proper log message. <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">2</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></div></div>
<p><span style="font-weight:bold;">Check that the commit message has a reference to a JIRA issue</span><br />
This goes in hooks/pre-commit, it also uses &#8216;check_log_message.sh&#8217; which can be found down further.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">REPOS</span>=<span style="color: #ff0000;">&quot;$1&quot;</span><br />
<span style="color: #007800;">TXN</span>=<span style="color: #ff0000;">&quot;$2&quot;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Check log message for proper task/bug identification</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-x</span> <span style="color: #800000;">${REPOS}</span><span style="color: #000000; font-weight: bold;">/</span>hooks<span style="color: #000000; font-weight: bold;">/</span>check_log_message.sh <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #800000;">${REPOS}</span><span style="color: #000000; font-weight: bold;">/</span>hooks<span style="color: #000000; font-weight: bold;">/</span>check_log_message.sh <span style="color: #ff0000;">&quot;<span style="color: #007800;">${REPOS}</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${TXN}</span>&quot;</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></div></div>
<p><span style="font-style:italic;">check_log_message.sh</span></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<br />
<span style="color: #007800;">REPOS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${1}</span>&quot;</span><br />
<span style="color: #007800;">TXN</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${2}</span>&quot;</span><br />
<br />
<span style="color: #007800;">SVNLOOK</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svnlook</span><br />
<br />
<span style="color: #007800;">LOG_MSG_LINE1</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #800000;">${SVNLOOK}</span> log <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${TXN}</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${REPOS}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> -n1<span style="color: #000000; font-weight: bold;">`</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${LOG_MSG_LINE1}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #ff0000;">'^[a-zA-Z]+[-][1-9][0-9]*[:]?[\s]*.*$'</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null;<span style="color: #7a0874; font-weight: bold;">&#41;</span> \<br />
<span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${LOG_MSG_LINE1}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #ff0000;">'^[nN][oO][jJ][iI][rR][aA][:]?[\s]*.*$'</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null;<span style="color: #7a0874; font-weight: bold;">&#41;</span> \<br />
<span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${LOG_MSG_LINE1}</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #ff0000;">'^\[maven-release-plugin\][\s]*.*$'</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null;<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span><br />
<span style="color: #000000; font-weight: bold;">else</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Your log message does not contain a JIRA Issue identifier (or bad format used)&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;The JIRA Issue identifier must be the first item on the first line of the log message.&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Proper JIRA format: &nbsp;'AAA-000'&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;JIRA regex: '^[a-zA-Z]+[-][1-9][0-9]*[:]?[\s]*.*$'&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
<span style="color: #000000; font-weight: bold;">fi</span></div></div>
<p><span style="font-weight:bold;">Check that commit message is more than 5 characters long</span><br />
This goes in hooks/pre-commit</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">REPOS</span>=<span style="color: #ff0000;">&quot;$1&quot;</span><br />
<span style="color: #007800;">TXN</span>=<span style="color: #ff0000;">&quot;$2&quot;</span><br />
<br />
<span style="color: #007800;">SVNLOOK</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svnlook</span><br />
<span style="color: #007800;">LOGMSG</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$SVNLOOK</span> log <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TXN</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$REPOS</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">wc</span> -c<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$LOGMSG</span>&quot;</span> <span style="color: #660033;">-lt</span> <span style="color: #000000;">5</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;Please provide a meaningful comment when committing changes.&quot;</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000;">2</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2008/07/03/a-few-svn-pre-commit-hooks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Follow up to SPA942 Personal Directory with LDAP</title>
		<link>http://blog.grimsy.net/2007/11/06/follow-up-to-spa942-personal-directory-with-ldap/</link>
		<comments>http://blog.grimsy.net/2007/11/06/follow-up-to-spa942-personal-directory-with-ldap/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 22:06:00 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[SPA942]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://grimsy.net/?p=19</guid>
		<description><![CDATA[I just wanted to follow up on my previous post about using LDAP and PHP to push the directories on the SPA942. I&#8217;ve included a whole lot of code below, and please note that a lot of this is me just getting the job done. The code is probably messy and poorly written, and some [...]]]></description>
			<content:encoded><![CDATA[<p>I just wanted to follow up on my previous post about using LDAP and PHP to push the directories on the SPA942.<br />
I&#8217;ve included a whole lot of code below, and please note that a lot of this is me just getting the job done. The code is probably messy and poorly written, and some of it is taken from other sites/samples.<br />
Unfortunately, blogger seems to take away all my nice formatting (indents etc&#8230;), so you&#8217;ll have to bear with me. Also, long comments appear across multiple lines in here, so that could make it even harder. Copy the code into a program like <a href="http://notepad-plus.sourceforge.net/uk/site.htm">notepad++</a> and set language to php to make it easier to read.</p>
<p>Firstly, just need to include a few files etc&#8230;</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/error_reporting"><span style="color: #990000;">error_reporting</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ERROR</span> <span style="color: #339933;">|</span> <span style="color: #009900; font-weight: bold;">E_WARNING</span> <span style="color: #339933;">|</span> <span style="color: #009900; font-weight: bold;">E_PARSE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/set_time_limit"><span style="color: #990000;">set_time_limit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">240</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;common/dbConnection.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;common/header.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;common/ldapInfo.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;voip_ext.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><span style="font-weight:bold;">dbConnection.php</span> connects to a Mysql DB that I use basically as an asset register. It contains IPs, allocations, extensions, invoice numbers yada yada yada. Originally, I drove this script entirely from LDAP, however once users started to have multiple extensions (depending on which site they were working from), LDAP (well Active Directory actually) just couldn&#8217;t cut it. Note that this still uses LDAP for getting user details (display name) and extensions. It cross references these with Mysql.<br />
<span style="font-weight:bold;">header.php</span> is just some menu&#8217;s etc<br />
<span style="font-weight:bold;">ldapInfo.php</span> is the connection to LDAP. It returns the info as $info<br />
<span style="font-weight:bold;">voip_ext.php</span> is a list of extensions returned as $extensions. Note that the extensions have changed with firmware updates, so check your phone to see what yours are.<br />
The rest of the code follows.<br />
I&#8217;ve tried my best to include comments, and please remember this is not a complete solution (due to DB dependencies etc&#8230;) but will hopefully get you started.<br />
If anyone is interested in the DB schema, leave a comment and I can post it here.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$pDir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//MAIN</span><br />
<br />
<span style="color: #666666; font-style: italic;">//get users extensions</span><br />
<span style="color: #000088;">$UserExtensions</span> <span style="color: #339933;">=</span> getExtensions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//100 slots to use. fill from bottom, so 99 -&amp;gt; 0</span><br />
<span style="color: #000088;">$extID</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">99</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//for each extension, find the appropriate info</span><br />
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$UserExtensions</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ext</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$ext</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$pDir</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">.</span>dirEntry<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #339933;">,</span><span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//tidy up and sort the pdir string</span><br />
<span style="color: #000088;">$pDir</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pDir</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$pDir</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$pDir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/sort"><span style="color: #990000;">sort</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pDir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//assign an extid to each entry</span><br />
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$pDir</span> <span style="color: #b1b100;">as</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span><span style="color: #000088;">$entry</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$entry</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$extensions</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$extID</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;=n%3D&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$entry</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$extID</span><span style="color: #339933;">--;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//more tidying of pdir</span><br />
<span style="color: #000088;">$pDir</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/implode"><span style="color: #990000;">implode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$pDir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$pDir</span> <span style="color: #339933;">.=</span> getGroups<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$pDir</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;%20&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$pDir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//need to fill in from extID to 0 to clean vacant entries from pdir</span><br />
<span style="color: #666666; font-style: italic;">//note that this will wipe out any duplicate names (was occuring when users were leaving)</span><br />
<span style="color: #666666; font-style: italic;">//this will also wipe out any personal entries (i.e. this script is the only way that entries will appear in the directory)</span><br />
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$extID</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$pDir</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$extensions</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$extID</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;=;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$extID</span><span style="color: #339933;">--;</span><br />
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$extID</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;lt;br /&amp;gt;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$pDir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;lt;br /&amp;gt;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//run the wget (comment this out to test sending to a single phone - use next bit instead)</span><br />
<span style="color: #000088;">$phoneIPs</span> <span style="color: #339933;">=</span> GetPhoneIPs<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$phoneIPs</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$phoneIP</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
updatePhonePDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$phoneIP</span><span style="color: #339933;">,</span><span style="color: #000088;">$pDir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//uncomment for testing</span><br />
<span style="color: #666666; font-style: italic;">//updatePhonePDir(&quot;192.168.10.170&quot;,$pDir);</span><br />
<br />
<span style="color: #666666; font-style: italic;">//FUNCTIONS</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> getExtensions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//this gets all the phone extensions that i've allocated in mysql. Note that other extensions probably exist in ldap, but they're not assigned to a phone and hence we don't want them here.</span><br />
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;select allocation.extension from allocation order by allocation.extension asc&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_fetch_assoc"><span style="color: #990000;">mysql_fetch_assoc</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$extensions</span> <span style="color: #339933;">.=</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;extension&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<a href="http://www.php.net/mysql_free_result"><span style="color: #990000;">mysql_free_result</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$extensions</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$extensions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$extensions</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> GetPhoneIPs<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//this gets the ips of the phones. need this when performing the wget command</span><br />
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;select distinct phone_ip from asset where phone_ip not like ''&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_fetch_assoc"><span style="color: #990000;">mysql_fetch_assoc</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$phoneIPs</span> <span style="color: #339933;">.=</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;phone_ip&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<a href="http://www.php.net/mysql_free_result"><span style="color: #990000;">mysql_free_result</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$phoneIPs</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$phoneIPs</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$phoneIPs</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> dirEntry<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #339933;">,</span><span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//this is creating the sting that we eventually want to POST to the phone's pdir</span><br />
<span style="color: #000088;">$allocationDetails</span> <span style="color: #339933;">=</span> getAllocationDetails<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$phoneMAC</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$allocationDetails</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$phoneIP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$allocationDetails</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$siteName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$allocationDetails</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$serverIP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$allocationDetails</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$userDetails</span> <span style="color: #339933;">=</span> ldapUserDetails<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #339933;">,</span><span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$userSamAccountName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$userDetails</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$userDisplayName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$userDetails</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$userComany</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$userDetails</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> getRingTone<span style="color: #009900;">&#40;</span><span style="color: #000088;">$phoneIP</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$userDisplayName</span>;p%3D<span style="color: #006699; font-weight: bold;">$ext</span>;r%3D<span style="color: #006699; font-weight: bold;">$ringtone</span>&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">//return &quot;n%3D$userDisplayName;p%3D$ext;r%3D$ringtone&quot;;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> ldapUserDetails<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #339933;">,</span><span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//this matches the extensions with the names from ldap (we don't keep names in mysql)</span><br />
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;count&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;ipphone&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$samaccountname</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strtolower"><span style="color: #990000;">strtolower</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;samaccountname&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$displayName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;displayname&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$company</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;company&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$company</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$company</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;GLiNTECH&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//catch accounts with no company name specified</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000088;">$results</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$samaccountname</span><span style="color: #339933;">,</span><span style="color: #000088;">$displayName</span><span style="color: #339933;">,</span><span style="color: #000088;">$company</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$results</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> getAllocationDetails<span style="color: #009900;">&#40;</span><span style="color: #000088;">$extension</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">// this gets more info about the phone (we use multiple sites and servers)</span><br />
<span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;select asset.mac, allocation.extension, server.server_ip, asset.phone_ip, site.site_name<br />
from allocation<br />
join asset as asset on allocation.asset_id = asset.asset_id<br />
join site as site on allocation.site_id = site.site_id<br />
join server as server on site.site_id = server.site_id<br />
where allocation.extension = '&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$extension</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' limit 1&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$thisPhoneMac</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;0000000000&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$thisPhoneIP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;0.0.0.0&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$thisSiteName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;NULL&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$thisServerIP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;0.0.0.0&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_num_rows"><span style="color: #990000;">mysql_num_rows</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$thisPhoneMac</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;0000000000&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$thisPhoneIP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;0.0.0.0&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$thisSiteName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;NULL&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$thisServerIP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;0.0.0.0&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// While a row of data exists, put that row in $row as an associative array</span><br />
<span style="color: #666666; font-style: italic;">// Note: If you're expecting just one row, no need to use a loop</span><br />
<span style="color: #666666; font-style: italic;">// Note: If you put extract($row); inside the following loop, you'll</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp; &nbsp; then create $userid, $fullname, and $userstatus</span><br />
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_fetch_assoc"><span style="color: #990000;">mysql_fetch_assoc</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$thisPhoneMac</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;mac&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$thisPhoneIP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;phone_ip&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$thisSiteName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;site_name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$thisServerIP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;server_ip&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<a href="http://www.php.net/mysql_free_result"><span style="color: #990000;">mysql_free_result</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000088;">$results</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisPhoneMac</span><span style="color: #339933;">,</span><span style="color: #000088;">$thisPhoneIP</span><span style="color: #339933;">,</span><span style="color: #000088;">$thisSiteName</span><span style="color: #339933;">,</span><span style="color: #000088;">$thisServerIP</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$results</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> getRingTone<span style="color: #009900;">&#40;</span><span style="color: #000088;">$phoneIP</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//this checks to see if a user as set a custom ringtone.</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$xmlstr</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://<span style="color: #006699; font-weight: bold;">$phoneIP</span>/admin/spacfg.xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xmlstr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleXMLElement<span style="color: #009900;">&#40;</span><span style="color: #000088;">$xmlstr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xml</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>Default_Ring_1_<span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ringtone</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;User 1&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;11&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ringtone</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;User 2&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;12&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//default ringtone for people in the directory</span><br />
<span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;12&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$ringtone</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> updatePhonePDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$phoneIP</span><span style="color: #339933;">,</span><span style="color: #000088;">$pDir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//this generates the wget command. -t 1 means it will only try once. if it fails then it won't try again until the next day.</span><br />
<span style="color: #000088;">$command</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;wget --post-data '&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$pDir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$phoneIP</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/pdir.spa -t 1&quot;</span><span style="color: #339933;">;</span><br />
runCommand<span style="color: #009900;">&#40;</span><span style="color: #000088;">$command</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// or die(&quot;update to $phoneIP failed&quot;);</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> runCommand<span style="color: #009900;">&#40;</span><span style="color: #000088;">$command</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//calls the command and writes some debugging to the screen</span><br />
<a href="http://www.php.net/system"><span style="color: #990000;">system</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$command</span><span style="color: #339933;">,</span><span style="color: #000088;">$returned</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$command</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;lt;br /&amp;gt;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$returned</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$returned</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> getGroups<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//this is used for getting groups in ldap and finding their exts etc... read up in a previous post for more on this. Note that groups are prepended with '*' to make them appear at the top of the directory</span><br />
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$extID</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$extensions</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;count&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/ereg"><span style="color: #990000;">ereg</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[[6][0-9]{3}]&quot;</span><span style="color: #339933;">,</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;info&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">//calling groups</span><br />
<span style="color: #000088;">$extensionstring</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$extensions</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$extID</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;=n%3D*&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/strtoupper"><span style="color: #990000;">strtoupper</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;%20&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$extensionstring</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;p%3D&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;info&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;r%3D11&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$extID</span><span style="color: #339933;">--;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$extensionstring</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2007/11/06/follow-up-to-spa942-personal-directory-with-ldap/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SPA942 and Daylight Saving</title>
		<link>http://blog.grimsy.net/2007/10/29/spa942-and-daylight-saving/</link>
		<comments>http://blog.grimsy.net/2007/10/29/spa942-and-daylight-saving/#comments</comments>
		<pubDate>Sun, 28 Oct 2007 23:39:00 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[SPA942]]></category>

		<guid isPermaLink="false">http://grimsy.net/?p=17</guid>
		<description><![CDATA[Well daylight savings just hit for the first time since we&#8217;ve had the SPA942s and needless to say I overlooked that parameter when setting them up. Unfortunately it wasn&#8217;t as simple as ticking a box or setting a parameter to 1 or 0 which I was kind of hoping it would be, instead you need [...]]]></description>
			<content:encoded><![CDATA[<p>Well daylight savings just hit for the first time since we&#8217;ve had the SPA942s and needless to say I overlooked that parameter when setting them up.<br />
Unfortunately it wasn&#8217;t as simple as ticking a box or setting a parameter to 1 or 0 which I was kind of hoping it would be, instead you need to have a &#8216;Daylight Saving Time Rule&#8217; which I guess is fair enough as different states and countries treat it differently.<br />
Also unfortunate was Linksys&#8217; decision to not allow daylight savings rules to span more than one calendar year. Luckily some people on the <a href="http://forums.linksys.com/linksys/board/message?board.id=VoIP_Phones&amp;message.id=695&amp;query.id=293926#M695">Linksys boards</a> were able to provide me with the work around I needed.</p>
<p>Basically you need to set Time_Zone to GMT+11:00 even though it should be GMT+10:00 and then subtract hours rather than adding them.<br />
End result looks something like:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;time_Zone</span> <span style="color: #000066;">group</span>=<span style="color: #ff0000;">&quot;Regional/Miscellaneous&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
GMT+11:00<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/time_Zone<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;daylight_Saving_Time_Rule</span> <span style="color: #000066;">group</span>=<span style="color: #ff0000;">&quot;Regional/Miscellaneous&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
start=3/-1/7;end=10/-1/7;save=-1<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/daylight_Saving_Time_Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2007/10/29/spa942-and-daylight-saving/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>More SPA942 Firmware stuff</title>
		<link>http://blog.grimsy.net/2007/10/11/more-spa942-firmware-stuff/</link>
		<comments>http://blog.grimsy.net/2007/10/11/more-spa942-firmware-stuff/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 01:48:00 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[SPA942]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://grimsy.net/?p=16</guid>
		<description><![CDATA[Well I&#8217;m trailing out the 5.15a firmware for the SPA942 phones. Firstly, I have figured out the problem I was having previously with the first line being one pixel out of alignment. For our users, we display $EXT &#8211; Line # on each of the lines, so for me it appears as: &#60;br /&#62;6004 - [...]]]></description>
			<content:encoded><![CDATA[<p>Well I&#8217;m trailing out the 5.15a firmware for the SPA942 phones. Firstly, I have figured out the problem I was having previously with the first line being one pixel out of alignment. For our users, we display $EXT &#8211; Line # on each of the lines, so for me it appears as:</p>
<div class="codecolorer-container text default prettyprint" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;br /&gt;6004 - Line 1&lt;br /&gt;6004 - Line 2&lt;br /&gt;6004 - Line 3&lt;br /&gt;6004 - Line 4&lt;br /&gt;</div></div>
<p>In the previous (5.1.5) firmware, this was left aligned, where as the newer firmwares are right aligned. Because the number 1 is thinner than the numbers 2,3 and 4, the text looked out of line. Other people probably wouldn&#8217;t have this issue, because adding in the Line numbers was a custom change I made for my users (in response to too many questions about why there where 4 buttons).</p>
<p>The other issue I was having with </p>
<div class="codecolorer-container text default prettyprint" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;br /&gt;&lt;2nd_preferred_codec_1_ group=&quot;Ext_1/Audio_Configuration&quot;&gt;&lt;br /&gt;</div></div>
<p>has been changed to </p>
<div class="codecolorer-container text default prettyprint" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;br /&gt;&amp;lt;Second_Preferred_Codec_1_ group=&quot;Ext_1/Audio_Configuration&quot;&gt;&lt;br /&gt;</div></div>
<p>There&#8217;s also a new feature that allows you to set a background image that I&#8217;m hoping to play around with shortly &#8211; more info about that on <a href="http://www.voip-info.org/wiki/index.php?page=SPA-941#BackgroundImage">voip-info</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2007/10/11/more-spa942-firmware-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems with latest SPA942 Firmware (5.1.10)</title>
		<link>http://blog.grimsy.net/2007/06/29/problems-with-latest-spa942-firmware-5-1-10/</link>
		<comments>http://blog.grimsy.net/2007/06/29/problems-with-latest-spa942-firmware-5-1-10/#comments</comments>
		<pubDate>Fri, 29 Jun 2007 02:39:00 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[SPA942]]></category>

		<guid isPermaLink="false">http://grimsy.net/?p=15</guid>
		<description><![CDATA[I&#8217;ve noticed that the spacfg.xml seems to be malformed and it&#8217;s causing my scripts to break :&#8217;( It seems that Linksys have added &#60;2nd_preferred_codec_1_ group=&#34;Ext_1/Audio_Configuration&#34;&#62; which presumably due to the fact that it starts with the number 2 is breaking it I&#8217;ve posted over on the Linksys boards and hopefully someone will be able to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve noticed that the spacfg.xml seems to be malformed and it&#8217;s causing  my scripts to break :&#8217;(<br />
It seems that Linksys have added</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;2nd_preferred_codec_1_ <span style="color: #000066;">group</span>=<span style="color: #ff0000;">&quot;Ext_1/Audio_Configuration&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></div>
<p>which presumably due to the fact that it starts with the number 2 is breaking it <img src='http://blog.grimsy.net/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
I&#8217;ve posted over on the <a href="http://forums.linksys.com/linksys/board/message?board.id=VoIP_Phones&amp;thread.id=1492">Linksys boards</a> and hopefully someone will be able to shed some light on it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2007/06/29/problems-with-latest-spa942-firmware-5-1-10/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SPA942 Personal Directory with LDAP</title>
		<link>http://blog.grimsy.net/2007/06/27/spa942-personal-directory-with-ldap/</link>
		<comments>http://blog.grimsy.net/2007/06/27/spa942-personal-directory-with-ldap/#comments</comments>
		<pubDate>Tue, 26 Jun 2007 23:03:00 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[GLiNTECH]]></category>
		<category><![CDATA[SPA942]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://grimsy.net/?p=14</guid>
		<description><![CDATA[A while ago, I posted a blog about the SPA942 Personal Directory. Well I&#8217;ve built on it a bit now and managed to get it populated from the information taken out of our LDAP server (Microsoft Active Directory). When we allocate a phone to someone, we fill in the ipphone field with their extension. We [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago, I posted a blog about the SPA942 Personal Directory. Well I&#8217;ve built on it a bit now and managed to get it populated from the information taken out of our LDAP server (Microsoft Active Directory).</p>
<p>When we allocate a phone to someone, we fill in the ipphone field with their extension. We then also add two other ipphone entries, the first being the MAC address of the phone, the second being the phone&#8217;s IP.</p>
<p>I&#8217;m also managing calling groups (queues) in LDAP by creating security groups and using the Notes field to enter the information that I then use to build Asterisk&#8217;s queues.conf file (I might post more on that later if people are interested). An example of one of these entries for the groups is:</p>
<div class="codecolorer-container ini default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ini codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>6000<span style="">&#93;</span></span><br />
<span style="color: #000099;">fullname</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> <span style="">&#123;</span>groupname<span style="">&#125;</span></span><br />
<span style="color: #000099;">strategy</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> ringall</span><br />
<span style="color: #000099;">timeout</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 15</span><br />
<span style="color: #000099;">wrapuptime</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span><br />
<span style="color: #000099;">autofill</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span><br />
<span style="color: #000099;">autopause</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> no</span><br />
<span style="color: #000099;">maxlen</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span><br />
<span style="color: #000099;">joinempty</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span><br />
<span style="color: #000099;">leavewhenempty</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span><br />
<span style="color: #000099;">reportholdtime</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span><br />
<span style="color: #000099;">musicclass</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> default</span></div></div>
<p>From this information in LDAP, I have a PHP script that is run as a cron job each night to update the phones with the new Personal Directory.</p>
<p>I&#8217;ll post the PHP as one big chunk, and explain it a bit further below.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
&nbsp; &nbsp; <a href="http://www.php.net/set_time_limit"><span style="color: #990000;">set_time_limit</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">300</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Include a list of all the extensions - this is page that lists the id's for the pdir. $extensions=array('25454','25390','25582', etc...</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'voip_ext.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//Doing LDAP connection stuff</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$ldap_host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ldapserver&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$base_dn</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;DC=domain,DC=com&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$filter</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;(|(ipphone=*)(info=[*))&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$ldap_user</span> &nbsp;<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CN=Admin User,CN=Users,DC=domain,DC=com&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$ldap_pass</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;fullysecretpassword&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$connect</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/ldap_connect"><span style="color: #990000;">ldap_connect</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ldap_host</span><span style="color: #339933;">,</span><span style="color: #000088;">$ldap_port</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; or <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&gt;Could not connect to LDAP server&lt;&lt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/ldap_set_option"><span style="color: #990000;">ldap_set_option</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connect</span><span style="color: #339933;">,</span> LDAP_OPT_PROTOCOL_VERSION<span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/ldap_set_option"><span style="color: #990000;">ldap_set_option</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connect</span><span style="color: #339933;">,</span> LDAP_OPT_REFERRALS<span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$bind</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/ldap_bind"><span style="color: #990000;">ldap_bind</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connect</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ldap_user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ldap_pass</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; or <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&gt;Could not bind to <span style="color: #006699; font-weight: bold;">$ldap_host</span>&lt;&lt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$read</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/ldap_search"><span style="color: #990000;">ldap_search</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connect</span><span style="color: #339933;">,</span> <span style="color: #000088;">$base_dn</span><span style="color: #339933;">,</span> <span style="color: #000088;">$filter</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; or <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;&gt;Unable to search ldap server&lt;&lt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$info</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/ldap_get_entries"><span style="color: #990000;">ldap_get_entries</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connect</span><span style="color: #339933;">,</span> <span style="color: #000088;">$read</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//start doing things</span><br />
&nbsp; &nbsp; ldapPhoneIPs<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//close the ldap connection</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/ldap_close"><span style="color: #990000;">ldap_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$connect</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//FUNCTIONS</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> ldapPhoneIPs<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$pDir</span> <span style="color: #339933;">=</span> ldapUsers<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;count&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;otheripphone&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;&gt;</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;samaccountname&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$phoneIP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;otheripphone&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$phoneMAC</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;otheripphone&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> getRingTone<span style="color: #009900;">&#40;</span><span style="color: #000088;">$phoneIP</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$pDir2</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;r%3D0&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$ringtone</span><span style="color: #339933;">,</span><span style="color: #000088;">$pDir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updatePhonePDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$phoneIP</span><span style="color: #339933;">,</span><span style="color: #000088;">$pDir2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//This just makes sure we don't overwrite somone's customised ringtone</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getRingTone<span style="color: #009900;">&#40;</span><span style="color: #000088;">$phoneIP</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$xmlstr</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://<span style="color: #006699; font-weight: bold;">$phoneIP</span>/admin/spacfg.xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xmlstr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleXMLElement<span style="color: #009900;">&#40;</span><span style="color: #000088;">$xmlstr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Default_Ring_1_</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ringtone</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;User 1&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;11&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ringtone</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;User 2&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ringtone</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;12&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;r%3D&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$ringtone</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> updatePhonePDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$phoneIP</span><span style="color: #339933;">,</span><span style="color: #000088;">$pDir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$command</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;wget --post-data '&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$pDir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' http://&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$phoneIP</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/pdir.spa&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; runCommand<span style="color: #009900;">&#40;</span><span style="color: #000088;">$command</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// or die(&quot;update to $phoneIP failed&quot;);</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> ldapUsers<span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//get the list of users</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$extensions</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$extID</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">99</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;count&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;ipphone&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;&gt;</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//individual users</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;otheripphone&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;&gt;</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$extensionstring</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$extensions</span>[<span style="color: #006699; font-weight: bold;">$extID</span>]=n%3D&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;%20&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;displayname&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$extensionstring</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;p%3D&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;ipphone&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;r%3D0&amp;amp;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$extID</span><span style="color: #339933;">--;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/ereg"><span style="color: #990000;">ereg</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[[6][0-9]{3}]&quot;</span><span style="color: #339933;">,</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;info&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//calling groups</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;info&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$extensionstring</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$extensions</span>[<span style="color: #006699; font-weight: bold;">$extID</span>]=n%3D&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/strtoupper"><span style="color: #990000;">strtoupper</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;%20&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$extensionstring</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;p%3D&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;info&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;r%3D0&amp;amp;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$extID</span><span style="color: #339933;">--;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$extensionstring</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$extensionstring</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$extensionstring</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$extensionstring</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> runCommand<span style="color: #009900;">&#40;</span><span style="color: #000088;">$command</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/system"><span style="color: #990000;">system</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$command</span><span style="color: #339933;">,</span><span style="color: #000088;">$returned</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$command</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$returned</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Ok, so firstly we include another file. There&#8217;s nothing flash about this file, in fact all it contains is a list of all the id&#8217;s in the Personal Directory page</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000088;">$extensions</span><span style="color: #339933;">=</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'25454'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'25390'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'25582'</span><span style="color: #339933;">,</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Next it&#8217;s a matter of setting up the LDAP connection and filters. I&#8217;m filtering for either an entry in the ipphone field (for individual users) OR the notes(info) field (for the groups).<br />
Then we get into actually doing things.<br />
The first bit parses the info from LDAP and extracts the fields I care about. I&#8217;ve added in filtering for custom ringtones, so that if someone has set a custom ringtone for a particular entry, it doesn&#8217;t get overwritten.<br />
From there, we go through and construct the wget strings (see my previous post for an explanation on this). It puts regular users in CamelCase and groups in UPPERCASE so that users can distinguish the difference.<br />
Once all that is done, we run the wget command and push out the updates.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2007/06/27/spa942-personal-directory-with-ldap/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iubi Blue firmware update. v1.202beta</title>
		<link>http://blog.grimsy.net/2007/02/24/iubi-blue-firmware-update-v1-202beta/</link>
		<comments>http://blog.grimsy.net/2007/02/24/iubi-blue-firmware-update-v1-202beta/#comments</comments>
		<pubDate>Sat, 24 Feb 2007 05:09:00 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iubi]]></category>

		<guid isPermaLink="false">http://grimsy.net/?p=13</guid>
		<description><![CDATA[There&#8217;s a new version of iubi Blue firmware over at Advanced MP3 Players.There&#8217;s also an extra file here that you need to download (right click &#8211; save as) and add to the system folder after the unit restarts post update.Apparently the update is to &#8230; fix issues relating to picture aligment when recording, and when [...]]]></description>
			<content:encoded><![CDATA[<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_ysZmeK4VmKk/Rd_Kkba49yI/AAAAAAAAAAc/7ZAuUxRgvWw/s1600-h/IUBIBLUEsmall2.jpg"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_ysZmeK4VmKk/Rd_Kkba49yI/AAAAAAAAAAc/7ZAuUxRgvWw/s200/IUBIBLUEsmall2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5034965635608147746" /></a><br />There&#8217;s a new version of iubi Blue firmware over at <a href="http://www.advancedmp3players.co.uk/forum/index.php?showtopic=7300">Advanced MP3 Players</a>.<br />There&#8217;s also an extra file <a href="http://www.amp3info.co.uk/Download/sn_re.aeg">here</a> that you need to download (right click &#8211; save as) and add to the <span style="font-weight: bold;">system </span>folder after the unit restarts post update.<br />Apparently the update is to<br />
<blockquote>&#8230; fix issues relating to picture aligment when recording, and when playing back recorded video.</p></blockquote>
<p>which I haven&#8217;t ever actually bothered doing with my iubi yet, but it also seems to have updated the icons (speaker, volume and battery) in the top right corner of the screen too.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2007/02/24/iubi-blue-firmware-update-v1-202beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPA942 Personal Directory</title>
		<link>http://blog.grimsy.net/2007/02/23/spa942-personal-directory/</link>
		<comments>http://blog.grimsy.net/2007/02/23/spa942-personal-directory/#comments</comments>
		<pubDate>Fri, 23 Feb 2007 03:52:00 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[GLiNTECH]]></category>
		<category><![CDATA[SPA942]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://grimsy.net/?p=12</guid>
		<description><![CDATA[I&#8217;ve been setting up Asterisk at work recently, as our old PABX has reached it&#8217;s limits. We picked up half a dozen SPA942&#8242;s for some initial testing. I have to say that while the phones are nice as an end user, however some of the administration functions seem to come up a bit short. One [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been setting up Asterisk at work recently, as our old PABX has reached it&#8217;s limits.<br />
We picked up half a dozen <a href="http://www.voip-info.org/wiki/index.php?page_id=2634">SPA942&#8242;s</a> for some initial testing.<br />
I have to say that while the phones are nice as an end user, however some of the administration functions seem to come up a bit short.<br />
One of the big issues for us was that the personal directory on the phones doesn&#8217;t actually have to option to be populated from Asterisk (or any other PBX other than SPA9000). I have to admit though, I&#8217;m not really one to accept that something can&#8217;t be done.<br />
After trying a number of things, I upgraded to the latest firmware (<a href="http://www.linksys.com/servlet/Satellite?c=L_Download_C2&amp;childpagename=US%2FLayout&amp;cid=1115417109974&amp;packedargs=sku%3D1138743806996&amp;pagename=Linksys%2FCommon%2FVisitorWrapper">5.1.5</a> at time of writing) and after some more stuffing around, I was finally able to get the following line to populate the Personal Directory:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">--post-data</span> <span style="color: #ff0000;">'24686=n%3DGeoff;p%3D6004;r%3D1&amp;amp;25390=n%3DMatt;p%3D6001;r%3D1'</span> http:<span style="color: #000000; font-weight: bold;">//</span>myphoneIP<span style="color: #000000; font-weight: bold;">/</span>pdir.spa</div></div>
<p>A few things about the command.<br />
Firstly, the command will enter in two contacts in the Directory. These will be under entry #5 (24686) and entry #2 (25390). A complete list of all the codes here can be seen in the source of the Personal Directory page in the phone&#8217;s web interface.<br />
So taking the first of the two entries (24686), what we&#8217;re posting is:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">n<span style="color: #000000; font-weight: bold;">%</span>3DGeoff;</div></div>
<p>n=Geoff; (we need to escape the &#8216;=&#8217; signs so that wget will actually pass the info on correctly)<br />
n is the Display Name that will appear in the Directory</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">p<span style="color: #000000; font-weight: bold;">%</span>3D6004;</div></div>
<p>p=6004;<br />
p is the extension number (or phone number). My extension is 6004.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">r<span style="color: #000000; font-weight: bold;">%</span>3D1</div></div>
<p>r=1<br />
r is the ring to use. 0 is no sound, just flashing. Play around with the other numbers to find the ringtone you want to use.</p>
<p>To add more than one entry at a time, simply separate the strings with &#8216;&amp;&#8217;.</p>
<p>From here I&#8217;m going to look into LDAP integration, so that I can autorun the command, pulling the users and extensions out of Active Directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2007/02/23/spa942-personal-directory/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>iubi Blue firmware update. v1.20beta</title>
		<link>http://blog.grimsy.net/2006/12/27/iubi-blue-firmware-update-v1-20beta/</link>
		<comments>http://blog.grimsy.net/2006/12/27/iubi-blue-firmware-update-v1-20beta/#comments</comments>
		<pubDate>Tue, 26 Dec 2006 23:00:00 +0000</pubDate>
		<dc:creator>Geoff Jacobs</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iubi]]></category>

		<guid isPermaLink="false">http://grimsy.net/?p=11</guid>
		<description><![CDATA[Advanced MP3 Players have the latest English version of the iubi Blue firmware. Seems to have fixed some of the issues I was having. Definitely worth the download.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.advancedmp3players.co.uk/forum/index.php?showtopic=7057">Advanced MP3 Players</a> have the latest English version of the iubi Blue firmware. Seems to have fixed some of the issues I was having. Definitely worth the download.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.grimsy.net/2006/12/27/iubi-blue-firmware-update-v1-20beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
