telephone 0.0.1 copy "telephone: ^0.0.1" to clipboard
telephone: ^0.0.1 copied to clipboard

`telephone` offers a simplified wrapper around `sip_ua` for Flutter, facilitating seamless integration of SIP-based VoIP capabilities with customizable widgets for handling call interfaces and states [...]

Telephone #

Simplifies SIP-based VoIP integration by wrapping the sip_ua framework, enabling easier management of calls and customization of UI elements for seamless communication.

Installation #

Install via flutter pub:

flutter pub add telephone

Usage #

Wrap your app in Telephone, connect to a SIP endpoint and call:

import 'package:example/config.dart';
import 'package:flutter/material.dart';
import 'package:telephone/telephone.dart';

void main() {
  runApp(
    const MaterialApp(
      debugShowCheckedModeBanner: false,

      // 1. Wrap with Telephone
      home: Telephone(
        child: TelephoneExample(),
      ),
    ),
  );
}

class TelephoneExample extends StatefulWidget {
  const TelephoneExample({super.key});

  @override
  State<TelephoneExample> createState() => _TelephoneExampleState();
}

class _TelephoneExampleState extends State<TelephoneExample>
    implements SipServiceListener {
  TelephoneState get telephone => Telephone.of(context);

  @override
  void initState() {
    super.initState();

    // 2. Connect to the sip endpoint
    telephone.connect(
      endpoint: kSipEndpoint,
      account: kSipAccount,
    );

    telephone.addSipServiceListener(this);
  }

  @override
  void dispose() {
    telephone.removeSipServiceListener(this);
    telephone.disconnect();
    super.dispose();
  }

  @override
  void registrationStateChanged(RegistrationState state) {
    setState(() {});
  }

  @override
  void callStateChanged(Call call, CallState state) {}

  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(
          actions: [
            Padding(
              padding: const EdgeInsets.only(right: 16),
              child: IconButton(
                icon: const Icon(Icons.phone_outlined),

                // 3. Call
                onPressed:
                    telephone.registered ? () => telephone.call('400') : null,
              ),
            )
          ],
        ),
        body: const Center(
          child: Text('Hello Telephone!'),
        ),
      );
}

License #

This project is licensed under the MIT License - see the LICENSE file for details.

1
likes
120
points
45
downloads

Publisher

verified publisherigorkurilenko.dev

Weekly Downloads

`telephone` offers a simplified wrapper around `sip_ua` for Flutter, facilitating seamless integration of SIP-based VoIP capabilities with customizable widgets for handling call interfaces and states efficiently.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_webrtc, logger, package_info_plus, permission_handler, sip_ua, toastification

More

Packages that depend on telephone