How I got the Uniden UIP1868P (packet8 version) working with Asterisk (trixbox)
The UIP1868P is locked into using the packet8 service , but using a few tips from others (on various other posts) I was able to piece it all together. It was tricky. It required a small code change to Asterisk (trixbox). I created a patch file that may be used for future trixbox releases if they choose to use it.
The reason I like the UIP1868 is the fact that it acts like a base unit for multiple types of Uniden cordless phones. I also recently purchased a set of 4 remotes that I didn't want to waste. In addition, I recently acquired a *FREE* UIP1868P which motivated me [grin]. Additionally, you can get these units pretty cheap.
For starters, the UIP1868P is hard-coded to packet8.net, so when it boots it attempts to contact packet8 and attempt to register. To use the UIP1868P on a local Asterisk box, you need to FOOL the phone into thinking that packet8.net is a LOCAL Asterisk SIP server.
First, you need to create a tiny DNS name server on your local Asterisk box. The phone uses DNS "SRV" records to figure out what SIP server to contact. The phone wants to contact addresses like:
_sip._tcp.packet8.net
_http._tcp.download.packet8.net
The following DNS related files accomplish this. My local SIP sever is "192.168.0.6". You need to change the below files to the actual IP address of your SIP server.
/etc/named.conf
------------------------------------------------------------------------------------
// Default named.conf generated by install of bind-9.2.4-27.0.1.el4
options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
};
zone "packet8.net" IN {
type master;
file "packet8.net";
allow-update { none; };
notify no;
};
include "/etc/rndc.key";
------------------------------------------------------------------------------------
The referenced "packet8.net" file, located in /var/named/packet8.net, looks like this:
/var/named/packet8.net
-------------------------------------------------------------------------------------
@ IN SOA ns0.packet8.net. hostmaster.packet8.net. (
2007051600 ; serial
8h ; refresh
1h ; retry
1w ; expire
5m ) ; neg cache time
IN NS ns0.packet8.net.
; Mail server
IN MX 10 mail.packet8.net.
A 192.168.0.6
_sip._tcp IN SRV 1 0 5060 sip
_sip._udp IN SRV 1 0 5060 sip
_stun._udp IN SRV 20 0 3478 sip
_http._tcp IN SRV 0 5 80 sip
_http._tcp.download IN SRV 0 5 80 sip
sip A 192.168.0.6
------------------------------------------------------------------------------
You then enable named and start it on the trixbox like this:
# chkconfig named on
# service named restart
Next, update /etc/resolv.conf to point to your new local DNS server:
/etc/resolv.conf
------------------------------------------------------------------------------
nameserver 127.0.0.1
------------------------------------------------------------------------------
You can then test whether it works by doing this:
[root@asterisk1 ~]# host packet8.net
packet8.net has address 192.168.0.6
[root@asterisk1 ~]#
If it returns "192.168.0.6" then you are in business.
Next, you need to configre the Asterisk TrixBox as an NTP server which the phone will use to automatically synchronize time. Here is my setup:
/etc/ntp.conf
------------------------------------------------------------------------------
driftfile /var/lib/ntp/drift
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 192.168.0.6
server 127.127.1.0
fudge 127.127.1.0 stratum 10
------------------------------------------------------------------------------
The "server 192.168.0.6" allows allows it to act like a stratum3 NTP server. If you have another NTP server on your local network, you can probably point the UIP1868P to it instead.
Next, you need to modify the UIP1868P "WAN" settings to point to your local Asterisk server.
In this configuration, the phone is NOT A ROUTER. It is simply a local client on your local subnet. Plug the WAN port into your local subnet, let it boot via DHCP, figure out what its IP address is and connect to the admin interface (UI). You then need to HARDCODE a local IP address (I used 192.168.0.100). The reason to hardcode is that *MY* DHCP server is via my local wireless router. If you have a REAL DHCP server than you can create special records for your phone(s), which could include the special GATEWAY, DNS SERVER, and NTP servers that is hardcoded below. If you have a whole bunch of UIP1868P phones, then this may be a better route.
For me, initially, the phone got a DHCP-enabled address of 192.168.0.10. I connected to it via a browser using "http://192.168.0.10" and the phone prompted with a login prompt. The default password is "admin" and up comes the UIP1868P interface. I heard other (newer) UIP1868P units have another password.
The interface is stripped down, because so many things are hardcoded internally, but here are the settings I changed:
WAN Configuration
-----------------------------------------------------------------------------
Host Name: xxx(whatever, it doesn't matter)
Domain Name: localdomain.com
MTU: 1500
-----------------------------------------------------------------------------
Obtain WAN configuration dynamically
Specify fixed WAN configuration
IP Address: 192.168.0.100
IP Netmask: 255.255.255.0
IP Gateway: 192.168.0.6
DNS Server 1: 192.168.0.6
DNS Server 2:
DNS Server 3:
LAN Configuration
------------------------------------------------------------------------------
Network Configuration
IP Address: 192.168.1.15
Subnet Mask: 255.255.255.0
DHCP: DISABLED
SYSTEM-> Localization
------------------------------------------------------------------------------
Country: United States
NTP Server: 192.168.0.6
Time Zone: ASREQ
------------------------------------------------------------------------------
Notice the Following: The GATEWAY, DNS SERVER, and NTP server are all set to the local Asterisk server. Also, the local "LAN" IP address *MUST* be on a different subnet as the WAN address. This is important. It can be anything, just NOT (as above) 192.168.0.x, the subnet where the Asterisk box is.
After you make all of the above changes (configure fake dns, NTP, etc.), reset your phone (unplug it, plug it back in). After it reboots it should correctly choose your LOCAL SIP server. Reconnect back to the NEW ip address of the phone (which is now http://192.168.0.100), log back in (password = 'admin'). On the "HOME" tab of the UIP1868P, the summary should look similar to this:
System Information
System Uptime: 0 days, 13h 14m 37s
Power Uptime: 0 days, 13h 14m 38s
LAN IP Address: 192.168.1.15 (Static)
LAN MAC Address: 00:xx:xx:xx:xx:xx
WAN IP Address: 192.168.0.100 (Static)
WAN MAC Address: 00:e0:xx:xx:xx:xx
SIP Server: 192.168.0.6 : 5060
Security: Password installed
Application Code Version: DTAU version 1.0 US (8x8 001410)
Downloader Code Version: 1.0 US (8x8 010311)
Notice how the SIP server now shows your local Asterisks IP address "192.168.0.6" and port number (5060). Joy (for now). We are not done yet.
If you want to use the UIP1868P for inbound dialing (only), the above should work without any further changes to Asterisk..... Once you "figure" out the hardcoded "USERID" of the phone. This is important. The "extension" name in Asterisk must be set to this value.
To do this, set your Asterisk to "sip debug", and boot up the phone. The Asterisk logs should show a wierd user trying to register, like this:
*CLI> sip debug
----------------------------------------------------------------------------
<-- SIP read from 192.168.0.100:38202: REGISTER sip:packet8.net SIP/2.0 i: 4sdfffffvvdgsddfsf f: <sip:@0316381209@packet8.net;user=phone>;tag=10xxxxxx6008
THERE! The USERID of the phone is "0316381209" and **THAT** is the name of the Asterisk Extension you must use!
You can then use the UIP1868P to accept incoming phone calls at this point. When configuring the Extention, set the password to BLANK. NOTE: I still haven't figured out what password I could set it to.
If you want to also dial OUTBOUND, then there is some code changes that need to be made to Asterisk. I think for most folks who use Asterisk, these changes are pretty easy. It just involves modifying "asterisk-1.2.24/channels/chan_sip.c", recompiling and installing.
For some background on this, the reason for the code change is that the UIP1868P uses wierd headers when communicating the SIP protocol... at least for Asterisk. Asterisk EXPECTS the sip: header to contain "sip:XXXXXXX" where the UIP1868P sends out "tel:+XXXXXXXX". To fix this, we need to intercept the packet arriving from the UIP1868P and dynamically change the header from "tel:+" to "sip:"... That is what the code change is about.
Also, Asterisk expects the "To:" header to contain a domain IP address, like "sip:XXXXXXX@192.168.0.6", but the UIP1868P sends "tel:XXXXXXX". This also confuses Asterisk.
The code change addresses these two issues. The following patch is ONLY FOR the TrixBox version of Asterisk!!! For the newer version (Asterisk 1.4+), there were some slight code differences in the sections of the code. It get it working with Asterisk 1.4, is is really a small task. However, this patch is ONLY for asterisk-1.2.24.
Patch:
------------------------------------------------------------------------------
[root@asterisk1 SOURCES]# pwd
/usr/src/redhat/SOURCES
[root@asterisk1 SOURCES]# cat asterisk-1.2.24-packet8.patch
--- asterisk-1.2.24.org/channels/chan_sip.c 2007-07-23 07:32:07.000000000 -0700
+++ asterisk-1.2.24/channels/chan_sip.c 2007-12-29 14:37:29.000000000 -0800
@@ -6787,6 +6787,7 @@
char tmpf[256], *from;
struct sip_request *req;
char *colon;
+ int packet8 = 0;
req = oreq;
if (!req)
@@ -6798,6 +6799,13 @@
ast_copy_string(tmpf, get_header(req, "From"), sizeof(tmpf));
from = get_in_brackets(tmpf);
+
+ if (strstr(from, "packet8.net")) {
+ /* for packet8, use the Contact: header vice From: */
+ ast_copy_string(tmpf, get_header(req, "Contact"), sizeof(tmpf));
+ from = get_in_brackets(tmpf);
+ packet8 = 1;
+ }
if (strncasecmp(uri, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", uri);
@@ -6824,8 +6832,14 @@
user = uri;
} else {
/* No user portion present */
- domain = uri;
- user = "s";
+ if ( packet8 == 1 ) {
+ user = uri;
+ domain = strsep(&from, "@");
+ domain = strsep(&from, ":");
+ } else {
+ domain = uri;
+ user = "s";
+ }
}
/* Strip port from domain if present */
@@ -6855,7 +6869,7 @@
ast_copy_string(p->context, domain_context, sizeof(p->context));
}
- if (from) {
+ if (from && packet8 == 0) {
if ((a = strchr(from, ';')))
*a = '\0';
if ((a = strchr(from, '@'))) {
@@ -11513,6 +11527,7 @@
struct sockaddr_in sin = { 0, };
struct sip_pvt *p;
int res;
+ char *f;
socklen_t len;
int nounlock;
int recount = 0;
@@ -11522,6 +11537,18 @@
len = sizeof(sin);
memset(&req, 0, sizeof(req));
res = recvfrom(sipsock, req.data, sizeof(req.data) - 1, 0, (struct sockaddr *)&sin, &len);
+ f = strstr(req.data, "packet8.net");
+ if ( f != 0 ) {
+ while ((f = strstr(req.data, "tel:+")) != NULL) {
+ strncpy (f, "sip:!", 5);
+ }
+ while ((f = strchr(req.data,'!')) != NULL) {
+ strcpy(f, f+1);
+ }
+ if (ast_test_flag(&req, SIP_PKT_DEBUG)) {
+ ast_verbose("\n<-- PACKET8 header %s:%d: --->[%s]\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin.sin_addr), ntohs(sin.sin_port), req.data);
+ }
+ }
if (res < 0) {
#if !defined(__FreeBSD__)
if (errno == EAGAIN)
------------------------------------------------------------------------------------
Sorry for all those <br /> characters. I can't figure out how to prevent them in this forum.
To manually apply this patch, here is what you can do:
Download the trixbox version of the source code:
asterisk-1.2.24-47.79171.src.rpm
Install it, untar it, patch chan_sip.c, retar, make:
rpm -ihv asterisk-1.2.24-47.79171.src.rpm
cd /usr/src/redhat/SOURCES
tar zxvf asterisk-1.2.24.tar.gz
cd asterisk-1.2.24/channels
#
# vi -or- patch chan_sip.c as required, then retar
#
cd /usr/src/redhat/SOURCES
tar czvf asterisk-1.2.24.tar.gz asterisk-1.2.24
cd /usr/src/redhat/SPECS
rpmbuild -bb asterisk.spec
NOTE: I believe you have to install some RPMS in order to compile a new version of Asterisk (via rpmbuild) on the TrixBox. I believe:
yum install rpm-build
yum install zaptel-devel libpri-devel speex-devel libogg-devel libvorbis-devel
Then retry the "rpmbuild -bb asterisk.spec"
#
# Wait till build is finished, verify that it actually create a new RPM
#
# Shutdown asterisk
#
service asterisk stop
#
# Load newly built RPM
#
rpm -ihv --force /usr/src/redhat/RPMS/i386/asterisk-1.2.24-47.79171.i386.rpm
#
# restart asterisk
#
service asterisk start
--OR-- Just obtain the modified RPMS and install.
Hope it works! The only thing that doesn't work properly is the message waiting light. Maybe someone can figure this out and post a solution. Asterisk sends a notification, but the phone does not accept it.
WORKAROUND:
You can set up a crontab that periodically checks the following directory:
/var/spool/asterisk/voicemail/default/0316381209/INBOX/*.txt
If any new *.txt files exist, then ring the phone (once, very short ring) by executing a script that looks like this:
ringonce.sh
--------------------------------------------------------------------------------
[root@asterisk asterisk]# cat ringonce.sh
#! /bin/bash # [ "$1" = "" ] && echo "$0 [extension]" && exit cat <<END_OF_TEXT > /var/spool/asterisk/outgoing/ringonce$$.call Channel: SIP/$1 Extension: $1 Callerid: Messages Waiting <> MaxRetries: 0 RetryTime: 0 WaitTime: 1 END_OF_TEXT
--------------------------------------------------------------------------------
Execute the scipt like this:
/var/spool/asterisk/ringonce.sh 0316381209
The phone will ring once, for a quarter-second or so, indicating that you have voicemail. You'll need to figure out the logic so the phone doesn't keep ringing every time the script executes. In addition, the above script could be used for other things as well, like a wakeup call [grin].
Voicemail: I've discovered that Asterisk demands the packet8 USERID when logging in to retrieve the phones voicemail. It expects the wierd "0316381209", which is tough to remember! However, I have a work around:
In /etc/asterisk/voicemail.conf, add a "friendly" user name, like "100", as shown below:
[default]
100 => 1234,100,,,attach=no|saycid=no|envelope=no|delete=no 0316381209 => 1234,100,,,attach=no|saycid=no|envelope=no|delete=no
Then, go to the voicemail spool directory on the Asterisk server and create a softlink to the USERID directory, like this:
[root@asterisk1 default]# pwd
/var/spool/asterisk/voicemail/default
[root@asterisk1 default]# ll
total 8
drwx------ 9 asterisk asterisk 4096 Dec 28 23:27 0316381209
lrwxrwxrwx 1 root root 10 Dec 28 23:34 100 -> 0316381209
[root@asterisk1 default]#
You can now use "100" to login into voicemail (instead of 0316381209), and use "1234" as the pasword. Works for me.
I hope this helps a few folks out there stuck with UIP1868P phones gathering dust in the closet! Now to just figure out that pesky message waiting light issue.
I can probably make the new RPMS available if people are really interested. I don't have a way of posting them, so if someone wants to host them (somewhere) I can email the RPMS to you and we can reference the link to them here.
Mike
I just wanted to thank you i used what you did with your uniden phone to get it to work for me. And it worked like a charm. Only difference is my trixbox is on a internet server and yours is local. But i just pointed the dns to that server and it worked left the gateway and such pointed to my local router.
But i am using the beta version of trixbox so i believe its asterisk 1.4. So i can't do the outgoing trying to decide if downgrading back to 2.2 is worth it or if i'm able to patch asterisk myself for the 1.4 version i'm going to try but i'm not really a C programmer. Again thank you for your post
If your UIP1868P has a local address (192.168.x.x|10.x.x.x) and your Asterisk server is on the internet then yes you need to point to a local default router so your phone can reach the Asterisk server. If you want the system time to automatically appear then setting the NTP server is also important.
The reason to pointing the gateway to the Asterisk server is to ensure that the UIP1868P doesn't try to "phone home". Also, it made it easy to figure out what it was trying to do. You can run "tcpdump -A host UIP1868P_host" and made it easy to see what it was trying to do. There is no reason for the phone to talk to ANYTHING except the Asterisk server.
Yeah i use a linux based router so i set a rule to forward everything coming from my phones ip to the voip server. It all works like a champ except outgoing calls but for now if i need to i just dial with another phone and transfer the call.
THank you again for your hard work on this its great to be able to use my cordless phone again. All i had were corded office type phones.
If there is anything i can do to assist you in this just let me know
Thanks for this awesome info, I've been looking at getting my old UIP1868p working for over a year. I've gone as far as receiving incoming calls, the phone registers and all and can receive calls but as for making the code changes for outgoing calls I'm stuck. I messed with C years ago, but am not up to par for this. I am running asterisk 1.4.18 and am unable to effect the changes you show, so any help would be appreciated. I know this post is a bit old but I'm hoping someone has made these changes in asterisk 1.4.
Thanks

Member Since:
2007-12-29