PJSIP queue members showing as invalid

Figured out that there is a state_interface column in the queue_members table for realtime on PJSIP. This is not documented anywhere, but I found it in ${asterisk_source_dir}/contrib/realtime/mysql/mysql_config.sql:

CREATE TABLE queue_members (
    queue_name VARCHAR(80) NOT NULL,
    interface VARCHAR(80) NOT NULL,
    uniqueid VARCHAR(80) NOT NULL,
    membername VARCHAR(80),
    state_interface VARCHAR(80),
    penalty INTEGER,
    paused INTEGER,
    PRIMARY KEY (queue_name, interface)
);

Then I used jcolp’s explanations over at this thread to figure out using PJSIP/trunk as the state_interface where trunk is a a defined endpoint and interface is PJSIP/device@trunk, which will cause Asterisk to send the INVITE with device as the To: user.