Bulk Handler,Extension AstDB key does not exist

Good afternoon! I am transferring my Extension with the Bulk Handler module from one server to another, when I downloaded all the Extension to a new machine, I saw errors in the console

[2024-11-20 18:23:08] WARNING[1160108]: db.c:520 ast_db_del2: AstDB key /AMPUSER/998/accountcode does not exist
[2024-11-20 19:09:45] WARNING[1168034]: db.c:520 ast_db_del2: AstDB key /AMPUSER/602/screen does not exist
[2024-11-20 19:09:45] WARNING[1168034]: db.c:520 ast_db_del2: AstDB key /CW/602 does not exist
[2024-11-20 19:09:45] WARNING[1168034]: db.c:520 ast_db_del2: AstDB key /AMPUSER/602/dialopts does not exist
[2024-11-20 19:09:45] WARNING[1168034]: db.c:520 ast_db_del2: AstDB key /AMPUSER/602/screen does not exist
[2024-11-20 19:09:45] WARNING[1168034]: db.c:520 ast_db_del2: AstDB key /CW/602 does not exist
[2024-11-20 19:09:45] WARNING[1168034]: db.c:520 ast_db_del2: AstDB key /AMPUSER/602/pinless does not exist
[2024-11-20 19:09:45] WARNING[1168034]: db.c:520 ast_db_del2: AstDB key /DEVICE/602/emergency_cid does not exist

Can you tell me how to fix it?
FreePBX 17 Asterisk 21

Try to re-install Asterisk.

The AMPUSER indicates that this is something maintained by FreePBX. I suppose reinstalling Asterisk might cause FreePBX to completely rebuild its AstDB entries.

I mentioned asterisk-version-switch for asterisk re-install.

[2024-11-26 15:18:55] WARNING[2439518]: db.c:520 ast_db_del2: AstDB key /AMPUSER/632/screen does not exist
[2024-11-26 15:18:55] WARNING[2439518]: db.c:520 ast_db_del2: AstDB key /CW/632 does not exist
[2024-11-26 15:18:55] WARNING[2439518]: db.c:520 ast_db_del2: AstDB key /AMPUSER/632/dialopts does not exist
[2024-11-26 15:18:55] WARNING[2439518]: db.c:520 ast_db_del2: AstDB key /AMPUSER/632/screen does not exist
[2024-11-26 15:18:55] WARNING[2439518]: db.c:520 ast_db_del2: AstDB key /CW/632 does not exist
[2024-11-26 15:18:55] WARNING[2439518]: db.c:520 ast_db_del2: AstDB key /AMPUSER/632/pinless does not exist
[2024-11-26 15:18:55] WARNING[2439518]: db.c:520 ast_db_del2: AstDB key /DEVICE/632/emergency_cid does not exist

