Skip to main content

pytgvoip_pyrogram

PyPI

Sample usage of PytgVoIP library with Pyrogram

# making outgoing calls
from pyrogram import Client
from tgvoip_pyrogram import VoIPFileStreamService

app = Client('account')
app.start()

service = VoIPFileStreamService(app, receive_calls=False)
call = service.start_call('@bakatrouble')
call.play('input.raw')
call.play_on_hold(['input.raw'])
call.set_output_file('output.raw')

@call.on_call_ended
def call_ended(call):
    app.stop()
# accepting incoming calls
from pyrogram import Client
from tgvoip_pyrogram import VoIPFileStreamService, VoIPIncomingFileStreamCall

app = Client('account')
app.start()

service = VoIPFileStreamService(app)

@service.on_incoming_call
def handle_call(call: VoIPIncomingFileStreamCall):
    call.accept()
    call.play('input.raw')
    call.play_on_hold(['input.raw'])
    call.set_output_file('output.raw')
    
    # you can use `call.on_call_ended(lambda _: app.stop())` here instead
    @call.on_call_ended
    def call_ended(call):
        app.stop()

More examples

Requirements

  • Python 3.5 or higher
  • PytgVoIP (listed as dependency)
  • Pyrogram (listed as dependency)

Installing

pip3 install pytgvoip-pyrogram

Encoding audio streams

Streams consumed by libtgvoip should be encoded in 16-bit signed PCM audio.

$ ffmpeg -i input.mp3 -f s16le -ac 1 -ar 48000 -acodec pcm_s16le input.raw  # encode
$ ffmpeg -f s16le -ac 1 -ar 48000 -acodec pcm_s16le -i output.raw output.mp3  # decode

❤️ Donate

If this project helps you, consider buying me a coffee:
PayPal.

..and yes... 😊 the paypal account is correct. Thank you so much!


📜 License

MIT

Metadata

Release files for stefano-pytgvoip-pyrogram 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stefano-pytgvoip-pyrogram 0.1.0
File Size Uploaded Provenance Actions
stefano_pytgvoip_pyrogram-0.1.0.tar.gz 21.8 kB Without provenance Details for stefano_pytgvoip_pyrogram-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stefano-pytgvoip-pyrogram 0.1.0
File Interpreter ABI Platform Actions
stefano_pytgvoip_pyrogram-0.1.0-py3-none-any.whl Python 3 none any Details for stefano_pytgvoip_pyrogram-0.1.0-py3-none-any.whl

Total release size: 50.7 kB

Release files / stefano_pytgvoip_pyrogram-0.1.0.tar.gz

Download URL stefano_pytgvoip_pyrogram-0.1.0.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
aab9d4247408560a02928708f5465ade43fefa5134a975d75d95b08c40ce9b44
BLAKE2b-256 checksum
How to use checksums
63d919eceec3bc37e8a227407b8ac1e069d97fb4ffa5f388609c14ecdde49aaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / stefano_pytgvoip_pyrogram-0.1.0-py3-none-any.whl

Download URL stefano_pytgvoip_pyrogram-0.1.0-py3-none-any.whl
Size 28.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7182772f0f824a50a08838cdcb5027a1f2ae0879d7bb0187c4ce3604c4107c59
BLAKE2b-256 checksum
How to use checksums
f1862fa7c97e67fee9f3c31095d7c0e6e2b990f3aec899ad17db9637b22322ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for stefano-pytgvoip-pyrogram 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page