Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

would be nice if createXXX generated dialoginfo events #99

Closed
davehorton opened this issue Dec 8, 2020 · 1 comment
Closed

would be nice if createXXX generated dialoginfo events #99

davehorton opened this issue Dec 8, 2020 · 1 comment
Assignees

Comments

@davehorton
Copy link
Collaborator

It would make integration with the Dialog Event Package quite easy if srf.createB2BUA (and createUAS and createUAC) somehow generated events corresponding to the dialog state machine.

An application that wanted to send NOTIFY's to subscribed devices could then just hook into these events.

@davehorton
Copy link
Collaborator Author

this feature was added in 4.4.44. The various srf.createXXX functions now now take an opts.dialogStateEmitter argument which, as its name suggests, should be an EventEmitter. If provided, that object will emit a 'stateChange' event with an object containing properties.

class StateEmitter extends Emitter {
  constructor() {
    super();
  }

  this.on('stateChange', (evt) => {  
    const {id, localTag, remoteTag, aor, direction, state, callId} = evt;
  }
}

..

const emitter = new StateEmitter();
srf.invite((req, res) => {
  srf.createB2BUA(req, res, uri, {
    dialogStateEmitter: emitter,
    ..
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant