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 [...]

example/lib/main.dart

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!'),
        ),
      );
}
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