Need urgent help

PanDemonAeon

New Member
Joined
Jun 4, 2020
Messages
1
Reaction score
0
Hello all, I have gotten a task in school regarding Asterisk, I have tried going through the documentation to see what the code that I will write bellow does, but I honestly cant put it together. Can anyone please try to explain what does it do. It will mean a lot. This is a Dialplan.

Code:
[Trunk_Name]


exten => _X.,1,Noop(Filtering +...................)


exten => _X.,2,GotoIf($["${CALLERID(num):0:1}" = "+"]?3:4)


exten => _X.,3,Set(CALLERID(num)=${CALLERID(num):2})


exten => _X.,4,Agi(agi://127.0.0.1)


exten => _X.,5,Hangup();
 
[Trunk_Name] 
exten => _X.,1,Noop(Filtering +...................) 
exten => _X.,2,GotoIf($["${CALLERID(num):0:1}" = "+"]?3:4)
 exten => _X.,3,Set(CALLERID(num)=${CALLERID(num):2}) 
exten => _X.,4,Agi(agi://127.0.0.1) 
exten => _X.,5,Hangup();
Have you installed Asterisk by itself or are you using a particular distro such as incrediblepbx.com
Most of your dialplan questions should be answered here.

It helps to know the context of where your question comes from.
You couldn't do much better than to start here

For Asterisk dialplan tutorials you could search on youtube or a search engine.

You may find this link useful.
Code:
[Trunk_Name]  ;  '[ ]' used to identify a context in the dialplan but here to identify the name that you choose for your trunk such as  'FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, Digium, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and .....'

exten => _X.,1,Noop(Filtering +...................)   '_' to match this 'X.' accepts any number of digits (0...9) ; '.' means none or  any number of digits.  So _X.  matches any number of 1 or more digits
'1' is 1st operation these are numbered sequentially and asterisk moves from 1st to next.  the numbering can be auto by the next exten => _X. being
Noop is function meaning No operation it does nothing but places an identifying label which will be useful for debugging as you watch the Asterisk CLI while the call goes through as astrisk works.
 
Last edited:
_X.,1 -- match anything dialed, sequence (or step) 1.
_X.,2 -- match anything dialed, sequence (or step) 2.

etc..



[Trunk_Name]


exten => _X.,1,Noop(Filtering +...................) ----- display info in asterisk CLI


exten => _X.,2,GotoIf($["${CALLERID(num):0:1}" = "+"]?3:4)
 ----- if the callerid starts with "+" , go to 3 (line below) . Otherwise go to 4 (the AGI line)

exten => _X.,3,Set(CALLERID(num)=${CALLERID(num):2}) ---- Remove first two digits from the callerid


exten => _X.,4,Agi(agi://127.0.0.1) --- send the call to AGI ( binding on 127.0.0.1 -- agi script is missing here)


exten => _X.,5,Hangup(); --- hang up the call


Basically, what this script does is check if a callerid number starts with plus (for example +1234567890) , and if it does start with plus, remove the + and the second digit , so the callerid becomes 234567890 . Then send the call to AGI.
 

Members online

Forum statistics

Threads
26,687
Messages
174,410
Members
20,257
Latest member
Dempan
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top