Modifying dialplan externally

My dialplan is generated by a GUI (QuestBlue /QuBe), so I don’t want/can’t edit it directly.

I want to include a curl-call when the callers enter the queue.
Fortunately, the first entry of each extension is a noop.

This is a part of the output of dialplan show

  '1' =>            1. NoOp(IVR KBH Entry 1)             [pbx_config]
                    2. Gosub(func-queue,s,1(KBH,,300,announcement-2\,s\,1,announcement-2\,s\,1,func-ivr-main_ivr\,s\,1)) [pbx_config]

So is it possible by any of the interfaces to asterisk to change this NoOp line of the extension to something else?

Back when I wrote the dialplan by hand, I would just have done it, but as often is the case, I have to struggle against the GUI to get the job done.

You could try using a dialplan template for it.

create a context with the same name as the context you are showing us but suffix it with a (+)

Then define just extension 1 priority 1

exten => 1,1,Curl(BLAH)

I believe the extensions parser will apply the template and overwrite your GUI’s setting.

(+) continues an existing section. It’s not a template. I’d expect the second definition to be thrown out because of the duplicate extension and priority.

There are facilities to delete and add lines from the CLI, but I’m not sure how they interacat with the configuration files, and the delete and add combination would not be atomic.

I first had to find out how to modify the entry, as the dialplan is machine-generated, so I can’t modify a file.

But this works from a script:

 rasterisk -x 'dialplan add extension 1,1,Noop,"Modified entry" into func-ivr-ButikkerK1H2 replace'

The next step of what actually to write is trivial :wink:

Be aware that any dialplan reload will erase your modifications done with the ‘dialplan add’ command, the data is only resident in memory and will not be written to disk.


But dialplan reloads aren’t supposed to happen, and I plan to re-patch the dialplan regularly by cron anyway.
It isn’t mission-critical.

The section of config.c where the (+) feature is defined is the section dealing with templates and categories, That’s why I consider it to be a templating feature.

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