Click a button to dial a number (different number), play a recorded message, then ring off

Basically I’d like to be able to have staff have the option to click a button on our online portal to let customers know their lawnmowers are repaired.
We have a lot of elderly customers who don’t have mobiles so we can’t do SMS.

I spotted this thread which looks VERY similar to what I want to do, but not quite.

I have implemented and tested a call file which can phone a number and play a recorded message, this is done, but what I haven’t sorted is the varying number (the call file number is hard coded) OR the click from the staff portal.

Also, the @ringding code at the thread above isn’t complete, is it? At the very least it lacks a closing php tag…?

Anyway I might be barking up the wrong tree with that approach, it just looked 75% close to what I want to do! :slight_smile:

Any pointers most welcome. I had fun playing with the call file and getting that working but it seems a bit…static at the moment!


The original post wasn’t properly formatted, so a lot of the “punctuation” is hosed up.

The meat of it’s still there, though. The original source code for the function should be on the GitHub site listed at the top of the page.

This program, though, is a click-to-dial that connects an extension to an external number, which may not be what you are looking for.

Writing a PHP script that creates a CallFile in /tmp and them 'mv’s it to the spool directory is a slightly different process, but works in a relatively similar way.

Thanks - and PHP would be the way to go? There’s no way to pass the variable like this (e.g) ?

where 01921334558 is auto inserted by the online portal software I use?

No worries if not, I’ll have a play!

PHP is certainly A way to go. Most of FreePBX is written in PHP, so you could do worse.

Since you are using a URL, just go ahead and use the normal “&” and “?” syntax for your “web page” processing.

I’ve made some progress and I was so delighted the first time after quite a few trial and error attempts the deskphon rang with the call…

so I’ve got this code sitting on the server waiting for a click from our intranet site which would look like

This is great and it works. My deskphone (52) rings, when I answer the call, it starts dialling my mobile 07391325541 (changed for the forum).

HOWEVER, what I’d like to happen instead is for Asterisk to ring the mobile number provided in the link (there’s no ‘need’ for an extension to be involved) and for the call to to go straight to a context in extensions_custom.conf…

exten => s,1,Set(TIMEOUT(digit)=5)             ; Set Digit Timeout to 5 seconds
exten => s,2,Set(TIMEOUT(response)=10)         ; Set Response Timeout to 10 seconds
exten => s,3,Answer
exten => s,4,Wait(1)
exten => s,5,Background(outboundmsgs/msg1)         ; "play outbound msg"
exten => s,6,Background(outboundmsgs/how_to_ack)   ; "Press 1 to replay or 2 to acknowledge receiving this message"
exten => 1,1,Goto(s,5)   ; replay message
exten => 2,1,Goto(msgack,s,1) ; acknowledge message
exten => t,1,Playback(vm-goodbye)
exten => t,2,Hangup

I tried to modify line 16 in the call.php

1. $strContext = "from-internal";
1. $strContext = "outboundmsg1";

but (I wasn’t that surprised) it just stopped the whole thing from working.

I’m still pretty childishly exhilerated that I’ve got this far, with creating a new asterisk manager user and making the necessary changes to get my PJSIP extension to ring rather than a SIP one. Progress! Small steps but happy steps. But yeah…my call file looks like this

Channel: Local/[email protected]
Callerid: 7022340175
MaxRetries: 5
RetryTime: 300
WaitTime: 45
Context: outboundmsg1
Extension: s
Priority: 1

As you all can see, this calls extension 20 and then goes to the outboundmsg1 context. Works a treat. I’d like to make this an outbound/external call I ‘start’ via a link on our intranet.


Your dialplan is wrong for this. You’re going to get the the final line of playing back the ACK message and then you have nothing else. No Read(), no WaitExten or anything. The dialplan will exit with nothing else to process after exten => s,6,Background(outboundmsgs/how_to_ack) You need more dialplan here.

Your also working under the logic all the calls are answered by people. You don’t have any machine checks or handling of the call for when a machine answers and it has playback and wants to record the message.

Hi Tom, I know about those two failings. The first (not waiting for a reply) from my own tests and the second (no answering machine checks) from thinking about how the automation would work in practice. I was planning to address them once I progressed further with the fundamentals of my question. Thanks

Originating a call to an external number would be a Channel of the format:

Local/[email protected]

where x’s are calling number that matches a pattern in outbound routes.

Thanks Lorne - got that bit working -that worked without even needing to modify anything - it’s the ‘how to transfer’ to a bit of dialplan code bit that I’m stuck on. I’ll keep at it! :slight_smile: :slight_smile:

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