Skip to content

CALLHANDLER STUCK #43

@emnity901

Description

@emnity901

image

my code gets stuck there everytime , the phone becomes online but wont call

import asyncio
from PySIP.sip_account import SipAccount , SipCall
from dotenv import load_dotenv
import os

Load environment variables

load_dotenv()

Initialize SIP account with credentials from .env file

account = SipAccount(
os.environ["SIP_USERNAME"],
os.environ["SIP_PASSWORD"],
os.environ["SIP_SERVER"],
)

@account.on_incoming_call
async def handle_incoming_call(call: SipCall):
await call.accept()
await call.call_handler.say("We have received your call successfully")

async def main():
# Register the SIP account
await account.register()

# Make a call to a test number (e.g., '111')
call = account.make_call("111")
call_task = asyncio.create_task(call.start())

# Wait for the call to complete, then unregister
await call_task
await account.unregister()

if name == "main":
asyncio.run(main())

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions