Difference between revisions of "Guerilla VoIP"

From Hackerspace ACKspace
Jump to: navigation, search
m (added some links)
(project revamped: cleaned a bit)
Line 1: Line 1:
 
{{Project
 
{{Project
 
|Featured=No
 
|Featured=No
|State=Planned
+
|State=Active
 
|Members=xopr
 
|Members=xopr
 
|Description=low cost communication node
 
|Description=low cost communication node
Line 7: Line 7:
 
}}
 
}}
 
== synopsis ==
 
== synopsis ==
{{InfoBox
 
|Title=Note
 
|Text=Some essential hardware broke; need to rebuild it and add some extra safety features
 
}}
 
 
Create a low cost communication node (with VoIP as a base), trying to connect as many as possible types of links, for example:
 
Create a low cost communication node (with VoIP as a base), trying to connect as many as possible types of links, for example:
 
* copper/fibre/WiFi network
 
* copper/fibre/WiFi network
* DECT/POTS telephony
+
* DECT/POTS/GSM telephony
 
* SIP/<abbr title="Skinny Call Control Protocol">SCCP</abbr>
 
* SIP/<abbr title="Skinny Call Control Protocol">SCCP</abbr>
 
* HAM radio (or preferrably, <abbr title="Citizen's Band">CB</abbr> radio: 27MC/PMR)
 
* HAM radio (or preferrably, <abbr title="Citizen's Band">CB</abbr> radio: 27MC/PMR)
Line 30: Line 26:
 
</gallery>
 
</gallery>
  
== prototyping ==
 
  
So to make the first prototype, I chose the following:
+
== implementation ==
 +
The current version has:
 
* ammo box
 
* ammo box
* 7Ah battery
+
* 7Ah SLA battery
* step-down converter 12->5V
+
* banana/screw terminal
* step-up converter 12v->48V
+
* weatherproof ethernet outlet
* Fritz!Box 7270 (NAT, FxS, FxO, DECT)
+
* 12-volt cigarette lighter receptacle
* two [[Raspberry Pi]]s running FreeSWITCH (external queue, internal SCCP server), DHCP and TFTP
+
* 3D printed insert
 +
* fuse box
 +
* switches for device targeting power and power state preview
 
* Netgear GS110TP (8xPoE + 2xSFP)
 
* Netgear GS110TP (8xPoE + 2xSFP)
 +
* a couple [[Telephone system:Cisco PoE hack]] cable
 +
 +
 +
=== todo ===
 +
* upload models and schematics
 +
* 3D print inlay for Switch/PI holder
 +
* install fuses and crowbar circuit
 +
* install state leds
 +
* install step-down converter 12->5V
 +
* install step-up converter 12v->48V
 +
* Raspberry PI or Orange PI
 +
* NL dialplan (FS/Cisco)
 +
 +
 +
== prototyping ==
 +
 
=== hardware ===
 
=== hardware ===
 +
 
==== connectivity/infra ====
 
==== connectivity/infra ====
 
