Custom diaplan to initiate a callback

I had a request to create an extension a user could call that they would be able to dial, hang up, and then have PBX would dial them back at their extension so they could answer with their bluetooth headset to use for the call. Final destination # could be either entered after dialling the extension, or after the PBX calls them back, haven’t gotten too far with it.

So far in my extensions_custom.conf this is what I have and where I am stuck (which leads me to believe I am approaching this problem wrong).

[bluetooth-headset]
exten => s,1,NoOp(Bluetooth Headset Initiaed From: ${CALLERID(num)} )
exten => s,n,Set(CHANNEL(hangup_handler_push)=bluetooth-headset-callback,s,1)
exten => s,n,Set(TIMEOUT(absolute)=1800)
exten => s,n,Background(silence/1)
exten => s,n,WaitExten(12)
exten => s,n,Goto(s,4)

[bluetooth-headset-callback]
exten => s,1,NoOp(Bluetooth callback from: ${CALLERID(num)})
exten => s,n,Dial(local/${CALLERID(num)}@from-internal)
exten => s,n,Return

When I try calling the extension linked to bluetooth-headset,s,1, and hang up, I do see both NoOps, and the following:

2604 [2020-12-01 10:46:01] VERBOSE[23740][C-000001a3] app_dial.c: Caller hung up before dial.

Which makes sense, I hung up, and this is where I am stuck, how to get PBX to call someone back after a hang up (and also not create an endless loop of callbacks).

I seem to be looking at the wrong documentation, so if anyone can point me to the right stuff, it would be appreciated.

Ty,

Did I miss it? But why can’t the user just initially dial from the device connected to the headset?

If they could…

The problem is the bluetooth headset. They can initiate answering a call from it, but have no way of transferring the call (audio/mic) from their handset to their bluetooth headset after they pickup the handset to get a dial-tone/dial/etc.

The thought would be it would be fairly easy to accomplish the original question.

I have used examples of others, and with help, written a “reverse hold” where the user can call a number, and when they are placed on hold, blind transfer the call to an extension which they plays a recording of “there is someone on hold, please press 1 to connect” and when the destination presses 1, it calls them back. The one drawback is, I want to avoid calling the destination before the call has been returned and the user has picked up with their headset.

I feel like there is some underlying issue here that is being put on a huge band-aid rather than fixing the actual issue.

Regardless, not sure if that would be helpful, but have you looked at the Callback Module?
Wiki: https://wiki.freepbx.org/display/FPG/Callback+Module+User+Guide
Not sure if that alone will help you, but maybe combine it with Dynamic Routes

Or… If you want to use the dialplan, in the hangup handler I’d call a script that would generate a call file and then move it to the outgoing folder, something like:

exten => s,n,System(/path/to/script ${CALLERID(num)} ${Destination Number})

Then a bash script that does something along the lines:

echo "Channel: local/$1@from-internal" >> file.call
echo "Context: from-internal" >> file.call
echo "Extension: $2" >> file.call
echo "Priority: 1" >> file.call

mv file.call /var/spool.asterisk/outgoing

https://wiki.asterisk.org/wiki/display/AST/Asterisk+Call+Files

(Unless I misread your original post…)

Hello @jonathandavis,

Why not to create a click2call application? that would be much simpler.
Once the PBX would get the originate call request, it would dial the extension with the Bluetooth headset, and upon answering it would ring the destination.

Thank you,

Daniel Friedman
Trixton LTD.

The Diaplan application you’re looking for is ORIGINATE, it allows you to specify both channels.

Thanks for all the details – Callback Module works and was very simple to setup. From that I can either setup a custom app with read to allow the user to dial, or dynamic routes.

I half got originate half working. I need to better familiarize myself with FreePBX/Asterisk, it would call back and show up in my software Voip phone as @IPv4 address of the FreePBX server, and fail when answered - Docs for originate are simple but I am obviously missing something.

The dialplan for my attempt at using Originate:

[bluetooth-headset]
exten => s,1,NoOp(Bluetooth Headset Initiated From: ${CALLERID(num)})
same => n,Wait(3)
same => n,Originate(local/${CALLERID(num)},exten,from-trunk,${CALLERID(num)},1)
;same => n,Originate(local/${CALLERID(num)},app,bluetooth-headset-originated,${CALLERID(num)})
same => n,Wait(2)
same => n,Playback(tt-monkeys)
same => n,Hangup()

I tried an application, but I need to read up on that, the problem so far, is with my soft voip phone, it for some reason auto answers the originate (which wouldn’t give the user the time to answer with the bluetooth headset).

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