BLF Key to Open a Door

Current PBX Version:14.0.13.12
Current System Version:12.7.6-1910-1.sng7

I have a Viking RC-3 ( 3 relay module) connected to an analog extension port on a Vega 3000.
I can dial the extension type a pin code to access then type a 2 digit code to activate a relay (programmed to engage for 5 seconds)
How do I program this sequence and add it to a BLF button on a users phone?
I want the user to be able to hit a single button to activate the door release relay for 5 seconds.

Your phone (what model?) may be able to do a DTMF sequence after connecting.

If not, it can be done with simple Asterisk dial plan. The Dial() application provides for this:

D([called][:calling[:progress]]): Send the specified DTMF strings *after*
    the called party has answered, but before the call gets bridged. 

Nevermind the “bridged” part as you’re not talking to anyone.

Sorry I forgot the phone types. All are Sangoma S400, S405 and S505.
S505 is what I need first.

I saw this post about delayed DTMF code for door relay.
Delayed DTMF code for Door Relay
How do I do this in the GUI? Can this be done on the phone line keys using a Speed Dial button and DTMF selection?

I don’t think there’s a way to do it from the GUI. I thought the best option for that would be in the Extensions module, creating an extension type of “custom” and specifying the dial string, but the D option doesn’t get passed through. The Asterisk Dial Options field there is only used for outbound dialing from the extension.

But this can easily be done with one or two lines.

Edit the file /etc/asterisk/extensions_custom.conf

If you see a heading of [from-internal-custom] simply put the following line directly under that heading. If you don’t see it, create the heading.

exten => 1234,1,Dial(PJSIP/5678,,D(987w65))

in the string above, you substitute:

  • where it says PJSIP, leave it as PJSIP if you are using that for your extensions, or change it to SIP if you are using chan_sip
  • where it says 5678, this is the extension of your analog extension port on the Vega 3000
  • where it says 987w65, replace this with the tone sequence. “w” means wait half a second.

Save the file and do a reload (fwconsole r if you are in ssh/console).

Now you can dial 1234 to trigger the Viking and send the DTMF codes.

Program a speed dial on your phone for 1234 and you have the one-button door opener.

Or use the ‘LOCAL’ instead of PJ-SIP or SIP.

If you use local:

exten => 1234,1,Dial(Local/5678@from-internal,,D(987w65))

1 Like

know also that you can chain the w (half second wait) characters together so your dial option might end up looking like this D(wwwww987www65) if the receiving end needs more delay.

1 Like

In FreePBX I navigated to Admin\Config Edit\extensions_custom.conf file and there is nothing in it. Do I just load the commands there?

Yes, for the first line, put the heading [from-internal-custom] and then for the second line put the exten line adjusted for your own numbers.

I entered the following in the extensions_custom.conf file to dial extension 114 wait for answer dial 123456 pass code, wait then activate relay number 1. The relay module times out the relay after 5 seconds. I am using PJSIP for normal extensions, however extension 114 is an analog extension on the Vega 3000.
[from-internal-custom]
exten => 114,1,Dial(Local/114@from-internal,D(www
123456ww12))

How do I assign this to a button labeled Lobby Door on the s505
How do I get FreePBX to hang up immediately after activating the relay. The module default hangs up after 20 seconds.

You do not need to put “w” at first to wait for answer. The “D” option already waits for it to answer before sending any tones.

Make a speed dial button like you would for any extension or external number, label it Lobby Door and put 114 as the speed dial.

The S option:

    S(x): Hang up the call <x> seconds *after* the called party has answered
    the call.

Should make your dial string look like this:

exten => 114,1,Dial(Local/114@from-internal,D(www123456ww12)S(1))

I changed the custom extension to 800 still actually calling 114.
[from-internal-custom]
exten => 800,1,Dial(Local/114@from-internal,D(wwwww123456ww12))
This works with the long hang up delay.
Adding the S(1) does not work. It answers but does not activate the relay then hangs up. [from-internal-custom]
exten => 800,1,Dial(Local/114@from-internal,D(www
ww123456ww12)S(1))

My mistake. The timer (the number following the S) includes the time while it is dialing the digits. So you need it to be at least that long. Try S(7) or S(8).

At home , I use this:

[portail]
exten => 150,1,NoOp(– Gate –)
exten => 150,n,Playback(custom/Ordre_transmis_au_portail)
exten => 150,n,dial(SIP/100,3,L(3000:0:0)D(1234#))
exten => 150,n,hangup()

I tried different values for S but the relay did not activate under 7 and 7 and up did not hang up until the relay box disconnected. Tried adding the hangup command after like dnardf posted but the system hung up before the relay activated.
I finally used a hangup command in the relay unit.
this activates relay 1 for 5 seconds and hangs up quickly.
[from-internal-custom]
exten => 850,1,Dial(Local/114@from-internal,D(www*ww123456ww12w01))

I will change the access code and programming codes before putting into production.
Thanks for your help

1 Like

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