Dial An Extension To Modify Dialplan

Home » Asterisk Users » Dial An Extension To Modify Dialplan
Asterisk Users 10 Comments

Hello

I have the following scenario:

[mynicecontext]
exten => 2000,1,Dial(SIP/deviceA&SIP/deviceB&SIP/deviceC)

As expected, by dialing 2000, all three devices will ring. And that’s fine. However, there are situations where I only want “deviceA” and “deviceB”
to ring. I would like to have an extension to dial in order to modify the dialplan.

Here is what I did…

In extensions.conf:

—— snip —

10 thoughts on - Dial An Extension To Modify Dialplan

  • That’s an ….. interesting ….. way of doing things!

    We would be thinking in terms of using a GLOBAL variable, or an ASTDB entry, to indicate whether or not the extra extension should be dialled. This method ought to be extendable to serve multiple extensions, without the need to assemble the file from tiny snippets .

  • Is there a similar call to delete an extension, or to modify an existing one?

    On the basis that the OP already has extension 2000 defined, he would need to delete this and replace it with a new definition, or alter the current definition, to get the required results.

    Simply being able to add a new extension to an existing dialplan isn’t quite enough.

    Antony.

  • to ring. I would like to have an extension to dial in order to modify the dialplan.

    Take a look at https://wiki.asterisk.org/wiki/display/AST/Device+State Specifically, Custom Device states.

    You write both versions of the dialplan, and use an IF on the custom device state to determine which one runs. You can then dial 4000 to turn the Custom Device from Busy to Available to set which section of the dialplan to run.

  • I would use a Queue with RingAll strategy. Then, I would Pause/Unpause Agents.

    A “Paused” agent would not receive calls from the Queue, but can still receive direct calls.

    You can set an extension to Pause the member and another to Unpause it, using the applications PauseQueueMember and UnPauseQueueMember.

    I hope it helps!

  • Greetings,

    I think this is a better solution:

    I’ve created a simular solution for our main incoming line. Extentions can add/remove themselfs from the distrubuting extention.

    I used the DATABASE functions of Asterisk to accomplish this following.

    my example:
    first create a few Database/Keys in the Asterisk CLI to express which phones may use this feature and how the extention will actually be dialed. Like I have two phones on differant hardware that BOTH act as “169” and both get called by “169” but need special intrustions to be dialed.

    In Asterisk CLI

    add these lines to extentions.conf

    [macro-SetZentrale]
    exten => s,1,Set(OPER=${DB_KEYS(zentrale)})
    exten => s,n,Set(DailOut=)
    exten => s,n,While($[“${SET(XXX=${SHIFT(OPER)})}”!=””])
    exten => s,n,GotoIf($[“${DB(zentrale/${XXX}):0:2}”!=”1:”]?skp)
    exten => s,n,Set(DailOut=${DailOut}&${DB(zentrale/${XXX}):2})
    exten => s,n(skp),EndWhile
    exten => s,n,Set(DailOut=${DailOut:1})
    exten => s,n,Set(DB(zentrale/ist)=${DailOut})

    [SIP-Phones]
    ;incoming call for “0” –> Operator
    exten = 0,1,GotoIfTime(07:45-17:05,mon-fri,*,*?inhours)
    same = n,Dial(${DB(zentrale/ist)},10,txk)
    same = n,GoTo(SIP-Phones,300,1)
    same = n(inhours),Dial(${DB(zentrale/ist)},10,txk)
    same = n,SIPAddHeader(Alert-Info:\;info

  • Dear Digium List

    First of all, I thank all of you for all the replies and the interesting suggestions. I thank you very much. I can only learn from people like you. 🙂

    I will remember all the different solutions for a future use in other scenarios.

    At the end, I cleaned up my dial plan by removing the previous mess and I’m using now ASTDB, as suggested, in the following way:

    exten => 4000,1,Set(DB(alldevices/status)=OFF)
    exten => 4000,2,Playback(service&de-activated)

    exten => 4001,1,Set(DB(alldevices/status)=ON)
    exten => 4001,2,Playback(service&activated)

    exten => 2000,1,GotoIf($[${DB(alldevices/status)}=ON]?2001,1:2002,1)

    exten => 2001,1,Dial(SIP/Dial(SIP/deviceA&SIP/deviceB&SIP/deviceC)

    exten => 2002,1,Dial(SIP/Dial(SIP/deviceA&SIP/deviceB)

  • Whoops… sorry for the typo (in the hurry of copy & paste)!

    exten => 2001,1,Dial(SIP/deviceA&SIP/deviceB&SIP/deviceC)

    exten => 2002,1,Dial(SIP/deviceA&SIP/deviceB)