Site map  

Panasonic KX-HDV130 SIP Phone

Some of my experiences with the Panasonic KX-HDV130 SIP Phone.

The first thing to do is to get as much information about this phone as you can. Esp. the Administrator guide (PDF) is extremely helpful.
Next, set the IP address on the phone and then use the build-in webserver to configure the phone further. You may need to enable the webserver on the phone first.

Phonebook

The phone sorts names alphabetically. It put digits after letters, which may not be what you expect. So if a company has digits in their name, it might be convenient to replace these with text. E.G.: 'Two' instead of '2'.
The phone has a limited character repertoire. Depending on the model it supports Latin (with accents), Greek or Cyrillic. Obviously there is no point in putting glyphs in your phonebook which the phone can't display.

Phone numers

There is actually a convention for phone numbers;

National: Area code followed by subscribers number;
0123123456

International: Double zero, followed by country number, area code (usually without leading zero) and subscribers number;
0012123123456

This way, external numbers always begin with with zero.
This numbering scheme is supported by most VoIP providers (assuming of course that the trunk prefix is '0' and the international call prefix is '00').

Import phonebook

Phonebook contents

The phonebook file is an Little Endian (least significant byte first) UTF-16 tab delimited file with the following contents;
At the start of the file a Byte Order Mark (U+FEFF): 0xFF 0xFE.
And then per record;

So John Doe with telephone number 1234 and Mary Smith with telephone number 5678 are;

1<Tab>John Doe<Tab> <Tab>1234<Tab> <Tab> <Tab> <Tab> <Tab> <Cr><Lf>
2<Tab>Mary Smith<Tab> <Tab>5678<Tab> <Tab> <Tab> <Tab> <Tab> <Cr><Lf>

A hexdump of this file is;

00000000: fffe 3100 0900 4a00 6f00 6800 6e00 2000  ..1...J.o.h.n. .
00000010: 4400 6f00 6500 0900 0900 3100 3200 3300  D.o.e.....1.2.3.
00000020: 3400 0900 0900 0900 0900 0900 0d00 0a00  4...............
00000030: 3200 0900 4d00 6100 7200 7900 2000 5300  2...M.a.r.y. .S.
00000040: 6d00 6900 7400 6800 0900 0900 3500 3600  m.i.t.h.....5.6.
00000050: 3700 3800 0900 0900 0900 0900 0900 0d00  7.8.............
00000060: 0a00                                     ..

Note the little endian BOM (fffe) at the start of the file.
Also note that, due to the UTF-16 encoding, each character is (at least) two bytes. This includes tab (0900), Cr (0d00) and Lf (0a00). In case of glyps with Unicode code points > U+00FF the second byte will be non zero. E.G.: 'ac20' for euro sign (U+20AC).
In this example each person has only one number, so there are lots of empty fields (<Tab> <Tab> or 0900 0900).

Scripts

Just in case you need it, the script below extracts a phonebook from ~/.linphonerc. Output is stdout, so you need to redirect to a file;

extr-lin-pb.sh;

#!/bin/bash

export LC_ALL=C.UTF-8

grep -A4 "friend_" ~/.linphonerc | \
	grep url | \
	sed -e 's/url=\"//g' | \
	sed -e 's/" <sip:/\t/g' | \
	sed -E 's/@.+>//g' | \
	sort

The output is: Name<Tab>Number<Lf>.

The script below actually generates the phonebook for the KX-HDV130. It expects a input file called 'phonebook.txt'. Output is stdout, so you need to redirect to a file. Modify to suit your needs.
Note: You need iconv for this to work.

gen-phonebook.sh;

#!/bin/bash

LEN=0
RECID=1

if ! [ -f phonebook.txt ]
then
	echo "File phonebook.txt not found"
	exit 1
fi

# LE BOM: 0xFF 0xFE
# record ID (starts at 1)
# name
# reserved
# phone number 1
# phone number 2
# phone number 3
# phone number 4
# phone number 5
# reserved
# line break

printf "\xff\xfe"
# Set IFS to tab, newline
IFS=$'\t\n'
while read NAME NUMBER
do
	LEN=$( echo -n "${NAME}" | wc -c )
	if [ $LEN -gt 24 ]
	then
		echo "Line ${RECID} too long" 1>&2
		exit 1
	fi
	echo -e "${RECID}\t${NAME}\t\t${NUMBER}\t\t\t\t\t\r" | iconv -f UTF-8// -t UTF-16LE//
	let RECID+=1

done < "phonebook.txt"

# Restore IFS
IFS=$' \t\n'

Export phonebook

An export yields '~/Downloads/exportphonebook_hs1.tsv'. This is an UTF-8 file without a BOM.
The script below converts back to the original file format;

dump-phonebook.sh;

#!/bin/bash

# Set the locale
export LC_ALL=C.UTF-8

if ! [ -f exportphonebook_hs1.tsv ]
then
	echo "File exportphonebook_hs1.tsv not found"
	exit 1
fi

# Charset conversion, if any, goes here

dos2unix exportphonebook_hs1.tsv

# record ID (starts at 1)
# name
# reserved
# phone number 1
# phone number 2
# phone number 3
# phone number 4
# phone number 5
# reserved
# line break

> "phonebook.txt"

# Set IFS newline
IFS=$'\n'
while read LINE
do
	echo "${LINE}" | awk -F\\\t '{print $2 "\t" $4}' >> "phonebook.txt"

done < "exportphonebook_hs1.tsv"

# Restore IFS
IFS=$' \t\n'

sort -o phonebook.txt phonebook.txt

The sort order of the phone is not necessarily what you expect. Hence the sort.

More info

KX-HDV1xx series | Download | SIP Phone | Support | Panasonic Global