Skip to content

Commit 4103de5

Browse files
committed
chore(readme): add pip installation option
1 parent 8fd773e commit 4103de5

1 file changed

Lines changed: 36 additions & 48 deletions

File tree

README.md

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,42 @@
1515
<th style="text-align: left; padding: 10px 0;">Description</th>
1616
</tr>
1717
<tr>
18-
<td style="padding: 10px; background-color: #f6f8fa; font-weight: bold;">
18+
<td style="padding: 10px; font-weight: bold;">
1919
Complete SIP Account Management
2020
</td>
21-
<td style="padding: 10px; background-color: #f6f8fa; border-radius: 0 6px 6px 0;">
21+
<td style="padding: 10px; border-radius: 0 6px 6px 0;">
2222
Easily create, register, and manage SIP accounts.
2323
</td>
2424
</tr>
2525
<tr>
26-
<td style="padding: 10px; background-color: #f6f8fa; font-weight: bold;">
26+
<td style="padding: 10px; font-weight: bold;">
2727
Custom Call Flows
2828
</td>
29-
<td style="padding: 10px; background-color: #f6f8fa; border-radius: 0 6px 6px 0;">
29+
<td style="padding: 10px; border-radius: 0 6px 6px 0;">
3030
Write scripts to automate call flows with your own business logic.
3131
</td>
3232
</tr>
3333
<tr>
34-
<td style="padding: 10px; background-color: #f6f8fa; font-weight: bold;">
34+
<td style="padding: 10px; font-weight: bold;">
3535
UDP Transport Layer
3636
</td>
37-
<td style="padding: 10px; background-color: #f6f8fa; border-radius: 0 6px 6px 0;">
37+
<td style="padding: 10px; border-radius: 0 6px 6px 0;">
3838
Asynchronous, efficient UDP transport for sending and receiving SIP messages.
3939
</td>
4040
</tr>
4141
<tr>
42-
<td style="padding: 10px; background-color: #f6f8fa; font-weight: bold;">
42+
<td style="padding: 10px; font-weight: bold;">
4343
Flexible Call Handling
4444
</td>
45-
<td style="padding: 10px; background-color: #f6f8fa; border-radius: 0 6px 6px 0;">
45+
<td style="padding: 10px; border-radius: 0 6px 6px 0;">
4646
Handle incoming and outgoing SIP calls, play messages, and gather user input.
4747
</td>
4848
</tr>
4949
<tr>
50-
<td style="padding: 10px; background-color: #f6f8fa; font-weight: bold;">
50+
<td style="padding: 10px; font-weight: bold;">
5151
Fully Extensible
5252
</td>
53-
<td style="padding: 10px; background-color: #f6f8fa; border-radius: 0 6px 6px 0;">
53+
<td style="padding: 10px; border-radius: 0 6px 6px 0;">
5454
Includes an example bot for appointment booking, but you can easily write any SIP-based automation you need.
5555
</td>
5656
</tr>
@@ -73,42 +73,40 @@
7373

7474
## 🚀 **Installation**
7575

76-
<div style="background-color: #f6f8fa; border-radius: 6px; padding: 16px;">
76+
### Option 1: Install from PyPI
7777

78-
### Step 1: Clone the repository
78+
You can install PySIP directly from PyPI using pip:
7979

8080
```bash
81-
git clone https://github.com/moha-abdi/PySIP.git
82-
cd PySIP
81+
pip install PySIPio
8382
```
8483

85-
### Step 2: Install dependencies
84+
> [!CAUTION]
85+
> Note that the package name on PyPI is `PySIPio` and not `PySIP`
8686
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
8890

8991
```bash
90-
pip install -r requirements.txt
92+
git clone https://github.com/moha-abdi/PySIP.git
93+
cd PySIP
9194
```
9295

93-
### Step 3: Environment Setup
96+
#### Step 2: Install dependencies
9497

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:
9699

97100
```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
101102
```
102103

103-
</div>
104-
105104
---
106105

107106
## 📁 **Project Structure**
108107

109108
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:
110109

111-
<div style="background-color: #f6f8fa; border-radius: 6px; padding: 16px;">
112110

113111
```
114112
PySIP/
@@ -127,15 +125,21 @@ PySIP/
127125
└── README.md # Project documentation
128126
```
129127

130-
</div>
131-
132128
---
133129

134130
## 🏁 **Getting Started**
135131

136-
<div style="background-color: #f6f8fa; border-radius: 6px; padding: 16px;">
132+
### Step 1: Environment Setup
133+
134+
Create a `.env` file in your working directory to store your SIP account credentials and server details:
137135

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
139143

140144
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:
141145

@@ -154,7 +158,7 @@ account = SipAccount(
154158
)
155159
```
156160

157-
### Step 2: Registering the Account
161+
### Step 3: Registering the Account
158162

159163
Once the `SipAccount` is created, the next step is to register it with the SIP server:
160164

@@ -164,16 +168,12 @@ await account.register()
164168

165169
This sends a SIP `REGISTER` request to the server to activate the account. Once registered, you can make calls or listen for incoming calls.
166170

167-
</div>
168-
169171
---
170172

171173
## 📘 **Detailed Usage**
172174

173175
### SIP Account
174176

175-
<div style="background-color: #f6f8fa; border-radius: 6px; padding: 16px;">
176-
177177
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.
178178

179179
#### **Instantiating a SIP Account**:
@@ -218,12 +218,8 @@ When you're done, unregister the account to gracefully close the session:
218218
await account.unregister()
219219
```
220220

221-
</div>
222-
223221
### Call Handling
224222

225-
<div style="background-color: #f6f8fa; border-radius: 6px; padding: 16px;">
226-
227223
The `CallHandler` is responsible for handling the call flow. It allows you to say messages, gather input from the caller, or transfer the call.
228224

229225
#### **Playing a message to the caller**:
@@ -258,11 +254,8 @@ await call.reject() # Reject the incoming call
258254
await call.busy() # Mark the line as busy for the incoming call
259255
```
260256

261-
</div>
262-
263257
### UDP Transport
264258

265-
<div style="background-color: #f6f8fa; border-radius: 6px; padding: 16px;">
266259

267260
The `UdpHandler` is an internal module that manages the asynchronous sending and receiving of SIP messages over the network.
268261

@@ -282,15 +275,13 @@ The `datagram_received()` method handles incoming messages, placing them in a qu
282275
self.data_q.put_nowait(data)
283276
```
284277

285-
</div>
286278

287279
---
288280

289281
## 🔍 **Example Script**
290282

291283
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.
292284

293-
<div style="background-color: #f6f8fa; border-radius: 6px; padding: 16px;">
294285

295286
```python
296287
import asyncio
@@ -311,7 +302,7 @@ account = SipAccount(
311302

312303
@account.on_incoming_call
313304
async def handle_incoming_call(call: SipCall):
314-
await call.accept()
305+
await call.accept()
315306
await call.call_handler.say("We have received your call successfully")
316307

317308
async def main():
@@ -333,7 +324,6 @@ if __name__ == "__main__":
333324
asyncio.run(main())
334325
```
335326

336-
</div>
337327

338328
---
339329

@@ -355,6 +345,4 @@ Contributions are welcome! If you would like to contribute to the development of
355345

356346
---
357347

358-
<div style="text-align: center; align: center; margin-top: 30px;" align="center">
359-
<p align="center">Made with ❤️ by Moha Abdi</p>
360-
</div>
348+
<p align="center">Made with ❤️ by Moha Abdi</p>

0 commit comments

Comments
 (0)