No CDR of unanswered calls Payback Application

Hello everyone,

I’m currently working on a Voice Push project using Asterisk and ARI. The project involves uploading an audio file and a list of phone numbers from a graphical interface, after which our Asterisk script initiates calls through a pre-configured TRUNK.

The calls are being placed successfully, but I’m having issues with the CDR records. I’m unable to see missed and unsuccessful calls in the CDR, and I’m also having trouble identifying which numbers answered. I can only see the channel used.

If anyone has suggestions or solutions, I’d greatly appreciate it. I can share more details on the script, the CDR table, and Asterisk console logs if needed.

script*******
const axios = require(‘axios’);

// URL de base pour l’API ARI
const baseUrl = “http://X.X.X.X:8088/ari/channels”;
const apiKey = “asterisk:asterisk”;

// Liste des numéros à appeler
const numbersToCall = [
“243823783066”,
“243997165682”,
“243857195523”
];

// Paramètres communs pour l’appel
const context = “internal”;
const extension = “800”;
const priority = 1;
const callerId = “243903003032”;
const timeout = 30;

// Fonction pour lancer un appel via ARI
async function makeCall(phoneNumber) {
const endpoint = PJSIP/${phoneNumber}@mytrunk;
const url = ${baseUrl}?endpoint=${encodeURIComponent(endpoint)}&extension=${extension}&context=${context}&priority=${priority}&callerId=${callerId}&timeout=${timeout}&api_key=${apiKey};

try {
// Effectuer la requête HTTP pour initier l’appel
const response = await axios.post(url);

if (response.status === 200) {
  console.log(`Appel lancé avec succès vers ${phoneNumber}`);
} else {
  console.log(`Erreur lors de l'appel vers ${phoneNumber}: ${response.status} - ${response.data}`);
}

} catch (error) {
console.error(Erreur lors de l'appel vers ${phoneNumber}: ${error.message});
}
}

// Boucler sur chaque numéro et initier un appel
numbersToCall.forEach(makeCall);
Asterisk CLI**
ip-172-31-10-228CLI>
– Called 243997165682@mytrunk
– Called 243857195523@mytrunk
– Called 243823783066@mytrunk
> 0x7f425000afc0 – Strict RTP learning after remote address set to: X.X.X.X:12004
– PJSIP/mytrunk-00000001 is making progress
> 0x7f427c0186d0 – Strict RTP learning after remote address set to: X.X.X.X:15544
– PJSIP/mytrunk-00000002 is making progress
> 0x7f425000afc0 – Strict RTP switching to RTP target address X.X.X.X:12004 as source
> 0x7f427c0186d0 – Strict RTP switching to RTP target address X.X.X.X:15544 as source
> 0x7f428000a5e0 – Strict RTP learning after remote address set to::12328
– PJSIP/mytrunk-00000000 is making progress
> 0x7f428000a5e0 – Strict RTP switching to RTP target address X.X.X.X:12328 as source
> 0x7f425000afc0 – Strict RTP learning complete - Locking on source address X.X.X.X:12004
> 0x7f427c0186d0 – Strict RTP learning complete - Locking on source address X.X.X.X:15544
> 0x7f428000a5e0 – Strict RTP learning complete - Locking on source address X.X.X.X:12328
– PJSIP/mytrunk-00000002 answered
– Executing [800@internal:1] Answer(“PJSIP/mytrunk-00000002”, “”) in new stack
– Executing [800@internal:2] Playback(“PJSIP/mytrunk-00000002”, “/var/lib/asterisk/sounds/my-sounds/lam”) in new stack
[Oct 28 12:17:16] WARNING[172533][C-00000001]: mp3/interface.c:218 decodeMP3: Junk at the beginning of frame 49443303
– <PJSIP/mytrunk-00000002> Playing ‘/var/lib/asterisk/sounds/my-sounds/lam.slin’ (language ‘en’)
[Oct 28 12:18:13] WARNING[172533][C-00000001]: mp3/interface.c:218 decodeMP3: Junk at the beginning of frame 5441474c
– Auto fallthrough, channel ‘PJSIP/mytrunk-00000002’ status is ‘UNKNOWN’
ip-172-31-10-228
CLI>
********CDR table
| 2024-10-28 12:17:04 | “” <243903003032> | 243903003032 | 800 | internal | PJSIP/mytrunk-00000002 | | Playback | /var/lib/asterisk/sounds/my-sounds/lam | 69 | 57 | ANSWERED | 3 | | 1730117824.2 | |
Thanks a lot for your help!