Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/RTCSession.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ export interface IncomingAckEvent {
ack: IncomingRequest;
}

export interface SipEvent {
event: string;
request: IncomingRequest;
}

// listener
export type PeerConnectionListener = (event: PeerConnectionEvent) => void;
export type ConnectingListener = (event: ConnectingEvent) => void;
Expand All @@ -200,6 +205,7 @@ export type UpdateListener = ReInviteListener;
export type ReferListener = (event: ReferEvent) => void;
export type SDPListener = (event: SDPEvent) => void;
export type IceCandidateListener = (event: IceCandidateEvent) => void;
export type SipEventListener = (event: SipEvent) => void;

export interface RTCSessionEventMap {
'peerconnection': PeerConnectionListener;
Expand Down Expand Up @@ -227,6 +233,7 @@ export interface RTCSessionEventMap {
'peerconnection:createanswerfailed': Listener;
'peerconnection:setlocaldescriptionfailed': Listener;
'peerconnection:setremotedescriptionfailed': Listener;
'sipEvent': SipEventListener;
}

declare enum SessionStatus {
Expand Down
10 changes: 9 additions & 1 deletion lib/RTCSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ module.exports = class RTCSession extends EventEmitter
}
break;
case JsSIP_C.NOTIFY:
if (this._status === C.STATUS_CONFIRMED)
if (this._status === C.STATUS_CONFIRMED || this._status === C.STATUS_WAITING_FOR_ANSWER)
{
this._receiveNotify(request);
}
Expand Down Expand Up @@ -2540,6 +2540,14 @@ module.exports = class RTCSession extends EventEmitter

break;
}
case 'talk': {
request.reply(200);
this.emit('sipEvent', {
event: request.event,
request: request
});
break;
}

default: {
request.reply(489);
Expand Down