Skip to content
This repository was archived by the owner on Nov 13, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/components/SipProvider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class SipProvider extends React.Component<
host: string;
port: number;
pathname: string;
secure: boolean;
user: string;
password: string;
autoRegister: boolean;
Expand Down Expand Up @@ -73,6 +74,7 @@ export default class SipProvider extends React.Component<
host: PropTypes.string,
port: PropTypes.number,
pathname: PropTypes.string,
secure: PropTypes.bool,
user: PropTypes.string,
password: PropTypes.string,
autoRegister: PropTypes.bool,
Expand All @@ -90,6 +92,7 @@ export default class SipProvider extends React.Component<
host: null,
port: null,
pathname: "",
secure: true,
user: null,
password: null,
autoRegister: true,
Expand Down Expand Up @@ -172,6 +175,7 @@ export default class SipProvider extends React.Component<
this.props.host !== prevProps.host ||
this.props.port !== prevProps.port ||
this.props.pathname !== prevProps.pathname ||
this.props.secure !== prevProps.secure ||
this.props.user !== prevProps.user ||
this.props.password !== prevProps.password ||
this.props.autoRegister !== prevProps.autoRegister
Expand Down Expand Up @@ -309,7 +313,15 @@ export default class SipProvider extends React.Component<
this.ua = null;
}

const { host, port, pathname, user, password, autoRegister } = this.props;
const {
host,
port,
pathname,
secure,
user,
password,
autoRegister,
} = this.props;

if (!host || !port || !user) {
this.setState({
Expand All @@ -322,7 +334,7 @@ export default class SipProvider extends React.Component<

try {
const socket = new JsSIP.WebSocketInterface(
`wss://${host}:${port}${pathname}`,
`${secure ? "wss" : "ws"}://${host}:${port}${pathname}`,
);
this.ua = new JsSIP.UA({
uri: `sip:${user}@${host}`,
Expand Down
4 changes: 4 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export interface Sip {

host?: string;
port?: number;
pathname?: string;
secure?: boolean;
user?: string;
password?: string;
autoRegister?: boolean;
Expand All @@ -41,6 +43,8 @@ export const sipPropType = PropTypes.shape({

host: PropTypes.string,
port: PropTypes.number,
pathname: PropTypes.string,
secure: PropTypes.bool,
user: PropTypes.string,
password: PropTypes.string,
autoRegister: PropTypes.bool,
Expand Down