×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

phone book appliction for ip phone

Unanswered Question

i have been working on a phone book type application for the cisco ip phones. idea is - website where a user goes to to add/edit/delete names & phone numbers. the site is written in php and stores data in a mysql database. then from the ip phone, configure a service that allows the phone user to pull up the phone book and dial entries in it. sorta recreating the speed-dial functionality of the callmanager i know but you gotta start somewhere.


so far i have the website part done - no problems there. on the phone end of things i have managed to get the xml browser on the phone to actually connect to the webserver (apache) and pull down a php page. the php does the database query and outputs xml to the phone. my problem is that only the last entry of database shows up. in a standard xml browser all the entries show up so im guessing its something to do with the phone.


just wondering if anyone might have any ideas on this. in case anyone is interested, here is the code i have so far


<?php

$database = "VoIP";

$user_database = "********";

$db_query = "name,phone_number";

mysql_connect("localhost","root","*********") or die ("Unable to connect to server");

mysql_select_db("$database") or die ("Unable to select database");

$sql = "SELECT $db_query FROM $user_database";

$sql_result = mysql_query($sql);

header("Content-Type: text/xml");

?>

<CiscoIPPhoneDirectory>

<Title>neXband Communications</Title>

<Prompt>Speed Dials</Prompt>

<DirectoryEntry>

<?php

if ($row = mysql_fetch_array($sql_result)) {

do {

printf("<Name>%s</Name><TelephoneNumber>%s</TelephoneNumber>",$row["0"],$row["1"]);

} while ($row = mysql_fetch_array($sql_result));

} else {

echo "<Text>No Records Found</Text>";

}

?>

</DirectoryEntry>

</CiscoIPPhoneDirectory>




if i manage to get this working, i will be more than happy to share it with anyone who wants it - including the php part for the webstuff.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Sascha Monteiro Thu, 04/03/2003 - 22:57
User Badges:
  • Silver, 250 points or more

try like this;

neXband Communications

Speed Dials

<?php

if ($row = mysql_fetch_array($sql_result)) {

do {

printf("%s%s ",$row["0"],$row["1"]);

} while ($row = mysql_fetch_array($sql_result));

} else {

echo "No Records Found";

}

?>


You see? You need a DirectoryEntry for every entry....


Hope this works for you,

regards,

Sascha


Anonymous (not verified) Fri, 04/16/2004 - 07:39
User Badges:

I'm writing a similar application and I think the problem is that you can only show 32 items...

So I ended up splitting the result in "pages" of 30 names each.

I also used CiscoIPPhoneMenu instead of CiscoIPPhoneDirectory to have more flexibility using softkeys.

I this can help I'll attach the example



Attachment: 
stephan.steiner Sun, 04/18/2004 - 23:14
User Badges:
  • Silver, 250 points or more

w.r.t. the first post: the reason you don't get all names (in fact I'm quite surprised that the phone can handle the XML since it doesn't conform to the specs for a CiscoIPPhoneDirectory tag) is because while you look through your resultset and print out each name and phone number, each name and phone number needs to be a . You only have one , but a lot of and entries.


And then, as fsarzana has mentioned, you have to limit the results to show 32 entries per page.

Actions

This Discussion