Skip to content

Commit

Permalink
Add closeHeaders in unregister
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarvis-RC committed Oct 24, 2022
1 parent 3703c54 commit bb30a2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface WebPhoneOptions {
reconnectionTimeoutWithBackup?: number;
instanceId?: string;
regId?: number;
closeWithHeaders?: boolean;
enableDefaultModifiers?: boolean;
enablePlanB?: boolean;
enableTurnServers?: boolean;
Expand Down Expand Up @@ -219,7 +220,8 @@ export default class WebPhone {
allowLegacyNotifications: true,
registerOptions: {
instanceId: options.instanceId || undefined,
regId: options.regId || undefined
regId: options.regId || undefined,
closeWithHeaders: options.closeWithHeaders || false
}
};

Expand Down
6 changes: 5 additions & 1 deletion src/userAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {ClientContext, UA} from 'sip.js';
import {AudioHelper} from './audioHelper';
import {patchSession, patchIncomingSession, WebPhoneSession} from './session';
import {TransportConstructorWrapper, WebPhoneSIPTransport} from './sipTransportConstructor';
import {WebPhoneOptions} from './index';

export interface WebPhoneUserAgent extends UA {
media: any;
Expand Down Expand Up @@ -115,7 +116,10 @@ export const patchUserAgent = (userAgent: WebPhoneUserAgent, sipInfo, options, i

function onTransportConnected(this: WebPhoneUserAgent): any {
if (this.configuration.register) {
return this.register();
const options = this.configuration.registerOptions;
return this.register({
closeWithHeaders: (options as any).closeWithHeaders
});
}
}

Expand Down

0 comments on commit bb30a2d

Please sign in to comment.