live: drop events for channels already hung up; e2e waits for the page
Asterisk sends NewCallerid after a Local;1 channel's Hangup, which re-created the channel and left a ghost ringing call on the dashboard. Only Newchannel creates a channel now. The e2e waits that matched text also shown on the previous page (now that the dashboard lists calls) wait for the route. Task: M7-T4
This commit is contained in:
1 parent
f7fc4ed70e
commit
04ec3761c1
5 files changed
+17
-2
No files matched your search
@@ -36,6 +36,15 @@ describe('CallTracker', () => {
|
||||
expect(seen.at(-1)).toBeNull();
|
||||
});
|
||||
|
||||
it('an event after Hangup does not bring the channel back', () => {
|
||||
const t = new CallTracker(() => undefined);
|
||||
const ch = { Channel: 'Local/600@sp-from-ext-00000005;1', Linkedid: '2.0', Uniqueid: '2.0' };
|
||||
t.handle({ Event: 'Newchannel', ChannelStateDesc: 'Down', ...ch });
|
||||
t.handle({ Event: 'Hangup', ...ch });
|
||||
t.handle({ Event: 'NewCallerid', ChannelStateDesc: 'Up', CallerIDNum: '193', ...ch });
|
||||
expect(t.list()).toEqual([]);
|
||||
});
|
||||
|
||||
it('loads calls already up from CoreShowChannels', () => {
|
||||
const t = new CallTracker(() => undefined);
|
||||
const ch = (Channel: string, extra: Record<string, string>) => ({
|
||||
|
||||
@@ -84,6 +84,8 @@ export class CallTracker {
|
||||
case 'Newstate':
|
||||
case 'NewCallerid':
|
||||
case 'NewConnectedLine':
|
||||
// Only Newchannel creates: Asterisk can send a NewCallerid after a channel's Hangup.
|
||||
if (!this.channels.has(name)) return;
|
||||
this.upsert(m);
|
||||
break;
|
||||
case 'Newexten': {
|
||||
@@ -116,7 +118,7 @@ export class CallTracker {
|
||||
case 'VarSet': {
|
||||
const v = field(m, 'Variable') ?? '';
|
||||
const value = field(m, 'Value') ?? '';
|
||||
if (!/^(?:__)?SP_(?:DID|DIRECTION|REC)$/.test(v) || !linkedid) return;
|
||||
if (!/^(?:__)?SP_(?:DID|DIRECTION|REC)$/.test(v) || !this.byLinkedid(linkedid).length) return;
|
||||
const x = this.extraOf(linkedid);
|
||||
if (v.endsWith('DID')) x.did = value || x.did;
|
||||
else if (v.endsWith('DIRECTION'))
|
||||
|
||||
Reference in new issue
Block a user