Probably a stupid question, but the method “use-your-favorite-search-engine” did not work for me. So…
I have many SIP-users in sip.conf
[101]
type=friend
host=dynamic
context=connect
secret=secret101
[102]
type=friend
host=dynamic
context=connect
secret=secret102
…
and so on.
In extensions.conf I have a rule how to connect them
[connect]
exten => 101,1,Dial(SIP/101)
exten => 102,1,Dial(SIP/102)
exten => 103,1,Dial(SIP/103)
exten => 104,1,Dial(SIP/104)
…
I sincerely believe that it is possible to tell Asterisk something like
exten => WHATEVER,1,Dial(SIP/WHATEVER)
so that I do not have to repeat the same rule many times. What is the correct syntax to do that?
There are examples of this in extensions.conf.sample. It is definitely in the Asterisk/101 syllabus.
However, it violates the current security guidelines, as it means that it is very easy for an attacker to enumerate all the sip.conf section names. The advice, in the guidelines, is to use the MAC address in the device name,
You can definitly do this if you want. For example, this is a rule for numbers from 100 - 199:
exten => _1XX,1,Dial(SIP/${EXTEN})
Dave, thank you for the reply,
can you, please, give me a link to what you call “Asterisk/101 syllabus”?
[quote=“dejanst”]You can definitly do this if you want. For example, this is a rule for numbers from 100 - 199:
exten => _1XX,1,Dial(SIP/${EXTEN})
[/quote]
Fantastic, it works!)) thanks a million!
by the way, is there a way instead of writing “_1XX”, which means “3-digit-number-starting-with-1”, write actually some code for “whatever-is-dialled-just-repeat”. Because I want to have the same recipe for all numbers, no matter what - 3 digits, 4 digits and so on
[code]
exten => _X.,1,Dial(SIP/${EXTEN})
you can use the above code to any number dialing with the SIP.
xxxx/101 refers to how US Universities label their most basic initial course in a subject. I was saying that every installing Asterisk is expected to know how to use ${EXTEN} in dialplans.