mirror of
https://github.com/jambonz/chrome-extension-dialer.git
synced 2026-01-25 02:08:05 +00:00
wip
This commit is contained in:
@@ -126,10 +126,10 @@ export default class SipUA extends events.EventEmitter {
|
|||||||
this.emit(SipConstants.UA_STOP);
|
this.emit(SipConstants.UA_STOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
call(number: string): void {
|
call(number: string, customHeaders: string[] = []): void {
|
||||||
let normalizedNumber: string = normalizeNumber(number);
|
let normalizedNumber: string = normalizeNumber(number);
|
||||||
this.#ua.call(normalizedNumber, {
|
this.#ua.call(normalizedNumber, {
|
||||||
extraHeaders: [`X-Original-Number:${number}`],
|
extraHeaders: [`X-Original-Number:${number}`].concat(customHeaders),
|
||||||
mediaConstraints: { audio: true, video: false },
|
mediaConstraints: { audio: true, video: false },
|
||||||
pcConfig: this.#rtcConfig,
|
pcConfig: this.#rtcConfig,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ export const Phone = ({
|
|||||||
makeOutboundCall(inputNumber);
|
makeOutboundCall(inputNumber);
|
||||||
};
|
};
|
||||||
|
|
||||||
const makeOutboundCall = (number: string) => {
|
const makeOutboundCall = (number: string, customHeaders: string[] = []) => {
|
||||||
if (sipUA.current && number) {
|
if (sipUA.current && number) {
|
||||||
setIsCallButtonLoading(true);
|
setIsCallButtonLoading(true);
|
||||||
setCallStatus(SipConstants.SESSION_RINGING);
|
setCallStatus(SipConstants.SESSION_RINGING);
|
||||||
@@ -282,7 +282,7 @@ export const Phone = ({
|
|||||||
duration: "0",
|
duration: "0",
|
||||||
callSid: uuidv4(),
|
callSid: uuidv4(),
|
||||||
});
|
});
|
||||||
sipUA.current.call(number);
|
sipUA.current.call(number, customHeaders);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -449,7 +449,7 @@ export const Phone = ({
|
|||||||
resolve(
|
resolve(
|
||||||
json.map((q) => ({
|
json.map((q) => ({
|
||||||
name: q,
|
name: q,
|
||||||
value: `queue-${q}`,
|
value: q,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
@@ -464,8 +464,11 @@ export const Phone = ({
|
|||||||
<IconButtonMenu
|
<IconButtonMenu
|
||||||
icon={<List />}
|
icon={<List />}
|
||||||
onClick={(value) => {
|
onClick={(value) => {
|
||||||
setInputNumber(value);
|
const calledAppId = `app-${value}`;
|
||||||
makeOutboundCall(value);
|
setInputNumber(calledAppId);
|
||||||
|
makeOutboundCall(calledAppId, [
|
||||||
|
`X-Application-Sid: ${value}`,
|
||||||
|
]);
|
||||||
}}
|
}}
|
||||||
onOpen={() => {
|
onOpen={() => {
|
||||||
return new Promise<IconButtonMenuItems[]>(
|
return new Promise<IconButtonMenuItems[]>(
|
||||||
@@ -475,7 +478,7 @@ export const Phone = ({
|
|||||||
resolve(
|
resolve(
|
||||||
json.map((a) => ({
|
json.map((a) => ({
|
||||||
name: a.name,
|
name: a.name,
|
||||||
value: `app-${a.application_sid}`,
|
value: a.application_sid,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user