Skip to content

Commit

Permalink
Merge pull request #81 from open-voip-alliance/75-onBeforeInvite
Browse files Browse the repository at this point in the history
Promisify onInvite
  • Loading branch information
patrickswijgman authored Dec 23, 2020
2 parents a867e14 + 23ce0eb commit 61ec6ff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,12 @@ export class ReconnectableTransport extends EventEmitter implements ITransport {
//
// See "Delegate before invitation handling" below for the patch.
//
// FIXME keep this up to date with SIP versions, or is there better way to do this?
this.userAgent.userAgentCore.delegate.onInvite = (
// FIXME Keep this up to date with SIP versions, or is there better way to do this?
this.userAgent.userAgentCore.delegate.onInvite = async (
incomingInviteRequest: IncomingInviteRequest
): void => {
): Promise<void> => {
const invitation = new Invitation(this.userAgent, incomingInviteRequest);
const ua = this.userAgent as any; // cast to any so we can access private and protected properties.
const ua = this.userAgent as any; // Cast to any so we can access private and protected properties.

incomingInviteRequest.delegate = {
onCancel: (cancel: IncomingRequestMessage): void => {
Expand Down Expand Up @@ -512,7 +512,7 @@ export class ReconnectableTransport extends EventEmitter implements ITransport {

// Delegate before invitation handling.
if (this.delegate && this.delegate.onBeforeInvite) {
const stopEarly = this.delegate.onBeforeInvite(invitation);
const stopEarly = await this.delegate.onBeforeInvite(invitation);

if (stopEarly) {
return;
Expand Down

0 comments on commit 61ec6ff

Please sign in to comment.