I won't go into all the detail of the code here as it's well documented on GitHub and seems (from all the Watch notifications I get) to be in active development so may change often. With it working on my Pi 3 I had the idea to build the AlexaPhone in parallel with my original project, starting from scratch with my Pi 2 (unfortunately meaning no RetroPie temporarily). Having set it up once already I managed to complete the Pi & code configuration in a single evening - this is the process I followed:

First I set up a new device called AlexaPhone on the Amazon website, following the process in Section 3.4 of the ReadMe. The only change needed to support the AlexaPi code was to replace amazon's suggested https://localhost:3000 with https://localhost:5000 in the "Web Settings" section of the Security Profile. We'll come back to the web settings a bit later on. With the device set up I sent myself all the codes by email and turned my attention to the Pi.

I started by downloading & writing a fresh installation of Raspbian to an 8gb SD card - you could also use NOOBS, this worked for me on the Pi 3. With a monitor & network cable attached I did the following after the first boot:

Expand the filesystem (open a terminal session, type raspi-config, select option 1)

Still in raspi-config set the Audio to force 3.5mm output instead of HDMI (Advanced Options - Audio)

Still in raspi-config change the Hostname to AlexaPhone - if you have multiple Pis on the wireless network this makes it easier to tell them apart

Still in the terminal type lsusb - listing the USB devices to make sure the USB phone was detected

From the desktop set up the Microphone level to maximum (Preferences > Audio Device Settings)

From the desktop set up the WiFi by clicking on the network icon in the taskbar

From here I rebooted the Pi and then switched back to the laptop temporarily to...

Log into the WiFi router and set the Pi to have a "Reserved IP Address" - the MAC address of the Pi's WiFi adaptor should be obvious in your router's list of Attached Devices, especially if you changed the hostname.

Make a note of the Pi's IP address, log back into the Amazon website and add two new lines to the Web Settings of the Security Profile, so that in Allowed Origins there's one line that says https://localhost:5000 and below it a new one that says https://YourPiIpAddress:5000. The same for Allowed Return URLs so there's https://localhost:5000/authresponse and https://YourPiIpAddress:5000/authresponse showing.

Now to set up the AlexaPi code! I followed the instructions from GitHub which were well-written, I'll just add my personal experiences:

Make sure you're logged in as root (sudo su in terminal) before you do the Git Clone bit

Make sure you're in the Root folder before you do the Git Clone bit (cd /root/ in terminal)

After the Git Clone bit is done you'll need to edit the file setup.sh if want to use wi-fi - switch to the AlexaPi directory (cd AlexaPi) then manually edit (sudo nano setup.sh) the file - replacing ip=ifconfig eth0 with ip=ifconfig wlan0

Now you can run setup.sh, which prompts you for all the long codes that were generated on the Amazon website while setting up the device profile. I found it easiest to copy & paste these from Claws Mail.

For me the setup.sh script gave an error at the end, though it may well work fine for you - all I needed to do was manually edit the creds.py file in the AlexaPi folder, pasting in the security IDs again.

From here I manually ran auth_web.py (sudo python auth_web.py), then opened a web browser window and typed https://localhost:5000 - this brought up an Amazon login page to complete the process

I'm not certain that all 100% of the processes above were necessary, but that was what worked for me. After a reboot the AlexaPi service started automatically when the Pi booted, making me jump when it gave its "Hello" greeting.

The main part of the code is appropriately called main.py, and this contains the instructions for capturing the audio query, uploading it to Alexa and retrieving/playing back the response, as well as defining the GPIO pins for the switch and indicator LEDs. The code is designed for a three-legged Tri Colour LED, which was perfect for me as I wanted to keep the phone exterior as uncluttered as possible. The only thing I amended for this project was the filename of the .mp3 file played on startup, replacing it with the name of the trimphone ringtone. With the code thankfully working perfectly I left it well alone, disconnected the monitor and network cable and moved on to the construction.