ghenry
(Gavin Henry)
February 27, 2023, 5:32pm
1
Hi all,
I’m in my testing phase of this:
$agi->verbose("SentryPeer API call res code is 401. Getting a new Bearer token.");
if ($sentrypeer->getAndSaveAccessToken()) {
$agi->verbose("SentryPeer Bearer token is now set. Trying again.");
$res_code = checkPhoneNumber($sentrypeer, $agi, $phone_number_to_check);
if ($res_code == 404) {
$agi->verbose("SentryPeer has not seen this number before. Allowing the call.");
exit(0);
} else {
$agi->verbose("SentryPeer has seen this number before. Halting call.");
exit(1);
}
} else {
$agi->verbose("SentryPeer Bearer token is still empty. Aborting.");
exit(1);
}
} else {
$agi->verbose("SentryPeer has seen this number before. Halting call.");
exit(1);
}
and I naively thought an exit(1) of an AGI script caused a hangup, but I’ll need to exec_goto
to the right hangup context etc. I was thinking:
exten => s-INVALIDNMBR,1,Noop(Dial failed due to trunk reporting Address Incomplete - giving up)
in `[macro-dialout-trunk]’ but wanted to be to check if I should play the caller a message etc.
What’s nice for a user, logs and every other module that might want to tidy up things. Like the sangomacrm agi etc.
PitzKey
(Itzik)
February 27, 2023, 6:28pm
2
There is a AGI hangup command: Asterisk 20 AGICommand_hangup - Asterisk Project - Asterisk Project Wiki however, it does not seem like you can pass a causecode like in the dialplan: Asterisk 20 Application_Hangup - Asterisk Project - Asterisk Project Wiki
So perhaps sending back to the dialplan and using a Hangup(causecode) would be best.
1 Like
ghenry
(Gavin Henry)
February 27, 2023, 7:54pm
3
I think I’ll opt to add some settings for the admin to pick things like:
Hangup
Play a message (from Recordings)
Send email
Maybe just go to hangup first/number not found.
etc.
ghenry
(Gavin Henry)
February 27, 2023, 8:26pm
4
Actually, I’m going to keep logic out of my AGI script and send a call that I want to hangup into a dialplan context that has a -custom in it for others to hook into if they want to.
Plus those options on the config page later
system
(system)
Closed
March 30, 2023, 8:27pm
5
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.