S
S
Sergey Ryzhkin2017-03-19 11:19:25
Asterisk
Sergey Ryzhkin, 2017-03-19 11:19:25

Asterisk outbound syntax, how to add 2 or more peers?

Greetings, Comrades!
Help to understand with syntax in extensions.conf. For example, there are 4 numbers, how to add a number search for an outgoing call?
Now everything is done cumbersome and clumsy, i.e. the plan looks like this:

;
; extensions.conf - the Asterisk dial plan
;

[general]
static=yes
writeprotect=no

[globals]
[default]

[phones]
include => local
include => outgoing

[local]
exten => 900,1,Answer()
exten => 900,n,ConfBridge(1,confer)
exten => 900,n,Hangup()
exten => _XXX,1,Dial(SIP/${EXTEN})
exten => _XXX,n,Hangup()

[outgoing]
exten => _XXX.,1,Dial(SIP/${EXTEN}@213137,45,t)
exten => _XXX.,n,Dial(SIP/${EXTEN}@213153,45,t)
exten => _XXX.,n,Dial(SIP/${EXTEN}@213157,45,t)
exten => _XXX.,n,Dial(SIP/${EXTEN}@213158,45,t)
exten => _XXX.,n,Hangup()

How can I fix the code so as not to fence a bunch of text, but use " same ". Because if I want, for example, to limit or change the rule for some intercity type exten => _8495 **** I will again have to sculpt it in a bunch one after another. And if the numbers are not 4 outgoing, but 7-10, then the number of lines will increase.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Shitskov, 2017-03-19
@Franciz

I suppose this enumeration needs to be done in the form of a macro.
For less clumsiness, request channel status before dialing. If the channel is free, only then call Dial.
Try this, for example:
[outcall]
exten => s,1,NoOp(Selecting channel)
same => 2,ChanIsAvail(SIP/213137&SIP/213153&SIP/213157&SIP/213158,sj)
same => 3,Dial(${AVAILCHAN }/${ARG1},45,t)
same => 4,Hangup
same => 103,Playback(all-circuits-busy-now)
same => n,Hangup
[outgoing]
exten => _XXX.,1,Gosub (outcall,s,1(${EXTEN}))

R
Rsa97, 2017-03-19
@Rsa97

You can use regular FollowMe

V
Viktor, 2017-03-19
@awsswa59

asterisk-support.ru/question/43568/sluchainyi-vybo...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question