Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-10 Thread Frank Vanoni
On Wed, 2017-05-10 at 12:56 +0200, Frank Vanoni wrote:
> exten => 2001,1,Dial(SIP/Dial(SIP/deviceA/deviceB/deviceC)
> 
> exten => 2002,1,Dial(SIP/Dial(SIP/deviceA/deviceB)


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

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

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


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-10 Thread Frank Vanoni
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.

On Mon, 2017-05-08 at 16:35 +0200, Frank Vanoni wrote:

> Is there a better solution? 

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)

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

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

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

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


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-09 Thread Stefan Becker

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


DATABASE put zentrale 111 0: SIP/111a/111b
DATABASE put zentrale 115 0:SIP/114/115
DATABASE put zentrale 118 0:SIP/118
DATABASE put zentrale 298 1:DAHDI/r1/298
DATABASE put zentrale 168 1:SIP/168/r1/169


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=abwurf)
 same =  n,Dial(SIP/297&${DB(zentrale/ist)},30,txk)
 same =  n,GoTo(SIP-Phones,300,1)
 same =  n,HangUp()

 exten = 300,1,Answer()
  same =  n,Wait(1)
  same =  n,VoiceMail(300)
  same =  n,HangUp()

exten = 301,1,Set(OPER=${DB_KEYS(zentrale)})
 same = n,Answer()
 same = n,PlayBack(/etc/asterisk/wav/301-zentrale)
 same = n,PlayBack(/etc/asterisk/wav/500-nbstl)
 same = n,While($["${SET(XX=${SHIFT(OPER)})}"!=""])
 same = n,GotoIf($["${DB(zentrale/${XX}):0:2}"!="1:"]?skp)
;same = n,SayNumber(${XX})
 same = n,SayPhonetic(${XX})
 same = n,Wait(1)
 same = n(skp),EndWhile
 same = n,Wait(1)
 same = n,PlayBack(vm-goodbye)
 same = n,HangUp()

exten = 302,1,Answer()
 same = n,Set(CDR(accountcode)=${CALLERID(number):-3})
 same = 
n,GotoIf($["${DB_EXISTS(zentrale/${CALLERID(number)})}"="0"]?301,1)
 same = 
n,GotoIf($["${DB(zentrale/${CALLERID(number)}):0:2}"="1:"]?off)
 same = 
n,Set(DB(zentrale/${CALLERID(number)})=1${DB(zentrale/${CALLERID(number)}):1})

 same = n,macro(SetZentrale)
 same =   n,PlayBack(beep)
 same =   n,PlayBack(beep)
 same =   n,PlayBack(/etc/asterisk/wav/500-nbstl)
;same =   n,SayNumber(${CALLERID(number)})
 same =   n,SayPhonetic(${CALLERID(number)})
 same =   n,PlayBack(/etc/asterisk/wav/302-hinzu)
 same = n,Goto(bye)
 same = 
n(off),Set(DB(zentrale/${CALLERID(number)})=0${DB(zentrale/${CALLERID(number)}):1})

 same = n,macro(SetZentrale)
 same =   n,PlayBack(beep)
 same =   n,PlayBack(/etc/asterisk/wav/500-nbstl)
;same =   n,SayNumber(${CALLERID(number)})
 same =   n,SayPhonetic(${CALLERID(number)})
 same =   n,PlayBack(/etc/asterisk/wav/302-hinab)
 same = n(bye),Wait(1)
 same = n,PlayBack(vm-goodbye)
 same = n,HangUp()

;END


Incoming calls to "0"  -->  Dial all phones listed via "302"
 --->  Dial(${DB(zentrale/ist)})

"300" - VoiceMail-Box
"301" - "reads off" the list of phones registered via "302"

"302" - if extention not registered, adds calling extention (database 
entry must exist) to Dial-List
   DATABASE entry "zentrale/ist" is created or modified by this 
