M
M
maxkzt2022-01-25 22:59:24
Asterisk
maxkzt, 2022-01-25 22:59:24

How to do internal number substitution?

Hello. There is such a task to connect an asterisk

to a residential complex, in a residential complex there are houses in which numbering starts from 1 sq. to 57, in another house from 1 to 86.
pressing 2 called 102 and so on.
In the second house, pressing 1 called 201, pressing 2 called 202, and so on.

Asterisk 18.9 is used extensions are created contexts are created

I can't describe (reduce) the dialplan function properly
This scheme works fine

[local_calls-p1]
exten => 1,1,NoOp(Call on local subscriber)
same => n,Dial( PJSIP/101,30)
same => n,Playback(kv-number&vm-isunavail)
same => n,Hangup()
.......
[local_calls-p1]
exten => 47,1,NoOp(Call on local subscriber)
same => n,Dial(PJSIP/147,30)
same => n,Playback(kv-number&vm-isunavail)
same => n,Hangup()

[local_calls-p2]
exten => 1,1,NoOp(Call on local subscriber)
same => n,Dial(PJSIP/201,30)
same => n,Playback(kv-number&vm-isunavail)
same => n,Hangup()

..........
[local_calls-p2]
exten => 62,1,NoOp(Call on local subscriber)
same => n,Dial(PJSIP/262,30)
same => n,Playback(kv-number&vm-isunavail) same
=> n,Hangup()

Or tell me where to dig

Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Barbolin, 2022-01-25
@maxkzt

[local_calls-p1]
exten => _[1-9],1,NoOp(Call on local subscriber)
same => n,Dial(PJSIP/10${EXTEN},30)
same => n,Playback(kv-number&vm-isunavail)
same => n,Hangup()

exten => _[1-5][0,1-7],1,NoOp(Call on local subscriber)
same => n,Dial(PJSIP/1${EXTEN},30)
same => n,Playback(kv-number&vm-isunavail)
same => n,Hangup()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question