npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

web-rtc-phone

v1.0.6

Published

![image](./public/example1.png)

Downloads

12

Readme

软电话组件 API

组件展示

image

掘金地址

掘金地址

webPhoneV3 - Antd3 版本

import webPhone from 'web-rtc-phone'
import React,{useRef,useEffect} from 'react'
import {
  Row,
  Col,
  Popover,
  Form,
  Input,
  Button,
  message,
  Table,
  Collapse,
  Switch,
  Radio,
  Tooltip,
  Badge,
  Icon,
} from 'antd';
const AntdNode = {
  Row,
  Col,
  Popover,
  Form,
  Input,
  Button,
  message,
  Table,
  Icon,
  Collapse,
  Switch,
  Radio,
  Tooltip,
  Badge,
};
const TestWebPhoneV3Com = ({ form }) => {
  const webPhoneRef = useRef();
    const config = {}
  useEffect(()=>{
      if(webPhoneRef.current){
       webPhoneRef.current?.login(config)
      }
    },[webPhoneRef.current])
  return (
    <div style={{ backgroundColor: '#f6f6f6' }}>
      <WebPhone
        ref={webPhoneRef}
        AntdNode={AntdNode}
        form={form}
        version="V3"
        debugPrivilege={true}
      />
    </div>
  );
};
const TestWebPhoneV3 = Form.create()(TestWebPhoneV3Com);
export default TestWebPhoneV3;

API

| 方法、属性 | 描述 | 类型 | 默认值 | | :------------- | :------------------------------------------------------------- | :-------- | :----- | | form | 经 Form.create() 包装过的组件会自带 this.props.form 属性(必传) | | | ref | ref = useRef() ref 暴露的方法 | ref | | | AntdNode | AntdNode 的 V3 | antd | | | version | antd 的版本(必传) | string | V3 | | debugPrivilege | 调试按钮权限 | boolean | false |

webPhoneV4-Antd4 版本

import webPhone from 'web-rtc-phone'
import React,{useRef,useEffect} from 'react'
import {
  Row,
  Col,
  Popover,
  Form,
  Input,
  Button,
  message,
  Table,
  Collapse,
  Switch,
  Radio,
  Tooltip,
  Badge,
  Icon,
} from 'antd';
import Icon from '@ant-design/icons';
const AntdNode = {
  Row,
  Col,
  Popover,
  Form,
  Input,
  Button,
  message,
  Table,
  Icon,
  Collapse,
  Switch,
  Radio,
  Tooltip,
  Badge,
};
  const TestWebPhoneV4 = () => {
  const webPhoneRef = useRef();
  const [form] = Form.useForm();
  const config = {}
  useEffect(()=>{
      if(webPhoneRef.current){
       webPhoneRef.current?.login(config)
      }
    },[webPhoneRef.current])
  return (
    <div style={{ backgroundColor: '#f6f6f6' }}>
      <WebPhone
        ref={webPhoneRef}
        AntdNode={AntdNode}
        form={form}
        version="V4"
        debugPrivilege={true}
      />
    </div>
  );
};
export default TestWebPhoneV4;

API

| 方法、属性 | 描述 | 类型 | 默认值 | | :------------- | :--------------------------------------------------------------- | :-------- | :----- | | form | 经 Form.useForm() 创建的 form 控制实例,不提供时会自动创建(必传) | | | | ref | ref = useRef() ref 暴露的方法 | ref | | | AntdNode | AntdNode 的 V4 | antd | | | version | antd 的版本(必传) | string | V4 | | debugPrivilege | 调试按钮权限 | boolean | false |

ref 暴露的方法
login:(values)=> void //登录
getPhoneNumber: () => phoneNumber, // 拨打号码
getConfigInfo: () => configInfo, // 配置信息
getSipCall: () => sipClientRef.current, // SipCall实例
sipCallEvent, // 电话状态回调

| 方法、属性 | 描述 | 默认值 | | :----------------------------------- | :------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------ | | login (登录) | (values)=> void | values:{ host,port,extNo,extPwd }login 的参数 | | getPhoneNumber (获取拨打号码) | () => phoneNumber | | | getConfigInfo (获取配置信息) | () => configInfo | configInfo:{ host,port,extNo,extPwd }login 的参数 | | getSipCall (获取 SipCall 实例) | () => sipClientRef.current | | | sipCallEvent(sipCall 的 events 事件) | sipCallEvent?.addListener('phoneStatus', (phoneStatus) => {console.log('phoneStatus', phoneStatus) }); | |

login 的参数
  host, // 服务器地址
  port, // 服务器端口
  extNo, // 分机号
  extPwd; // 密码

//例如:
const wsServer = `[ws || wss]://${host}:port`
this.socket = new jssip.WebSocketInterface(wsServer);
new jssip.UA({
   sockets: [this.socket],
    uri: 'sip:' + extNo + '@'+ host,
    password: extPwd,
    //...
})

AntdNode 的 V3

import {
  Button,
  Col,
  Row,
  Popover,
  Form,
  Input,
  Table,
  Icon,
  Badge,
  Tooltip,
  message,
  Collapse,
  Switch,
  Radio,
} from 'antd';
const AntdNode = {
  Row,
  Col,
  Popover,
  Form,
  Input,
  Button,
  message,
  Table,
  Icon,
  Collapse,
  Switch,
  Radio,
  Tooltip,
  Badge,
};

AntdNode 的 V4

import {
  Button,
  Col,
  Row,
  Popover,
  Form,
  Input,
  Table,
  Badge,
  Tooltip,
  message,
  Collapse,
  Switch,
  Radio,
} from 'antd';
import Icon from '@ant-design/icons';
const AntdNode = {
  Row,
  Col,
  Popover,
  Form,
  Input,
  Button,
  message,
  Table,
  Icon,
  Collapse,
  Switch,
  Radio,
  Tooltip,
  Badge,
};