Extensions_Custom.conf Quick Pointer

tony722

New Member
Joined
Apr 6, 2011
Messages
18
Reaction score
0
So to help me better understand the workings of Extensions_Custom.conf I'd like to do the following:

insert a NoOp(This is a test) into every outgoing call.
and
insert a NoOp(We were here) into every call to _1xx

Thanks!

Tony
 
Hi

Copy the existing context you want to modify out of extensions_additional.conf, and put it in extensions_override_freepbx.conf, then make the modifications, this will then override the original.

Joe
 
That's interesting. :) Seems that should work.

Is that the only way or are there other ways someone could accomplish the original goal (for the purpose of rounding out my education on the subject)?

Thanks!

Tony
 
If you're using FreePBX, Joe's method is the way FreePBX is designed to work.
 
For outgoing calls Joe's method is really the only efficient one, because by default all extensions are set to use the from-internal context. But just for the sake of your education, I'll show how you could do what you want, by changing the extension context for at least one extension (the one you will make test calls from) to custom-from-internal. Then in extensions_custom.conf you could do this:

Code:
[custom-from-internal]
exten => _1XX,1,NoOp(We were here)
exten => _1XX,n,Goto(from-internal,${EXTEN},1)
exten => _[*0-9]!,1,NoOp(This is a test)
exten => _[*0-9]!,n,Goto(from-internal,${EXTEN},1)
exten => h,1,Macro(hangupcall)


Now here's an example of doing it Joe's way, in extensions_override_freepbx.conf (the advantage is you don't have to change the context in every one of your extensions):

Code:
[from-internal]
include => my-custom-stuff

[from-internal-original]
include => from-internal-xfer
include => bad-number

[my-custom-stuff]
exten => _1XX,1,NoOp(We were here)
exten => _1XX,n,Goto(from-internal-original,${EXTEN},1)
exten => _[*0-9]!,1,NoOp(This is a test)
exten => _[*0-9]!,n,Goto(from-internal-original,${EXTEN},1)
exten => s,1,Goto(from-internal-original,s,1)
exten => h,1,Macro(hangupcall)

The last three lines should not be changed unless you know what you are doing. And bear in mind that the [from-internal-original] context mirrors the contents of the original [from-internal] context in extensions.conf, so if that ever changes you'll need to copy the revised context here.

Note: If by some odd chance you have any problems with calls not going through that formerly would, try changing both instances of _[*0-9]! to _. (underscore followed by period) — Asterisk will complain (in its log file) if you do this, and most developers will tell you it's not good practice (because that pattern catches things that it shouldn't) but even the FreePBX developers have been known to use that pattern in a few places. If that pattern fixes the problem, then you should probably try to determine what you're sending that causes the first pattern to fail and construct a new pattern that will catch that, without resorting to using _. (or you could just not worry about it and ignore Asterisk whining about it, and see how that works out). Another possible substitution for that pattern would be _[*0-9A-Za-z]! which should catch darn near anything, without using _.
 
Thank you so much everybody! That was exactly what I needed. I feel very enlightened now. :balloonb: I now have one more key to understanding Asterisk.

Thanks again so much!

Tony

"With great power comes great responsibility."
 

Members online

No members online now.

Forum statistics

Threads
26,688
Messages
174,412
Members
20,259
Latest member
Fadeek86
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