Stanza with 'Unavailable' type

Hi. When I press the hangup button these functions have been called:
disconnect() (in jitsi-meet) -> conference_.leave() (in jitsi-meet) -> leave() & room.leave() (in lib-jitsi-meet <JitsiMeetConference.js>) -> leave() & deLeave() (in lib-jitsi-meet <ChatRoom.js>)
if this order is correct, then in doLeave() method below presence with unavailable type is sent to myroomjid:

const pres = $pres({ to: this.myroomjid, type: 'unavailable'});
this.connection.send(pres)

Does the $pres({ to: this.myroomjid, type: 'unavailable'}) is the only presence that notifies the server for leaving the room? Because when I deleted this.connection.send(pres) method, jitsi-meet still left the room.
My second question is that, how can I send a presence with custom type? I tried to use this.connection.send() method but I guess it doesn’t work.
I want to send a custom presence and handle it in jicofo chatroom implementation.

You should be using the types of the presence that match the specifications. If you want custom information you can use xmpp extensions we use them a lot in the code.

would you please give me an example of those extensions? :pray:t3:

One example is display name: https://github.com/jitsi/lib-jitsi-meet/blob/master/JitsiConference.js#L817
Audio muted: https://github.com/jitsi/lib-jitsi-meet/blob/master/modules/xmpp/ChatRoom.js#L1258
Video muted: https://github.com/jitsi/lib-jitsi-meet/blob/master/modules/xmpp/ChatRoom.js#L1287