Skip to content

Commit

Permalink
Merge pull request #87 from open-voip-alliance/revert-CSEQ-check-client
Browse files Browse the repository at this point in the history
undoing work with CSEQ
  • Loading branch information
Dagg-h authored Mar 10, 2021
2 parents 2fdf442 + 3edf253 commit b8432f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
13 changes: 2 additions & 11 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Inviter } from './inviter';
import { createFrozenProxy } from './lib/freeze';
import { log } from './logger';
import { ISession, SessionImpl } from './session';
import { statusFromDialog, cseqFromDialog } from './subscription';
import { statusFromDialog } from './subscription';
import { second } from './time';
import { ITransport, ReconnectableTransport, TransportFactory, UAFactory } from './transport';
import { IClientOptions, IMedia } from './types';
Expand Down Expand Up @@ -149,7 +149,6 @@ export class ClientImpl extends EventEmitter implements IClient {

private readonly sessions: { [index: string]: SessionImpl } = {};
private subscriptions: { [index: string]: Subscriber } = {};
private subscriptionSequenceNumbers: { [index: string]: number } = {};
private connected = false;

private transportFactory: TransportFactory;
Expand Down Expand Up @@ -252,14 +251,7 @@ export class ClientImpl extends EventEmitter implements IClient {
this.subscriptions[uri].delegate = {
onNotify: (notification: Notification) => {
notification.accept();
// oldSequenceNumber will be defaulted to -1 if it is not set yet.
const oldSequenceNumber = this.subscriptionSequenceNumbers[uri] || -1;
const currentSequenceNumber = cseqFromDialog(notification);

if (currentSequenceNumber > oldSequenceNumber) {
this.subscriptionSequenceNumbers[uri] = currentSequenceNumber;
this.emit('subscriptionNotify', uri, statusFromDialog(notification));
}
this.emit('subscriptionNotify', uri, statusFromDialog(notification));
}
};

Expand Down Expand Up @@ -467,7 +459,6 @@ export class ClientImpl extends EventEmitter implements IClient {
this.subscriptions[uri].dispose();
}

delete this.subscriptionSequenceNumbers[uri];
delete this.subscriptions[uri];
}

Expand Down
10 changes: 0 additions & 10 deletions src/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,3 @@ export function statusFromDialog(notification: any): SubscriptionStatus | string

return state;
}

/**
* Parse an incoming notification request header and return
* the CSeq number from it.
* @param {any} notification - A SIP.js Request object.
* @returns {Number} - The CSeq number of a notification.
*/
export function cseqFromDialog(notification: any): number {
return notification.request.headers.CSeq[0].parsed.value;
}

0 comments on commit b8432f4

Please sign in to comment.