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

After dialing the phone, if I connect, it will automatically hang up #44

Open
true0 opened this issue Dec 17, 2024 · 0 comments
Open

After dialing the phone, if I connect, it will automatically hang up #44

true0 opened this issue Dec 17, 2024 · 0 comments

Comments

@true0
Copy link

true0 commented Dec 17, 2024

2024-12-17 15:06:31,354 - PySIP.utils.logger - INFO - Detecting connection type (UDP/TCP/TLS). This might take some time...
2024-12-17 15:07:35,159 - PySIP.utils.logger - INFO - Connection type detected: UDP
2024-12-17 15:07:35,787 - PySIP.utils.logger - INFO - Sip Account: 1776008 registered to the server.
2024-12-17 15:07:36,416 - PySIP.utils.logger - INFO - CallHandler has been initialized..
2024-12-17 15:07:38,926 - PySIP.utils.logger - CRITICAL - No remote session info defined
2024-12-17 15:07:38,926 - PySIP.utils.logger - INFO - The call has ben stopped
2024-12-17 15:07:38,927 - PySIP.utils.logger - INFO - Call hanged up due to: Normal Stop
2024-12-17 15:07:48,126 - PySIP.utils.logger - WARNING - The call was already TERMINATED. stop call invoked more than once.
This is my code:

import asyncio
import time

from PySIP.sip_account import SipAccount
from PySIP.sip_call import SipCall

# Initialize SIP account with credentials from .env file
account = SipAccount(
    "username",
    "passwrod",
    "host:port"
)


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


async def main():
    # Register the SIP account
    await account.register()
    # Make a call to a test number (e.g., '111')
    call = account.make_call("6000")
    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())

The handle_incoming-call method was not triggered

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