Metadata-Version: 2.4
Name: baresipy
Version: 0.1.5
Summary: python baresip wrapper
Author-email: JarbasAI <jarbasai@mailfence.com>
License: MIT
Project-URL: Homepage, https://github.com/TigreGotico/baresipy
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: ResponsiveVoice
Requires-Dist: opentone>=0.1.2
Requires-Dist: pydub
Requires-Dist: audioop-lts; python_version >= "3.13"
Requires-Dist: pexpect
Requires-Dist: json_database>=0.1.2
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Dynamic: license-file

# Baresipy

A python wrapper around [baresip](https://github.com/alfredh/baresip)

Make voip calls/bots from python!

![](./logo.png)

# install

```bash
sudo apt-get install baresip
sudo apt-get install ffmpeg
pip install baresipy
```

# usage

scripted calls

```python
from baresipy import BareSIP
from time import sleep

to = "jarbas_laptop@sipx.mattkeys.net"

gateway = "sipx.xxxxx.net"
user = "xxxxx"
pswd = "xxxxxx"

b = BareSIP(user, pswd, gateway)

b.call(to)

while b.running:
    sleep(0.5)
    if b.call_established:
        b.send_dtmf("123")
        b.speak("this is jarbas personal assistant speaking. this was a test")
        b.speak("Goodbye")
        b.hang()
        b.quit()

```


handling events

```python
from baresipy import BareSIP
from time import sleep
from pyjokes import get_joke


class JokeBOT(BareSIP):
    def handle_incoming_call(self, number):
        self.accept_call()

    def handle_call_established(self):
        self.speak("Welcome to the jokes bot")
        self.speak(get_joke())
        self.speak("Goodbye")
        self.hang()


gateway = "sipx.xxxxx.net"
user = "xxxxxx"
pswd = "xxxx"

b = JokeBOT(user, pswd, gateway)

while b.running:
    sleep(1)

```

        
# Credits

This work as been sponsored by Matt Keys, [eZuce Inc](https://ezuce.com/)