{| class="wikitable"
 
{| class="wikitable"
! HW
+
! HW !! price range !! voltage !! power consumption !! copper/Gbit !! PoE !! fibre !! VLAN !! 2.4GHz !! 5GHz !! DSL !! ISDN !! POTS !! DECT !! USB
! price range
+
! voltage
+
! power consumption
+
! copper/Gbit
+
! PoE
+
! fibre
+
! VLAN
+
! 2.4GHz
+
! 5GHz
+
! DSL
+
! ISDN
+
! POTS
+
! DECT
+
! USB
+
 
|-
 
|-
| [[Fritz!Box]] 7270
+
| [[Fritz!Box]] 7270 || &euro; 50-213 || 5.5-15v || 4.3W - 5.3W || 4/0 || ||  || ? || &#x2713; || &#x2713; || &#x2713; || &#x2713; || 2&times;FXS / 1&times;FXO || 5 (6?)<abbr title="handsets">hs</abbr> || 1&times;2.0
| &euro; 50-213
+
| 5.5-15v
+
| 4.3W - 5.3W
+
| 4/0
+
|  
+
|  
+
| ?
+
| &#x2713;
+
| &#x2713;
+
| &#x2713;
+
| &#x2713;
+
| 2&times;FXS / 1&times;FXO
+
| 5 (6?)<abbr title="handsets">hs</abbr>
+
| 1&times;2.0
+
 
|-
 
|-
| [[GL-Inet]]
+
| [[GL-Inet]] || &euro;22-30 || 5v || 1W || 2/0 || ||  || &#x2713; || &#x2713; || ||  ||  ||  || || 1&times;2.0
| &euro;22-30
+
| 5v
+
| 1W
+
| 2/0
+
|  
+
|  
+
| &#x2713;
+
| &#x2713;
+
|  
+
|  
+
|  
+
|  
+
|  
+
| 1&times;2.0
+
 
|-
 
|-
| [[TP WR-703n]]
+
| [[TP WR-703n]] || &euro;17-25 || 5v || 1W || 1/0 || ||  || &#x2713; || &#x2713; || ||  ||  ||  || || 1&times;2.0
| &euro;17-25
+
| 5v
+
| 1W
+
| 1/0
+
|  
+
|  
+
| &#x2713;
+
| &#x2713;
+
|  
+
|  
+
|  
+
|  
+
|  
+
| 1&times;2.0
+
 
|-
 
|-
| Netgear GS110TP
+
| Netgear GS110TP || &euro;126-140 (<abbr title="ordered on amazon.de with discount last May (2017)">&euro;99.64</abbr>) || 48v || 4W || 8/8 || 8 || 2 || &#x2713; || ||  ||  ||  || || ||
| &euro;126-140 (<abbr title="ordered on amazon.de with discount last May (2017)">&euro;99.64</abbr>)
+
| 48v
+
| 4W
+
| 8/8
+
| 8
+
| 2
+
| &#x2713;
+
|  
+
|  
+
|  
+
|  
+
|  
+
|  
+
|
+
 
|-
 
|-
| [http://nl.tp-link.com/products/details/cat-41_TL-SG108PE.html TP Link TL-SG108PE]
+
| [http://nl.tp-link.com/products/details/cat-41_TL-SG108PE.html TP Link TL-SG108PE] || &euro;65 || 48v || 5.2w || 8/8 || 4 || || &#x2713; || || || || || || ||
| &euro;65
+
| 48v
+
| 5.2w
+
| 8/8
+
| 4
+
|  
+
| &#x2713;
+
|  
+
|  
+
|  
+
|  
+
|  
+
|  
+
|
+
 
|-
 
|-
| [[Siemens_Gigaset#N510_IP_PRO|Siemens Gigaset N510 IP PRO]]
+
| [[Siemens_Gigaset#N510_IP_PRO|Siemens Gigaset N510 IP PRO]] || <abbr title="Bought at broadbandbuyer.co.uk Sep 2016">&pound;53.94</abbr> (&euro;65.39) || 6.5v || 1.2-1.3W || 1/? || <abbr title="supports PoE PD">&#x2713;</abbr> || || &#x2713; || ||  ||  ||  || || 6<abbr title="handsets">hs</abbr>,4<abbr title="simultaneous calls">sc</abbr> ||
| <abbr title="Bought at broadbandbuyer.co.uk Sep 2016">&pound;53.94</abbr> (&euro;65.39)
+
| 6.5v
+
| 1.2-1.3W
+
| 1/?
+
| <abbr title="supports PoE PD">&#x2713;</abbr>
+
|  
+
| &#x2713;
+
|  
+
|  
+
|  
+
|  
+
|  
+
| 6<abbr title="handsets">hs</abbr>,4<abbr title="simultaneous calls">sc</abbr>
+
|
+
 
|}
 
|}
 
  
  
 
==== hard phones / ATAs ====
 
==== hard phones / ATAs ====
 
{| class="wikitable"
 
{| class="wikitable"
! HW
+
! HW !! price range !! voltage !! power consumption !! copper/Gbit !! PoE !! VLAN !! SIP !! lines !! extensible !! tested on [[FreeSWITCH]]
! price range
+
! voltage
+
! power consumption
+
! copper/Gbit
+
! PoE
+
! VLAN
+
! SIP
+
! lines
+
! extensible
+
! tested on [[FreeSWITCH]]
+
 
|-
 
|-
| [[Cisco 79xx|Cisco 7905]]
+
| [[Cisco 79xx|Cisco 7905]] || &euro; 10-50 || 48v ||  || 1/0 || &#x2713; || || &#x2713; || 1(?) ||  || &#x2713;
| &euro; 10-50
+
| 48v
+
|  
+
| 1/0
+
| &#x2713;
+
|
+
| &#x2713;
+
| 1(?)
+
|  
+
| &#x2713;
+
 
|-
 
|-
| [[Cisco 79xx|Cisco 7910]]
+
| [[Cisco 79xx|Cisco 7910]] ||  || 48v ||  || 1/0 || &#x2713; || &#x2713; ||  || 6(?) || || &#x2713;
|  
+
| 48v
+
|  
+
| 1/0
+
| &#x2713;
+
| &#x2713;
+
|  
+
| 6(?)
+
|
+
| &#x2713;
+
 
|-
 
|-
| [[Cisco 79xx|Cisco 7940/7960]]
+
| [[Cisco 79xx|Cisco 7940/7960]] || &euro; 10-50 || 48v || 5W || 2/0 || &#x2713; || &#x2713; || &#x2713; || 2/6 || &#x2713; || &#x2713;
| &euro; 10-50
+
| 48v
+
| 5W
+
| 2/0
+
| &#x2713;
+
| &#x2713;
+
| &#x2713;
+
| 2/6
+
| &#x2713;
+
| &#x2713;
+
 
|-
 
|-
| [[Cisco 79xx|Cisco 7941/7961]]
+
| [[Cisco 79xx|Cisco 7941/7961]] ||  || 48v ||  || 2/2(?) || &#x2713; || &#x2713; || &#x2713;(?) || 2/6 || &#x2713; ||
|  
+
| 48v
+
|  
+
| 2/2(?)
+
| &#x2713;
+
| &#x2713;
+
| &#x2713;(?)
+
| 2/6
+
| &#x2713;
+
|
+
 
|-
 
|-
| [[Avaya 4620SW]]
+
| [[Avaya 4620SW]] ||  || 48v ||  || 2/0? || &#x2713; || &#x2713;(?) || &#x2713;(?) || ? || &#x2713; ||  
|  
+
| 48v
+
|  
+
| 2/0?
+
| &#x2713;
+
| &#x2713;(?)
+
| &#x2713;(?)
+
| ?
+
| &#x2713;
+
|  
+
 
|-
 
|-
| [[Telephone_system:Analog_Telephone_Adapter#Linksys_PAP2T|Linksys PAP2T]]
+
| [[Telephone_system:Analog_Telephone_Adapter#Linksys_PAP2T|Linksys PAP2T]] ||  || 5v || 10W || 1/0 || &#x2713; || || &#x2713; || 2&times;FXS ||  || &#x2713;
|  
+
| 5v
+
| 10W
+
| 1/0
+
| &#x2713;
+
|
+
| &#x2713;
+
| 2&times;FXS
+
|  
+
| &#x2713;
+
 
|-
 
|-
| [[Telephone_system:Analog_Telephone_Adapter#Sipura_SPA3000|Sipura SPA3000]]
+
| [[Telephone_system:Analog_Telephone_Adapter#Sipura_SPA3000|Sipura SPA3000]] ||  || 5v || 7.5W || 1/0 || &#x2713; || || &#x2713; || 1&times;FXS 1&times;FXO ||  || &#x2713;
|  
+
| 5v
+
| 7.5W
+
| 1/0
+
| &#x2713;
+
|
+
| &#x2713;
+
| 1&times;FXS 1&times;FXO
+
|  
+
| &#x2713;
+
 
|}
 
|}
  
=== some power tests ===
 
  
 +
=== some power tests ===
 
{| class="wikitable"
 
{| class="wikitable"
 
! hardware || power source || U || I || P<sub>approximated</sub>
 
! hardware || power source || U || I || P<sub>approximated</sub>
Line 290: Line 126:
 
image:guerilla_prototype.jpg|Complete Guerilla VoIP prototype running at 13.8V
 
image:guerilla_prototype.jpg|Complete Guerilla VoIP prototype running at 13.8V
 
</gallery>
 
</gallery>
 +
  
 
=== interesting facts ===
 
=== interesting facts ===
Line 296: Line 133:
 
* if the pre-standard CP-79x0 is connected using the PoE adapter hack, the Netgear GS110TP doesn't power, when you unplug it, it will enable power within 5 seconds; plug in, and the phone boots.
 
* if the pre-standard CP-79x0 is connected using the PoE adapter hack, the Netgear GS110TP doesn't power, when you unplug it, it will enable power within 5 seconds; plug in, and the phone boots.
 
* if you configure the administrative VLAN, the phone will fetch a DHCP lease on that VLAN, allowing you to seperately set up dnsmasq on a Raspberry Pi
 
* if you configure the administrative VLAN, the phone will fetch a DHCP lease on that VLAN, allowing you to seperately set up dnsmasq on a Raspberry Pi
 +
 +
 
== inventory ==
 
== inventory ==
 
* Fritz!Boxes
 
* Fritz!Boxes
Line 309: Line 148:
 
: 1&times;Profoon PDX2900
 
: 1&times;Profoon PDX2900
 
: + what's not yet inventoried at the space
 
: + what's not yet inventoried at the space
== done ==
 
* the first version works, but still needs some manual labor
 
* [[Telephone system:Cisco PoE hack]] cable
 
* Cisco NL dialplan
 
* tested with battery; float charging device still has to be made (haven't measured how long it would run on a single charge though, but enough time to do some important phone calling)
 
  
Also, I've been playing with the Banana Pi, since the Raspberry Pi sometimes chokes on input digits.
+
 
Here is a log/some steps to reproduce
+
== log and ideas ==
 +
A list of ideas to consider:
 +
* modular 3D insert for different single board computers
 +
* extra network outlet (since a single one is more or less useless)
 +
* float or CC/CV charger, MPPT solar charger
 +
* external antenna mount
 +
* temperature monitor
 +
 
 +
Here is a log/some steps to reproduce:
 +
 
 
=== get the basics ===
 
=== get the basics ===
 
<pre>apt-get install vlan dnsmasq make curl</pre>
 
<pre>apt-get install vlan dnsmasq make curl</pre>
 +
  
 
=== create and install FreeSWITCH ===
 
=== create and install FreeSWITCH ===
Line 336: Line 180:
 
chmod -R ug=rwX,o= /usr/local/freeswitch/
 
chmod -R ug=rwX,o= /usr/local/freeswitch/
 
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*</pre>
 
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*</pre>
 +
  
 
=== prepare VLAN ===
 
=== prepare VLAN ===
Line 342: Line 187:
 
echo 8021q >> /etc/modules
 
echo 8021q >> /etc/modules
 
vconfig set_name_type DEV_PLUS_VID_NO_PAD</pre>
 
vconfig set_name_type DEV_PLUS_VID_NO_PAD</pre>
 +
  
 
=== set-up network and VLAN ===
 
=== set-up network and VLAN ===
Line 366: Line 212:
 
     netmask 255.255.255.0
 
     netmask 255.255.255.0
 
     vlan-raw-device eth0</pre>
 
     vlan-raw-device eth0</pre>
 +
 +
 
=== dnsmasq ===
 
=== dnsmasq ===
 
<pre>vi /etc/dnsmasq.conf</pre>
 
<pre>vi /etc/dnsmasq.conf</pre>

Revision as of 09:05, 17 October 2018

Project: Guerilla VoIP
Featured: No
State Active
Members xopr
GitHub No GitHub project defined. Add your project here.
Description low cost communication node
Picture
Guerilla voip in use.jpg

synopsis

Create a low cost communication node (with VoIP as a base), trying to connect as many as possible types of links, for example:

  • copper/fibre/WiFi network
  • DECT/POTS/GSM telephony
  • SIP/SCCP
  • HAM radio (or preferrably, CB radio: 27MC/PMR)
  • copper/WiFi/USB uplink


It also could need some of the following functionality:

  • PoE service (to drive phones, remote switches/accesspoints)
  • battery supported/powered (in case of power failures/lack of power)
  • Efficient power converter(s) when running on battery
  • sturdy compact waterproof casing


implementation

The current version has:

  • ammo box
  • 7Ah SLA battery
  • banana/screw terminal
  • weatherproof ethernet outlet
  • 12-volt cigarette lighter receptacle
  • 3D printed insert
  • fuse box
  • switches for device targeting power and power state preview
  • Netgear GS110TP (8xPoE + 2xSFP)
  • a couple Telephone system:Cisco PoE hack cable


todo

  • upload models and schematics
  • 3D print inlay for Switch/PI holder
  • install fuses and crowbar circuit
  • install state leds
  • install step-down converter 12->5V
  • install step-up converter 12v->48V
  • Raspberry PI or Orange PI
  • NL dialplan (FS/Cisco)


prototyping

hardware

connectivity/infra

HW price range voltage power consumption copper/Gbit PoE fibre VLAN 2.4GHz 5GHz DSL ISDN POTS DECT USB
Fritz!Box 7270 € 50-213 5.5-15v 4.3W - 5.3W 4/0  ? 2×FXS / 1×FXO 5 (6?)hs 1×2.0
GL-Inet €22-30 5v 1W 2/0 1×2.0
TP WR-703n €17-25 5v 1W 1/0 1×2.0
Netgear GS110TP €126-140 (€99.64) 48v 4W 8/8 8 2
TP Link TL-SG108PE €65 48v 5.2w 8/8 4
Siemens Gigaset N510 IP PRO £53.94 (€65.39) 6.5v 1.2-1.3W 1/? 6hs,4sc


hard phones / ATAs

HW price range voltage power consumption copper/Gbit PoE VLAN SIP lines extensible tested on FreeSWITCH
Cisco 7905 € 10-50 48v 1/0 1(?)
Cisco 7910 48v 1/0 6(?)
Cisco 7940/7960 € 10-50 48v 5W 2/0 2/6
Cisco 7941/7961 48v 2/2(?) ✓(?) 2/6
Avaya 4620SW 48v 2/0? ✓(?) ✓(?)  ?
Linksys PAP2T 5v 10W 1/0 2×FXS
Sipura SPA3000 5v 7.5W 1/0 1×FXS 1×FXO


some power tests

hardware power source U I Papproximated
two Raspberry Pis, step down drill battery pack 12.6V[1] 330mA 2×2W
Cisco CP7940, step up drill battery pack 12.6V[1] 360mA - 450mA 5W
Fritz!box (wifi off), direct lab power supply 12V 360mA (idle) - 440mA
(42% - 52%, top ~880mA)
4.3W - 5.3W
15V 250mA (idle) 3.8W
Netgear GS110TP PoE, step up lab power supply 12V 330mA 4W
Netgear GS110TP PoE +
Cisco CP7940, step up
lab power supply 12V 740mA 9W
Complete set: 2 RasPis,
Fritz!box, switch,
phone + cellphone charging
lab power supply 12V 2000mA 24W
13.8V 1600mA 22W
cellphone charging lab power supply 5W[2]
Minimal setup:
(router+switch+Pi+phone)
16W[3]
[1] Approximated by calculating deviation from the lab power supply combined values, which was about 5% off 12V
[2] Approximated by subtracting all calculated items from the complete setup
[3] Approximated by just adding up individual items


interesting facts

  • Fritz!box has a switching regulator to 5V tested between 5.5V and 15V (drops off at 5.3V idle and elco at power supply segment is rated 16V)
  • PoE hack adapter connected pin 1 (white-orange) and pin 3 (white-green) with 22K resistor.
  • if the pre-standard CP-79x0 is connected using the PoE adapter hack, the Netgear GS110TP doesn't power, when you unplug it, it will enable power within 5 seconds; plug in, and the phone boots.
  • if you configure the administrative VLAN, the phone will fetch a DHCP lease on that VLAN, allowing you to seperately set up dnsmasq on a Raspberry Pi


inventory

  • Fritz!Boxes
7270 (ADSL2+, 1×USB 2.0, a/b, S0 [FXO], 2×FXS, S0-bus, n×DECT, 4×100Mbit, 2.4GHz or 5GHz, 64MB RAM)
7340 (ADSL2+, VDSL, 2×USB 2.0, a/b, S0 [FXO], 2×FXS, n×DECT, 2×Gbit, 2.4GHz or 5GHz, 128MB RAM)
7340 (ADSL2+, VDSL, 2×USB 2.0, a/b, S0 [FXO], 2×FXS, S0-bus, n×DECT, 4×100Mbit, 2.4GHz and 5GHz, 512MB RAM)
  • DECT phones
2×Siemens AL28H
2×Siemens A420 (PsychiC has one)
2×Philips CD6552B
2×Philips CD1302S
1×Philips DECT1221S
1×Profoon PDX2900
+ what's not yet inventoried at the space


log and ideas

A list of ideas to consider:

  • modular 3D insert for different single board computers
  • extra network outlet (since a single one is more or less useless)
  • float or CC/CV charger, MPPT solar charger
  • external antenna mount
  • temperature monitor

Here is a log/some steps to reproduce:

get the basics

apt-get install vlan dnsmasq make curl


create and install FreeSWITCH

see https://freeswitch.org/confluence/display/FREESWITCH/Debian#Debian-BuildingFromSource

cd /usr/src
curl https://freeswitch.org/stash/projects/FS/repos/freeswitch/browse/build/Makefile.centos6?raw > Makefile

If you want to compile and install STABLE branch, edit the above Makefile and add " -b v1.4 " just after the word "clone".

make && make install
  • (you can kill time by doing the other chapters)

create user 'freeswitch', add it to group 'daemon' and change owner and group of the freeswitch installation

cd /usr/local
adduser --disabled-password  --quiet --system --home /usr/local/freeswitch --gecos "FreeSWITCH Voice Platform" --ingroup daemon freeswitch
chown -R freeswitch:daemon /usr/local/freeswitch/
chmod -R ug=rwX,o= /usr/local/freeswitch/
chmod -R u=rwx,g=rx /usr/local/freeswitch/bin/*


prepare VLAN

modprobe 8021q
lsmod | grep 8021q
echo 8021q >> /etc/modules
vconfig set_name_type DEV_PLUS_VID_NO_PAD


set-up network and VLAN

vi /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0

# dhcp configuration, used in normal operation (this connects to your internet)
iface eth0 inet dhcp

# static ip configuration, used for stand-alone preconfiguring factory-reset phones
#iface eth0 inet static
#	address 192.168.6.1
#	netmask 255.255.255.0
#	gateway 192.168.6.1

# operational VLAN 11 (pick any), for usage with VoIP
auto eth0.11
iface eth0.11 inet static
    address 192.168.11.1
    netmask 255.255.255.0
    vlan-raw-device eth0


dnsmasq

vi /etc/dnsmasq.conf
# uncomment to enable dhcp server on eth0, used for stand-alone preconfiguring factory-reset phones
#interface=eth0
# operational VLAN 11 (pick any), for usage with VoIP
interface=eth0.11

# Choose different ranges for each (V)LAN
dhcp-range=eth0,192.168.6.50,192.168.6.150,12h
dhcp-range=eth0.11,192.168.11.50,192.168.11.150,12h

# Most likeley not needed
#option:tftp-server
#dhcp-option=66,192.168.6.1
#option:
#dhcp-option=150,192.168.178.16

# Enable dnsmasq's built-in TFTP server to serve config files
enable-tftp

# Set the root directory for files available via FTP.
tftp-root=/srv/tftp

Create the /srv/tftp directory and put the configs and firmwares in it. Here is a config generator you can put in there (sorry, can't provide the firmwares since "I don't have them").

service dnsmasq restart

or

/etc/init.d/dnsmasq restart

toggleconfig script

#!/bin/bash

restart_services()
{
  trap -- SIGHUP SIGINT SIGTERM

  service dnsmasq stop > /dev/null
  #nohup sh -c "invoke-rc.d networking stop; sleep 2; invoke-rc.d networking start"
  invoke-rc.d networking stop > /dev/null
  sleep 2
  invoke-rc.d networking start > /dev/null
  service dnsmasq start > /dev/null

  trap clean_up SIGHUP SIGINT SIGTERM
}

clean_up()
{
  # reset gpio pin and led
  echo "11" > /sys/class/gpio/unexport
  echo 0 > /sys/class/leds/led0/brightness
  echo none > /sys/class/leds/led0/trigger

  echo done
  exit
}

if [ ! -f /etc/dnsmasq.conf.regular ]; then echo "/etc/dnsmasq.conf.regular does not exist"; exit; fi
if [ ! -f /etc/dnsmasq.conf.config ]; then echo "/etc/dnsmasq.conf.config does not exist"; exit; fi
if [ ! -f /etc/network/interfaces.regular ]; then echo "/etc/network/interfaces.regular does not exist"; exit; fi
if [ ! -f /etc/network/interfaces.config ]; then echo "/etc/network/interfaces.config does not exist"; exit; fi

trap clean_up SIGHUP SIGINT SIGTERM

echo "11" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio11/direction

while true; do

  echo "regular mode"
  echo none > /sys/class/leds/led0/trigger

  # regular config files
  cp /etc/dnsmasq.conf.regular /etc/dnsmasq.conf
  cp /etc/network/interfaces.regular /etc/network/interfaces

  restart_services

  while [ `cat /sys/class/gpio/gpio11/value` -gt 0 ]; do
    echo 1 > /sys/class/leds/led0/brightness
    sleep 0.05
    echo 0 > /sys/class/leds/led0/brightness
    sleep 3
  done

  echo "config mode"
  echo "heartbeat" > /sys/class/leds/led0/trigger

  # regular config files
  cp /etc/dnsmasq.conf.config /etc/dnsmasq.conf
  cp /etc/network/interfaces.config /etc/network/interfaces

  restart_services

  while [ `cat /sys/class/gpio/gpio11/value` -le 0 ]; do sleep 3; done

done

preconfigure phone

  • Connect the phone directly using a (optionally crosslink) ethernet cable.
  • Power the phone, and hold # until the red (mute) light is off and the phone states: "Reset sequence detected"
  • type 123456789*0#, and when asked to keep network config, choose 2=no
  • once the new firmware is loaded (Freeswitch is not running, so it won't connect), press 'settings' (checkbox button at the bottom right)
  • go to Admin. VLAN ID
  • type **# to unlock the setting, and press 'edit'
  • type in your voice VLAN (11 like the configs say)
  • press validate, and save
  • dnsmasq and interfaces configs can now be restored (no dhcp on eth0, only eth0.11)
  • nohup sh -c "invoke-rc.d networking stop; sleep 2; invoke-rc.d networking start"

todo

  • work out 'modus operandi': multiple config files switchable by phone
  • work on dual linux config with GPIO hardware switch
  • test the fibre ports
  • add homeplug as a proof of concept
  • design and create (or buy) small-sized float charger (13.8V 2A) with overcurrent protection, if needed

links

Some random links: