1.1.26 • Published 6 months ago

@voicenter-team/vsip-next v1.1.26

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

title: Getting started description: This library is a wrapper over the opensips-js implementation. navigation:

title: Getting Started

Getting started

Description

This library is a wrapper over the opensips-js implementation. It provides a Vue 3 composable for reactive work with opensips-js functionality. Call useVsipProvide on the top level of Vue components and then use useVsipInject in the child components to use reactive opensips-js functionality.

Basic Usage

ProviderWrapper.vue

<template>
  <div ref="wrapper">
    <VSipPhone v-if="state.isInitialized" />
    <div v-else>Not initialized</div>
  </div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { useVsipProvide } from '@voicenter-team/vsip-next'
import VSipPhone from '@/VSipPhone.vue'

const { actions, state } = useVsipProvide()
actions.init('wss07.voicenter.co', '', '')
</script>

VSipPhone.vue

<template>
    ...
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { useVsipInject } from '@/index'

const { state, actions } = useVsipInject()
const {
  selectedInputDevice,
  selectedOutputDevice,
  muteWhenJoin,
  isDND,
  addCallToCurrentRoom,
  microphoneInputLevel,
  speakerVolume,
  isMuted,
  callAddingInProgress,
  activeCalls,
  callsInActiveRoom,
  currentActiveRoomId,
  activeRooms
} = state

const {
  initCall,
  sendDTMF,
  muteCaller,
  unmuteCaller,
  terminateCall,
  transferCall,
  mergeCall,
  holdCall,
  unholdCall,
  answerCall,
  moveCall,
  mute,
  unmute
} = actions

/* Other code */
</script>

Composable

State

NameDescriptionTypeDefault
isInitializedDefines if opensips-js is initializedbooleanfalse
activeCallsActive calls{ key: string: ICall }{}
callsInActiveRoomCalls in active roomArray\[]
activeMessagesActive MSRP messages{ key: string: IMessage }{}
addCallToCurrentRoomDefines if new call should be added to current roombooleanfalse
callAddingInProgressRepresents call id of progressing call if such call existsstring / undefinedundefined
activeRoomsActive rooms{ key: number: IRoom }{}
msrpHistoryMSRP messages history{ key: string: Array\ }{}
availableMediaDevicesList of available media devicesArray\[]
inputMediaDeviceListList of available input media devicesArray\[]
outputMediaDeviceListList of available output media devicesArray\[]
selectedOutputDeviceID of selected output devicestring'default'
selectedInputDeviceID of selected input devicestring'default'
muteWhenJoinDefines if agent will be muted when joining callbooleanfalse
isDNDDefines usage agent's 'Do Not Disturb' optionbooleanfalse
originalStreamAgent's Audio Stream objectMediaStream / nullnull
currentActiveRoomIdDefines agent's active roomnumber / undefinedundefined
callStatusCalls' statuses{ key: string: ICallStatus }{}
callTimeCalls' times{ key: string: ITimeData }{}
callMetricsCalls' metrics{ key: string: unknown }{}
autoAnswerDefines if auto-answer is enabledbooleanfalse
microphoneInputLevelMicrophone sensitivity (range is from 0 to 2)number2
speakerVolumeSpeaker volume (range is from 0 to 1)number1

Methods

NameInterfaceDescription
init(domain: string, username: string, password: string): voidInitialize opensips-js
initCall(target: string, addToCurrentRoom: boolean, holdOtherCalls: boolean) => voidMake a call
answerCall(callId: string) => voidAnswer call
terminateCall(callId: string) => voidHangup call
muteCaller(callId: string) => voidMute caller
unmuteCaller(callId: string) => voidUnmute caller
mute() => voidMute ourself
unmute() => voidUnmute ourself
transferCall(callId: string, target: string) => voidTransfer call
mergeCall(roomId: number) => voidMerge calls in room (works only when 2 call in room)
mergeCallByIds(firstCallId: string, secondCallId: string) => voidMerge calls by their ids
holdCall(callId: string, automatic?: boolean) => voidHold a call
unholdCall(callId: string) => voidUnhold a call
moveCall(callId: string, roomId: number) => Promise\Move call to another room
setMicrophone(deviceId: string) => Promise\Set microphone which to use
setSpeaker(deviceId: string) => Promise\Set speaker which to use
sendDTMF(callId: string, value: string) => voidSend DTMF
setActiveRoom(roomId: number / undefined) => Promise\Set current active room
setMicrophoneSensitivity(value: number) => voidSet microphone sensitivity. Value should be in range from 0 to 1
setSpeakerVolume(value: number) => voidSet speaker volume. Value should be in range from 0 to 1
setAutoAnswer(value: boolean) => voidSet auto-answer
setDND(state: boolean) => voidSet 'Do not Disturb' option
msrpAnswer(callId: string) => voidAnswer MSRP invite
messageTerminate(callId: string) => voidTerminate MSRP session
sendMSRP(msrpSessionId: string, body: string) => voidSend MSRP message
initMSRP(target: string, body: string, options: object) => voidSend MSRP invite
1.1.26

6 months ago

1.1.25

6 months ago

1.1.23

7 months ago

1.1.24

7 months ago

1.1.22

12 months ago

1.1.21

12 months ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

2 years ago