Sync BLF states between extensions

Hi all,

Continuing the discussion from Also ring WebRTC extension when primary extension (PJSIP) rings (thanks @lgaetz ;)):

What would be the best way to “sync” the BLF states for 2 extensions?
The end-user is using a “standard” PJSIP extension, registered on an IP Phone… and another extension used as a WebRTC extension. If the user is in-call/ringing/busy/… on one extension, the other one should have the same BLF state. (1 user → 1 BLF state other users can see)

Thanks a lot for your help!

This is easier to describe in Asterisk terminology, so I suspect it may require custom dialplan, although I haven’t researched the GUI enough to be certain of that, and my expertise is mainly on on raw Asterisk.

Asterisk would use the term device for what you called extension, and extension for the common phone number that accesses all the devices, see: Extension States

The code that combines device states is here:

so if anyone is ringing, you will get RINGINUSE or RINGING, otherwise the, from lowest to highest, the priority is hold, in use, busy.

What gets sent to the phone for RINGINUSE seems to be configurable.

Thanks a lot for your reply… It indeed seems there is a aggregate function.
Would you have an example custom dialplan that does the job? :slight_smile:

Nobody who has an example how to “sync” the BLF’s of the 2 extensions?

Thanks for your help!

My experience is with Asterisk, and the references I’ve given tell you how to create a hint for an Asterisk extension corresponding to multiple Asterisk devices.

How you get the phone to reflect that Asterisk extension state depends on the phone, although FreePBX endpoint manager may know about that, but I don’t have the knowledge of endpoint manager or your phones, to answer.

I’d be pretty sure that creating the hint extension will involve custom dialplan, either as a distinct extension, in which case the Asterisk documentation says what is required, or by hijacking and overriding the hints on one of the FreePBX extensions, which I’m not competent to consider.

Follow the example provided by FreePBX. If you check the extensions_additional.conf file for an extension hint, like this example for extension 7004, it looks like this:

exten => 7004,hint,PJSIP/7004&PJSIP/907004&Custom:DND7004,CustomPresence:7004

If you want to ALSO track extension 7010 using the same hint, you would add this line to extensions_custom.conf

exten => 7004,hint,PJSIP/7004&PJSIP/907004&PJSIP/7010&Custom:DND7004,CustomPresence:7004

The content of extensions_custom.conf will supersede that of extensions_additional.conf context from-internal-custom supersedes that of ext-local, so any future changes that fpbx makes to that one line in extensions_additional.conf will be ignored.

1 Like

Are you a 100% about this? Because Asterisk is first to load into memory wins. This is why the extensions_override_freepbx.conf context is loaded before extensions_additonal.conf so if I put ext-local in extensions_override_freepbx.conf it will override the ext-local in extensions_additonal.conf.

; WARNING ABOUT: #include extensions_override_freepbx.conf
;
; This include file is put first to allow the auto-generated dialplan in FreePBX
; to be overwritten if necessary. Overriding auto-generated dialplan should be done
; with extreme caution. In almost all cases any custom dialplan SHOULD be put in
; extensions_custom.conf which will not hurt a FreePBX generated dialplan. In some
; very rare and custom situations users may have a need to override what FreePBX
; automatically generates. If so anything in this file will do that. If you come up
; with situations where you need to modify the existing dialplan or macros, put it
; here.
;
#include extensions_override_freepbx.conf
#include extensions_additional.conf
#include extensions_custom.conf

Because I tested this. Add a hint after the main hint is loaded (ie putting it in _custom which loads after) ends up with this: (note this is my own dialplan but the concept is the same)

[2022-10-24 12:57:27.441] WARNING[25223]: pbx.c:7156 add_priority: Unable to register extension ‘2112’ priority -1 in ‘blazestudios-local’, already in use
[2022-10-24 12:57:27.441] WARNING[25223]: pbx_config.c:1891 pbx_load_config: Unable to register extension at line 464 of /etc/asterisk/blazestudios_dialplan.conf

Concept is the same, here are the two hints with the original being loaded first:

exten = 2112,hint,PJSIP/92112&Custom:BLAZESTIDIOS_DND2112,CustomPresence:BLAZESTUDIOS2112
exten = 2112,hint,PJSIP/92112&PJSIP/92110&Custom:BLAZESTIDIOS_DND2112,CustomPresence:BLAZESTUDIOS2112

Here’s the results of core show hint 2112

[email protected]: PJSIP/92112&Custom:B  State:Idle            Presence:not_set         Watchers  1
1 hint matching extension 2112

You will note that it is the first loaded so using extensions_custom.conf is not where you would override the existing generated FreePBX dialplan. You need to put this is extensions_override_freepbx.conf

2 Likes

Hi Lorne, Tom,

You 2 are great ;)!

It indeed only seems to work when I add the hints in the extensions_override_freepbx.conf file.

  • Normal PJSIP extension: 2222
  • WEBRTC PJSIP extension: 44511

So now it seems to working using the following:

[ext-local]
exten => 2222,hint,PJSIP/2222&PJSIP/44511&Custom:DND2222,CustomPresence:2222
exten => 44511,hint,PJSIP/44511&PJSIP/2222&Custom:DND44511,CustomPresence:44511

You’re correct; post updated. In this case, it’s context load order, not conf file load order that governs.

Is it possible to also sync answered and missed calls between webrtc & udp extension.

I’m facing similar problem as dotcom. I’ve described it here:

Right now when I answer the call on my hardware phone then the webrtc phone gets missed call notification. I would like to have it as answered elsewhere. Is it possible?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.