Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions src/sip-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
],
"sip_video": false,
"auto_answer": false,
"microphone_mute_on_incoming": false,
"microphone_mute_on_outgoing": false,
"popup_config": {
"auto_open": true,
"large": false,
Expand Down
21 changes: 21 additions & 0 deletions src/sip-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export interface SIPCoreConfig {
/** Output configuration */
out: String;
auto_answer: boolean;
microphone_mute_on_incoming: boolean;
microphone_mute_on_outgoing: boolean;
popup_config: Object | null;
popup_override_component: string | null;
/**
Expand Down Expand Up @@ -437,6 +439,19 @@ export class SIPCore {
e.session.on("accepted", (e: IncomingEvent) => {
console.info("Call accepted");
this.startCallTimer();
switch (this.RTCSession?.direction) {
case "incoming":
console.info("Incoming call");
if (this.config.microphone_mute_on_incoming) {
this.RTCSession?.mute({ audio: true });
}
case "outgoing":
console.info("Outgoing call");
if (this.config.microphone_mute_on_outgoing) {
this.RTCSession?.mute({ audio: true });
}
break;
}
Comment on lines +445 to +457
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed when you also have this below on line 480 and 504?

this.stopOutgoingTone();
this.stopIncomingRingtone();
this.triggerUpdate();
Expand All @@ -459,6 +474,9 @@ export class SIPCore {
switch (e.session.direction) {
case "incoming":
console.info("Incoming call");
if (this.config.microphone_mute_on_incoming) {
e.session.mute({audio: true});
}
this.triggerUpdate();
this.playIncomingRingtone();

Expand All @@ -483,6 +501,9 @@ export class SIPCore {

case "outgoing":
console.info("Outgoing call");
if (this.config.microphone_mute_on_outgoing) {
e.session.mute({audio: true});
}
this.playOutgoingTone();
this.triggerUpdate();

Expand Down
Loading