Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenPhone on Raspberry Pi Compute Module 4 #6

Open
emielvanberlo opened this issue Aug 5, 2022 · 1 comment
Open

OpenPhone on Raspberry Pi Compute Module 4 #6

emielvanberlo opened this issue Aug 5, 2022 · 1 comment

Comments

@emielvanberlo
Copy link

Hi, I wanted to try OpenPhone on a Raspberry Pi 4.
Current status : I can call from the USB phone to another phone.
When I try to pickup an incoming call the phone keeps ringing.....

Just wanted to write this what I have done so far to make this work on a Raspberry Pi 4:)

Installed Raspberry Pi OS (Legacy) Buster 2022-04-04 (so we have python2 as default)
With Compute Module IO Board, USB ports are disable by default!
(you can find a lot on the internet for this, but you need to add dtoverlay=dwc2,dr_mode=host to the /boot/config.txt to enable)

Then I followed the OpenPhone installation with these modifications :

Enable SPI :

in /boot/config.txt add/change dtparam=spi=on
(or use the raspberry config tool)

Install dependencies.

libttspico-utils is in buster non-free : so add buster non-free to the repo list.

wget -q https://ftp-master.debian.org/keys/release-10.asc -O- | apt-key add -
echo "deb http://deb.debian.org/debian buster non-free" >> /etc/apt/sources.list
apt-get update
apt -y install git libttspico-utils python-dev python-lxml python-requests python-flask python-pyaudio mpd python-mpd python-configparser python-pip python-setuptools libhidapi-libusb0
sudo pip install wheel
sudo pip install flask-bootstrap

Then "sudo pip install hid" will install the wrong python usb hid component.

sudo pip install cython
sudo pip install hidapi==0.9.0
(latest hidapi version doesn't support python2 anymore)

Then follow the rest of the installation but before you start openphone.py make these additional changes.

search openphone.py for spi.open(1,0) # For Neopixels
The raspberry has /dev/spidev0.0 and /dev/spidev0.1 but not 1.0
I changed this in 0,1 but I don't know if this should be 0.0 and if this only means some lights are not working.

search openphone.py for "os.path.dirname(file)" (I got 6 occurrences)
This is used to get the current path but I received an empty string and then files and folders can't be found.
I changed it in : os.path.dirname(os.path.abspath(file))
(on some lines you need to delete a ")" at the end but I assume people reading this know a bit of python to solve such an error :)

@emielvanberlo
Copy link
Author

My sip server is an Asterisk with PJSIP.

When calling to the USB phone I noticed 'EARLY' in the gui.
So in in openphone.py I added this to the def offhook():
Now the call gets answered when I pickup the handset.
But the ringing sound kept ringinginginginginging.
Adding a stop_sounds() to the end of the def offhook(); fixed that too.

def offhook():
lib.thread_register("python worker")
if not current_call:
dial(''.join(map(str, number_to_be_dialed)))
else:
print(current_call.info().state_text)
if(current_call.info().state_text == "CONNECTING" or "EARLY"):
answer_call() # Only do this if "CONNECTING", else crash
stop_sounds()

So there are a few minor issues but basic functionality works. I can call to and from the usb phone :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant