Specific 'path' or route from a particular endpoint?

I want to use one of my extensions (a digium deskphone, if it matters?) to run a script when a 3 digit code is dialled beginning from a set range. Is this possible?

Basically it would be like this:

377 - script runs
321 - script runs
384 - script runs

ideally it would just be the one script running and passing the number dialled as an argument…

In case you’re wondering why on Earth I’d want to do this, it’s to decrement a stock level and the 3 digit codes refer to batteries!

Thank you!

The way you say that makes me nervous. A phone running a script doesn’t sound like a good starting point.

On the other hand, you can use the extension in a custom dial context to effectuate this. There are lots of examples of the system using “send digits” (I think that’s one) to dial something when an extension is instantiated.

Now, you might be talking about something more like “click to dial” where the first extension gets called and, when it picks up, the second number is dialed. If that’s the case, look through your extensions.conf file for a context called “callboth”. If you can’t find it, you might need to look through some old Ward Mundy scripts to find it.

Custom dial prefix

Confused by this - what would be the potential issue? We have about four members of staff and any one of them would be authorised to decrement the stock level of a given battery.

Unless I’ve misunderstood, I’m not sure if a custom dial prefix or send_digits is the answer.

I think I’ll give up on the “only from this extension” wish and just use a misc application.

The phone running the script would be inordinately hard to make happen. Most phones can’t be programmed to do things; especially things like interacting with databases or moving stock levels around.

Making the PBX do things based on the input from the phone, on the other hand, is the bread and butter of what lots of us do here. Anyone that’s integrated a CRM or Time Tracking system to a phone has done basically what you are trying to do.

There are lots of ways to reach into another application. You can look back into the “TimeTrex” interface that I wrote a few years ago as an example. From the phone, you dial a special code (*11 and *12, IIRC) and the custom context set up the application by getting all of the information and firing up a System() function that just went to town.

There are options in the Custom Context to allow for specific extensions to do specific things. @lgaetz has written extensively on this kind of stuff and there are several example projects out in the GitHub repo that should be a good starting point for where you want to go. Remember, we’re here for you if you have questions, so try it and see what happens.

1 Like

Ah, sorry, I had no intention of trying to run a script on the phone itself - I only ever intended or wished to launch code on the pbx

1 Like

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