PJSIP, sorcery, realtime & res_pjsip_phoneprov_provider: phoneprov objects in realtime db?

Currently, the documentation for PJSIP realtime in the wiki does not document storing objects of type=phoneprov in the realtime database, nor does sorcery.conf.sample document this object type, and nor do the alembic migration scripts ship a ps_phoneprov table schema.

In this thread I read that ‘phoneprov’ is not realtime-compatible, however I’m assuming that this refers to res_phoneprov and not the pjsip phoneprov provider, so I’d like to know whether the following setup would work:

The wiki page on PJSIP realtime says:

A warning for adventurous types: Sorcery.conf allows you to try to configure other PJSIP objects such as transport using realtime and it currently won’t stop you from doing so. However, some of these object types should not be used with realtime and this can lead to errant behavior.

so I’ll be building on that. While res_phoneprov is not sorcery-enabled, res_pjsip_phoneprov_provider is. So I’ve devised the following schema for a ps_phoneprov table (pgsql, drawing from some of the alembic SQL scripts):

CREATE TABLE ps_phoneprov (
  id VARCHAR(40) NOT NULL,
  endpoint VARCHAR(128) NOT NULL,
  MAC VARCHAR(48) NOT NULL,
  PROFILE VARCHAR(128) NOT NULL,
  ENDPOINT_ID VARCHAR(40) NOT NULL,
  AUTH_ID VARCHAR(40) NOT NULL,
  TRANSPORT_ID VARCHAR(40) NOT NULL,
  OTHERVAR TEXT,
  UNIQUE(id)
);

I’m unsure about how to handle additional variables (referred to as OTHERVAR in pjsip.conf.sample). Here I have adopted the method used on the set_var column in the ps_endpoints pgsql schema and used a TEXT type. Is the format for this column the same as for the userfield in CDR, i.e. semicolon-delimited CSV: SOMEVAR=SOMEVALUE;OTHERVAR=OTHERVALUE?

sorcery.conf:

[res_pjsip_phoneprov_provider]
phoneprov=realtime,ps_phoneprov

extconfig.conf:

[settings]
pg_phoneprov => pgsql,asterisk

and realtime configured and working for everything else. In principle, the phoneprov provider should feed the data to phoneprov which, potentially after a core reload or phoneprov module reload should pick up the changes in the provisioning whenever I update the realtime data. Am I correct in assuming that? I still have some glue to write in order to test this setup but I’ll update this thread if this actually works.

Could perhaps a developer help me clarify though:

However, some of these object types should not be used with realtime and this can lead to errant behavior.

if the above quote actually applies to the pjsip phoneprov objects and whether I should can this idea. Would be nice if the wiki or sorcery sample config could be updated with a object blacklist that should NOT be used with realtime.

1 Like

What is allowed and not allowed has actually changed over time, as new features have gotten added and older ones updated to allow realtime configuration (outbound registration for example). I don’t think anyone has gone through and tested the fringe ones (such as the phoneprov stuff) to see if it works or not.

If you comment on the wiki page then we can see about improving it, but as it would take setting stuff up and running through things it could be awhile before a definitive list existed.

Alright. Then I’ll share my stuff if I get it working.