methode
"302" - if extention registered, removes calling extention from Dial-List 
${DB(zentrale/ist)



I hope this may interest and help you along 


my best regards,

Stefan Becker



On Mon, May 8, 2017 at 4:35 PM, Frank Vanoni  
wrote:

Hello
I have the following scenario:

[mynicecontext]
exten => 2000,1,Dial(SIP/deviceA/deviceB/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.
.




--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-09 Thread Héctor Royo
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!
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-08 Thread Daniel Journo
> Hello

> I have the following scenario:

> [mynicecontext]
> exten => 2000,1,Dial(SIP/deviceA/deviceB/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.

> Is there a better solution?

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.
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-08 Thread Marcelo Terres
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerAction_DialplanExtensionRemove
Marcelo H. Terres 
IM: mhter...@jabber.mundoopensource.com.br
https://www.mundoopensource.com.br
https://twitter.com/mhterres
https://linkedin.com/in/marceloterres


On 8 May 2017 at 16:13, Antony Stone
 wrote:
> On Monday 08 May 2017 at 15:44:47, Marcelo Terres wrote:
>
>> https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+ManagerAction_Dialpl
>> anExtensionAdd
>>
>> Is it enough?
>
> 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.
>
>> On 8 May 2017 at 15:35, Frank Vanoni  wrote:
>> > Hello
>> >
>> > I have the following scenario:
>> >
>> > [mynicecontext]
>> > exten => 2000,1,Dial(SIP/deviceA/deviceB/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 -
>> > [mynicecontext]
>> > #include "ringdevice.conf
>> >
>> > exten => 2000,1,GoTo(ringdevice,ring,1)
>> >
>> > exten => 4000,1,System(/bin/cat /etc/asterisk/twodevices.txt
>> >
>> >> /etc/asterisk/ringdevice.conf)
>> >
>> > exten => 4000,2,Wait(3)
>> > exten => 4000,3,System(/usr/sbin/asterisk -rx "dialplan reload")
>> > exten => 4000,4,Playback(service)
>> >
>> > exten => 4001,1,System(/bin/cat /etc/asterisk/alldevices.txt
>> >
>> >> /etc/asterisk/ringdevice.conf)
>> >
>> > exten => 4001,2,Wait(3)
>> > exten => 4001,3,System(/usr/sbin/asterisk -rx "dialplan reload")
>> > exten => 4001,4,Playback(service)
>> > -- end snip -
>> >
>> > twodevices.txt contains
>> > exten => ring,1,Dial(SIP/deviceA)
>> >
>> > alldevices.txt contains
>> > exten => ring,1,Dial(SIP/deviceA/deviceC)
>> >
>> > By dialing 4000 or 4001, the dialplan is modified and reloaded
>> > accordingly.
>> >
>> > Is there a better solution?
>> >
>> > Frank
>
> --
> 3 logicians walk into a bar. The bartender asks "Do you all want a drink?"
> The first logician says "I don't know."
> The second logician says "I don't know."
> The third logician says "Yes!"
>
>Please reply to the list;
>  please *don't* CC me.
>
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at: https://community.asterisk.org/
>
> New to Asterisk? Start here:
>   https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-08 Thread Antony Stone
On Monday 08 May 2017 at 15:44:47, Marcelo Terres wrote:

> https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+ManagerAction_Dialpl
> anExtensionAdd
> 
> Is it enough?

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.

> On 8 May 2017 at 15:35, Frank Vanoni  wrote:
> > Hello
> > 
> > I have the following scenario:
> > 
> > [mynicecontext]
> > exten => 2000,1,Dial(SIP/deviceA/deviceB/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 -
> > [mynicecontext]
> > #include "ringdevice.conf
> > 
> > exten => 2000,1,GoTo(ringdevice,ring,1)
> > 
> > exten => 4000,1,System(/bin/cat /etc/asterisk/twodevices.txt
> > 
> >> /etc/asterisk/ringdevice.conf)
> > 
> > exten => 4000,2,Wait(3)
> > exten => 4000,3,System(/usr/sbin/asterisk -rx "dialplan reload")
> > exten => 4000,4,Playback(service)
> > 
> > exten => 4001,1,System(/bin/cat /etc/asterisk/alldevices.txt
> > 
> >> /etc/asterisk/ringdevice.conf)
> > 
> > exten => 4001,2,Wait(3)
> > exten => 4001,3,System(/usr/sbin/asterisk -rx "dialplan reload")
> > exten => 4001,4,Playback(service)
> > -- end snip -
> > 
> > twodevices.txt contains
> > exten => ring,1,Dial(SIP/deviceA)
> > 
> > alldevices.txt contains
> > exten => ring,1,Dial(SIP/deviceA/deviceC)
> > 
> > By dialing 4000 or 4001, the dialplan is modified and reloaded
> > accordingly.
> > 
> > Is there a better solution?
> > 
> > Frank

-- 
3 logicians walk into a bar. The bartender asks "Do you all want a drink?"
The first logician says "I don't know."
The second logician says "I don't know."
The third logician says "Yes!"

   Please reply to the list;
 please *don't* CC me.

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-08 Thread John Kiniston
You could use the DIALGROUP function for this and not need to shell out.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_DIALGROUP

On Mon, May 8, 2017 at 7:35 AM, Frank Vanoni 
wrote:

> Hello
>
> I have the following scenario:
>
> [mynicecontext]
> exten => 2000,1,Dial(SIP/deviceA/deviceB/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 -
> [mynicecontext]
> #include "ringdevice.conf
>
> exten => 2000,1,GoTo(ringdevice,ring,1)
>
> exten => 4000,1,System(/bin/cat /etc/asterisk/twodevices.txt
> > /etc/asterisk/ringdevice.conf)
> exten => 4000,2,Wait(3)
> exten => 4000,3,System(/usr/sbin/asterisk -rx "dialplan reload")
> exten => 4000,4,Playback(service)
>
> exten => 4001,1,System(/bin/cat /etc/asterisk/alldevices.txt
> > /etc/asterisk/ringdevice.conf)
> exten => 4001,2,Wait(3)
> exten => 4001,3,System(/usr/sbin/asterisk -rx "dialplan reload")
> exten => 4001,4,Playback(service)
> -- end snip -
>
> twodevices.txt contains
> exten => ring,1,Dial(SIP/deviceA)
>
> alldevices.txt contains
> exten => ring,1,Dial(SIP/deviceA/deviceC)
>
> By dialing 4000 or 4001, the dialplan is modified and reloaded
> accordingly.
>
> Is there a better solution?
>
> Frank
>
>
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at: https://community.asterisk.
> org/
>
> New to Asterisk? Start here:
>   https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts,
build a wall, set a bone, comfort the dying, take orders, give orders,
cooperate, act alone, solve equations, analyze a new problem, pitch manure,
program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
---Heinlein
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-08 Thread J Montoya or A J Stiles
On Monday 08 May 2017, Frank Vanoni wrote:
> By dialing 4000 or 4001, the dialplan is modified and reloaded
> accordingly.
> 
> Is there a better solution?

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 .


-- 
JM or AJS

Note:  Originating address only accepts e-mail from list!  If replying off-
list, change address to asterisk1list at earthshod dot co dot uk .

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Dial an extension to modify dialplan

2017-05-08 Thread Marcelo Terres
https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+ManagerAction_DialplanExtensionAdd

Is it enough?

Regards,
Marcelo H. Terres 
IM: mhter...@jabber.mundoopensource.com.br
https://www.mundoopensource.com.br
https://twitter.com/mhterres
https://linkedin.com/in/marceloterres


On 8 May 2017 at 15:35, Frank Vanoni  wrote:
> Hello
>
> I have the following scenario:
>
> [mynicecontext]
> exten => 2000,1,Dial(SIP/deviceA/deviceB/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 -
> [mynicecontext]
> #include "ringdevice.conf
>
> exten => 2000,1,GoTo(ringdevice,ring,1)
>
> exten => 4000,1,System(/bin/cat /etc/asterisk/twodevices.txt
>> /etc/asterisk/ringdevice.conf)
> exten => 4000,2,Wait(3)
> exten => 4000,3,System(/usr/sbin/asterisk -rx "dialplan reload")
> exten => 4000,4,Playback(service)
>
> exten => 4001,1,System(/bin/cat /etc/asterisk/alldevices.txt
>> /etc/asterisk/ringdevice.conf)
> exten => 4001,2,Wait(3)
> exten => 4001,3,System(/usr/sbin/asterisk -rx "dialplan reload")
> exten => 4001,4,Playback(service)
> -- end snip -
>
> twodevices.txt contains
> exten => ring,1,Dial(SIP/deviceA)
>
> alldevices.txt contains
> exten => ring,1,Dial(SIP/deviceA/deviceC)
>
> By dialing 4000 or 4001, the dialplan is modified and reloaded
> accordingly.
>
> Is there a better solution?
>
> Frank
>
>
> --
> _
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at: https://community.asterisk.org/
>
> New to Asterisk? Start here:
>   https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>http://lists.digium.com/mailman/listinfo/asterisk-users

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users