Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 1.25 KB

README.md

File metadata and controls

60 lines (46 loc) · 1.25 KB

react-sip-phone

SIP phone component for use in react projects

NPM JavaScript Style Guide

Install

npm install --save react-sip-phone

Usage

import React, { Component } from 'react'

import { ReactSipPhone } from 'react-sip-phone'
import 'react-sip-phone/dist/index.css'

class Example extends Component {
  render() {
    return <ReactSipPhone
        name={name}
        sipCredentials={{
          sipuri: sipuri,
          password: password
        }}
        sipConfig={{
          websocket: websocket,
          defaultCountryCode: '1'
        }}
        width={400}
      />
  }
}

To make calls from outside of the component, import the phone's store and access the SIP Account once it is registered

import { ReactSipPhone, phoneStore } from 'react-sip-phone'
class MyApp extends Component {

  makeCall(number) {
    const sipAccount = phoneStore.getState().sipAccounts.sipAccount
    if (sipAccount && number) {
      sipAccount.makeCall(number)
    }
  }

  render() {
    return <ReactSipPhone ... />
  }
}

License

MIT