it didn’t help =((

Have you tried deleting and re-adding extension 632?

[2024-11-26 16:47:37] WARNING[2465575]: db.c:520 ast_db_del2: AstDB key /AMPUSER/632/screen does not exist
[2024-11-26 16:47:37] WARNING[2465575]: db.c:520 ast_db_del2: AstDB key /AMPUSER/632/dialopts does not exist
[2024-11-26 16:47:37] WARNING[2465575]: db.c:520 ast_db_del2: AstDB key /AMPUSER/632/screen does not exist
[2024-11-26 16:47:37] WARNING[2465575]: db.c:520 ast_db_del2: AstDB key /CW/632 does not exist
[2024-11-26 16:47:37] WARNING[2465575]: db.c:520 ast_db_del2: AstDB key /AMPUSER/632/pinless does not exist
[2024-11-26 16:47:37] WARNING[2465575]: db.c:520 ast_db_del2: AstDB key /DEVICE/632/emergency_cid does not exist

I tried to completely delete the 632 number and then add it again, it did not change the behavior of the console


when I click on the submit button in the console from the settings of number 632, I see these errors, this applies to any number

when I click Apply, there are also a number of errors in the console about all the numbers

[2024-11-26 16:50:47] WARNING[2466054]: db.c:520 ast_db_del2: AstDB key /AMPUSER/681/accountcode does not exist

I tried to install FreePBX 17 and Asterisk 21.5 on a clean Debian 12 from the official installation script, and the same thing happened, I just added the internal number and the same thing happened in the console! This looks like a bug!

Hello everyone

I’m also having the same problem.

  • Debian 12
  • Installation via .sh script
  • I created an extension and configured it
  • Exported csv
  • Edited csv
  • Imported csv

All extensions are unable to register.

  • Deleted all
  • I get the error message in the console
  • I tried resending the csv
  • Again, no extension registers.

----- I did this process from scratch, reinstalling Debian 12 and the script 5 times.

Extra:

  • If I create an extension using the quick creation button, I can register it.

I believe it’s a bug.

How is this the same problem? I don’t see it.

Possible fix

fwconsole util resetastdb

You will see things in the logs like this in current versions of Asterisk. Previously, you would not be told by the AstDB if a key was missing. If you attempted to get said value of AMPUSER/681/accountcode and it was missing OR empty it just returned a blank. Now if you make a request for a missing value in the database tree, it tells you it doesn’t exist.

So if the system issue a database command to delete the value of AMPUSER/681/accountcode and it doesn’t exist, you get this warning. If the system issues a database command to get the value of AMPUSER/681/accountcode, you get this warning.

I tried here and without success.

  • I restored a post-installation image of FreePBX without any configuration

  • I went to import extensions

  • Before starting I ran “fwconsole util resetastdb”

  • For all extensions being imported, the error appears:
    [2024-12-12 14:12:30] WARNING[128668]: db.c:520 ast_db_del2: AstDB key /DEVICE/65109/emergency_cid does not exist
    [2024-12-12 14:12:30] WARNING[128668]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65109/dialopts does not exist
    [2024-12-12 14:12:30] WARNING[128668]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65109/screen does not exist
    [2024-12-12 14:12:30] WARNING[128668]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65109/pinless does not exist
    [2024-12-12 14:12:31] WARNING[128668]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65109/novmpw does not exist
    [2024-12-12 14:12:31] WARNING[128668]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65109/novmstar does not exists
    [2024-12-12 14:12:31] WARNING[128673]: db.c:520 ast_db_del2: AstDB key /DEVICE/65110/emergency_cid does not exist
    [2024-12-12 14:12:31] WARNING[128673]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65110/dialopts does not exist
    [2024-12-12 14:12:31] WARNING[128673]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65110/screen does not exist
    [2024-12-12 14:12:31] WARNING[128673]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65110/pinless does not exist
    [2024-12-12 14:12:31] WARNING[128673]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65110/novmpw does not exist
    [2024-12-12 14:12:31] WARNING[128673]: db.c:520 ast_db_del2: AstDB key /AMPUSER/65110/novmstar does not exist

  • I applied the settings

  • I tried to log in with extensions and I receive “Failed to authenticate” in REGISTER.

This warning is there to tell you there’s no AstDB entry of novmstar for 65110. It’s fine, it’s normal. It’s warning that an attempt to GET the value of a key that doesn’t exist.

These have absolutely no bearing on the actual chan_pjsip registration process or any SIP protocol process. It’s an internal database for Asterisk being used to hold values for the dialplan execution.

Thank you for your explanation.

One thing I noticed:

  • only the first imported extension appears in the /etc/asterisk/pjsip.identify.conf file
  • This extension is connecting normally, but no other is connecting.

I don’t know if it is normal to have only 1 record in the file.

EDIT:

I tried adding the text below to the file “/etc/asterisk/pjsip.identify_custom.conf” and the extension started connecting.

[16110-identify]
type=identify
endpoint=16110
match=152.92.0.0/16

The question remains: Why when we add in bulk is it only adding the first extension (first line) in the pjsip_identify.conf file?

Do the extensions being imported have the match field populated?

Hey BlazeStudios

I created an extension as an example, exported it, replicated it in all the others and imported it.

I didn’t find the “match” column in the exported file.

Would it be “match” with the extension number? I can add it here and test, but in fact when I exported it, this column didn’t appear.

Why are you using the match setting for the extensions? If the match field is empty then it should be authenticating against the username. You need to show a failed registration so we can see what is actually happening.

asterisk -r
pjsip set logger on

Try to register an extension that fails.

[2024-12-12 14:23:55] NOTICE[123906]: res_pjsip/pjsip_distributor.c:673 log_failed_request: Request ‘REGISTER’ from ‘“16110” sip:[email protected]’ failed for ‘152.92.5.153:56491’ (callid: 925a3300c208478781428521b5148ae4) - Failed to authenticate
<— Transmitting SIP response (573 bytes) to UDP:152.92.5.153:56491 —>
SIP/2.0 401 Unauthorized

=-=-=-=-=-=-=-=-=-
freepbx*CLI> pjsip show identifies
Identify: <Identify/Endpoint
>
Match: <criteria
>

Identify: 16100-identify/16100
Match: 152.92.0.0/16

Objects found: 1
=-=-=-=-=-=-=-=-=-

Only this exten can register. I have 300 exten imported, 16100 is the first one on csv file.

OK so there is some misunderstanding going on. Using the identify section is for when you want to match an endpoint against an IP, FQDN, Subnet or you want to match a header. This will match all requests meeting that criteria to the endpoint in question. If there are multiple endpoints with the same identify settings, the first endpoint in the config that matches is matched. So you cannot use match=152.92.0.0/16 on every extension if all the extensions come from that subnet because the first extension in the config will always be matched and no others will. You should be authenticating by username/password only for the extensions.

As well I need to see the full output of the logger. You’re just showing one line and not what was asked for. If the PBX is sending a 401 back with each request something is wrong in the authenticate process and we need to see a full capture not one line.