Skip to content

Commit 520ea84

Browse files
ikqorgads
authored andcommitted
Subscribe support
1 parent 9e3ee39 commit 520ea84

File tree

11 files changed

+1347
-3
lines changed

11 files changed

+1347
-3
lines changed

gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ gulp.task('test', function()
105105
'test/test-parser.js',
106106
'test/test-properties.js',
107107
'test/test-UA-no-WebRTC.js',
108-
'test/test-digestAuthentication.js'
108+
'test/test-digestAuthentication.js',
109+
'test/test-UA-subscriber-notifier.js'
109110
];
110111

111112
return gulp.src(src)

lib/Constants.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export declare enum DTMF_TRANSPORT {
5757
}
5858

5959
export const REASON_PHRASE: Record<number, string>
60-
export const ALLOWED_METHODS = 'INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY'
60+
export const ALLOWED_METHODS = 'INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY,SUBSCRIBE'
6161
export const ACCEPTED_BODY_TYPES = 'application/sdp, application/dtmf-relay'
6262
export const MAX_FORWARDS = 69
6363
export const SESSION_EXPIRES = 90

lib/Constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ module.exports = {
149149
606 : 'Not Acceptable'
150150
},
151151

152-
ALLOWED_METHODS : 'INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY',
152+
ALLOWED_METHODS : 'INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY,SUBSCRIBE',
153153
ACCEPTED_BODY_TYPES : 'application/sdp, application/dtmf-relay',
154154
MAX_FORWARDS : 69,
155155
SESSION_EXPIRES : 90,

lib/Notifier.d.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {EventEmitter} from 'events'
2+
import {SUBSCRIBE, NOTIFY} from './Constants'
3+
import * as Utils from './Utils'
4+
5+
declare enum NotifierTerminatedCode {
6+
NOTIFY_RESPONSE_TIMEOUT = 0,
7+
NOTIFY_TRANSPORT_ERROR = 1,
8+
NOTIFY_NON_OK_RESPONSE = 2,
9+
NOTIFY_FAILED_AUTHENTICATION = 3,
10+
SEND_FINAL_NOTIFY = 4,
11+
RECEIVE_UNSUBSCRIBE = 5,
12+
SUBSCRIPTION_EXPIRED = 6
13+
}
14+
15+
export class Notifier extends EventEmitter {
16+
start(): void;
17+
setActiveState(): void;
18+
notify(body?: string): void;
19+
terminate(body?: string, reason?: string): void;
20+
get state(): string;
21+
get id(): string;
22+
static get C(): typeof NotifierTerminatedCode;
23+
get C(): typeof NotifierTerminatedCode;
24+
}

0 commit comments

Comments
 (0)