Skip to content

NethVoice Proxy: Kamailio dialplan table not updated when trunk rules are removed #7379

@Amygos

Description

@Amygos

When removing a trunk rule from the Proxy using the remove-trunk action,
the rule is correctly removed from the dispatcher table in the Kamailio
database but remains in the dialplan table. This inconsistency can lead to
unexpected behavior and requires manual intervention to fully remove the rule.

Steps to reproduce:

  1. Add a rule to the Proxy using the add-trunk command.
    Example:
    api-cli run module/nethvoice-proxy1/add-trunk -d '{"rule":"055555555", "destination":{"uri":"sip:10.5.4.1:20039","description":"nethvoice2"}}'
    
  2. Verify that the rule is added to both the dialplan and dispatcher tables
    in the Kamailio database.
  3. Remove the rule using the remove-trunk command
    Example:
    api-cli run module/nethvoice-proxy1/remove-trunk -d '{"rule":"055555555"}'
    
  4. Check the dispatcher and dialplan tables in the Kamailio database.
    Connect to the database with the following command:
    runagent -m nethvoice-proxy1 podman exec -it postgres psql -U postgres kamailio
    

Expected behavior

The rule should be removed from both the dispatcher
and dialplan tables in the Kamailio database.

Actual behavior

The rule is removed from the dispatcher table but remains in the dialplan
table.
Example:

  • dispatcher table after removal:
    kamailio=# select * from dispatcher;
     id | setid |    destination     | flags | priority | attrs | description |     created_at      |    last_modified
    ----+-------+--------------------+-------+----------+-------+-------------+---------------------+---------------------
     5 |     2 | sip:10.5.4.1:20039 |     0 |        0 |       | nethvoice2  | 2025-03-07 01:01:27 | 2025-03-07 01:01:27
    
  • dialplan table after removal:
    kamailio=# select * from dialplan;
     id | dpid | pr | match_op |       match_exp       | match_len | subst_exp | repl_exp | attrs |     created_at      |    last_modified    | name
    ----+------+----+----------+-----------------------+-----------+-----------+----------+-------+---------------------+---------------------+------
      2 |    1 |  1 |        0 | pbx.example.com |         0 | (.*)      | 2        | 2     | 2025-03-07 00:55:52 | 2025-03-07 00:55:52 |
     11 |    2 |  1 |        1 | sip:055555555.*@.*   |         0 | (.*)      | 11       | 11    | 2025-04-02 14:15:06 | 2025-04-02 14:15:06 |
    

Workaround

While waiting for a bugfix, the workaround involves not using the delete
command, but directly using the insert command with updated data. For example,
if the instance name changes:

api-cli run module/nethvoice-proxy1/add-trunk -d '{"rule":"055555555", "destination":{"uri":"sip:10.5.4.1:20039","description":"nethvoice3"}}'

This will update the existing rule with the new information instead of trying
to remove and re-add it.

Components:

  • ns8-nethvoice-proxy 1.2.0

See also:

Acknowledgements:
Thanks to @mgarra for identifying the issue and providing a temporary
workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    nethvoiceBug or features releted to the NethVoice projectverifiedAll test cases were verified successfully

    Type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions