You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can install PySIP directly from PyPI using pip:
79
79
80
80
```bash
81
-
git clone https://github.com/moha-abdi/PySIP.git
82
-
cd PySIP
81
+
pip install PySIPio
83
82
```
84
83
85
-
### Step 2: Install dependencies
84
+
> [!CAUTION]
85
+
> Note that the package name on PyPI is `PySIPio` and not `PySIP`
86
86
87
-
Ensure you have Python 3.8+ installed. Install the required dependencies using:
87
+
### Option 2: Install from source
88
+
89
+
#### Step 1: Clone the repository
88
90
89
91
```bash
90
-
pip install -r requirements.txt
92
+
git clone https://github.com/moha-abdi/PySIP.git
93
+
cd PySIP
91
94
```
92
95
93
-
### Step 3: Environment Setup
96
+
####Step 2: Install dependencies
94
97
95
-
Create a `.env` file to store your SIP account credentials and server details:
98
+
Ensure you have Python 3.8+ installed. Install the required dependencies using:
96
99
97
100
```bash
98
-
SIP_USERNAME=your_sip_username
99
-
SIP_PASSWORD=your_sip_password
100
-
SIP_SERVER=your_sip_server
101
+
pip install -r requirements.txt
101
102
```
102
103
103
-
</div>
104
-
105
104
---
106
105
107
106
## 📁 **Project Structure**
108
107
109
108
The project is structured to provide a clean separation between the core SIP library and any custom scripts you want to write. Here's an overview of the project layout:
Create a `.env` file in your working directory to store your SIP account credentials and server details:
137
135
138
-
### Step 1: Setting Up a SIP Account
136
+
```bash
137
+
SIP_USERNAME=your_sip_username
138
+
SIP_PASSWORD=your_sip_password
139
+
SIP_SERVER=your_sip_server
140
+
```
141
+
142
+
### Step 2: Setting Up a SIP Account
139
143
140
144
A SIP account is essential for handling calls. To start, you need to create an instance of the `SipAccount` class, which requires your SIP credentials (username, password, and server). Here's how to do it:
141
145
@@ -154,7 +158,7 @@ account = SipAccount(
154
158
)
155
159
```
156
160
157
-
### Step 2: Registering the Account
161
+
### Step 3: Registering the Account
158
162
159
163
Once the `SipAccount` is created, the next step is to register it with the SIP server:
160
164
@@ -164,16 +168,12 @@ await account.register()
164
168
165
169
This sends a SIP `REGISTER` request to the server to activate the account. Once registered, you can make calls or listen for incoming calls.
The `SipAccount` class is at the core of PySIP. It handles all account-related tasks such as registration, making calls, and unregistering from the SIP server.
178
178
179
179
#### **Instantiating a SIP Account**:
@@ -218,12 +218,8 @@ When you're done, unregister the account to gracefully close the session:
The `UdpHandler` is an internal module that manages the asynchronous sending and receiving of SIP messages over the network.
268
261
@@ -282,15 +275,13 @@ The `datagram_received()` method handles incoming messages, placing them in a qu
282
275
self.data_q.put_nowait(data)
283
276
```
284
277
285
-
</div>
286
278
287
279
---
288
280
289
281
## 🔍 **Example Script**
290
282
291
283
To demonstrate PySIP in action, we've provided a basic example of an appointment booking bot. This bot allows callers to book appointments via a phone call.
0 commit comments