Wisdom tooth online debugging page

www.sobot.com/paas/callCe…

SDK access and basic wisdom tooth service: third-party connection plug-in for wisdom tooth call center

Access the SDK in index.html

<script src="https://www.sobot.com/paas/callCenterClient/plugin/jquery.min.js"></script>
<script src="https://www.sobot.com/paas/callCenterClient/plugin/jquery.json-2.4.min.js"></script>
<script src="https://www.sobot.com/paas/callCenterClient/plugin/verto-min.js"></script>
<script src="https://www.sobot.com/paas/callCenterClient/plugin/callCenter.js"></script>
Copy the code

Outbound function encapsulation

/* * @description: Wisdom tooth external call system package */export default class CallService {
  constructor (params) {
    this.config = {
      client_id: '3a1f02866f3*****3',
      client_secret: '227ee***5174',
      companyId: 'c69b**255',
      appId: '3a1f02866f**c3',
      callWay: '2',
      agentId: null,
      groupId: null,
      voipAccount: null,
      displayNumber: null
      // agentId: 'e60a64fb16**7223',
      // groupId: 'c69b7d53**0fd710db6255_4',
      // voipAccount: '137530001'} this.config = Object.assign(this.config, Params)} / / wisdom teeth - initialization parameter ininServ (cb) {const params = this. Config window. ZcVertoServ. IninServ (params, Cb | | null)} / / wisdom teeth - access token getToken (cb) {window. ZcVertoServ. GetToken (cb)} / / wisdom teeth - customer service login agentLogin (cb) {const params = { displayNumber:'* * * 17188 * 623',
      isRecordStereo: false, // agentState: indicates the status of the agent after work. 0- Indicates that the agent is busy after work. If it is not transmitted, it is idle after work by default; AgentState: 0} window. ZcVertoServ. AgentLogin (params, cb | | null)} / / the exit of the serviceagentLoginout() {window. ZcVertoServ. AgentLoginout ((res) = > {the console. The log (res)})} / / wisdom teeth - the outside of the service call agentCallOut (destinationNumber) { const params = { displayNumber: this.displayNumber ||'17188339623', destinationNumber: DestinationNumber} window. ZcVertoServ. AgentCallOut (params, res = > {the console. The log (res)})} / / wisdom teeth system initializationinitialization () {
    this.ininServ((res) => {
      // console.log('ininServ', res)
    })
    setTimeout(() => {
      this.getToken((res) => {
        // console.log('getToken', res)
      })
    }, 2000)
    // this.agentLoginout()
    setTimeout(() => {
      this.agentLoginout()
    }, 3000)
    setTimeout(() => {
      this.agentLogin((res) => {
        console.log('agentLogin', res)
      })
    }, 6000)
  }
}

Copy the code

Business logic call

Const callService = new callService () // Wisdom tooth service initializes this.$eventBus.$on('call-init'., event = > {/ / the event data callService. Initialization ()}) / / wisdom teeth service this dial.$eventBus.$on('call-dial', event => {callService.agentCallout ()}) // Wisdom tooth service - Log out of this.$eventBus.$on('call-logout', event => {
callService.agentCallOut()
})
Copy the code

Cross-domain forwarding Comm

Webpack devserver configuration

proxyTable: {
      '/comm': {
        target: 'https://www.sobot.com/'// changeOrigin:true, // Cross-domain pathRewrite: {'^/comm': '/comm'// override interface}, ws:true}}Copy the code

Nginx Comm forwarding configuration for wisdom teeth

location /comm/ {
        proxy_pass http://www.sobot.com;
        proxy_set_header Host 'www.sobot.com';
}
Copy the code