[Asterisk-Users] Any way to _always_ execute certain commands in a dialplan context?

Kris Boutilier Kris.Boutilier at scrd.bc.ca
Fri Sep 3 08:26:51 MST 2004


You need to a method other than 'include =>', which effectively concatenates
the target of the include with the current context. Consider this approach
instead:

[foo-context]
; This needs to match the criteria for tollfree, say a 91800 prefix
exten => _91800.,1,SetCIDNum(123)
exten => _91800.,2,SetCIDName(XYZ)
exten => _91800.,3,Goto(tollfree,${EXTEN},1)

; This needs to match the criteria for local, say a 9 prefix
exten => _9.,1,SetCIDNum(123)
exten => _9.,2,SetCIDName(XYZ)
exten => _9.,3,Goto(local,${EXTEN},1)


It could also be implemented as:

[foo-context]
; This needs to match the criteria for tollfree, say a 91800 prefix
exten => _91800.,1,Macro(setOutgoingCLID)
exten => _91800.,2,Goto(tollfree,${EXTEN},1)

; This needs to match the criteria for local, say a 9 prefix
exten => _9.,1,Macro(setOutgoingCLID)
exten => _9.,2,Goto(local,${EXTEN},1)

[macro-setOutgoingCLID]
exten => s,1,SetCIDNum(123)
exten => s,2,SetCIDName(XYZ)


You'll need to implement 't' and 'i' handlers in [foo-context] and,
possibly, seperate 'h' handlers in [local] and [tollfree].

Hope that helps.

Kris Boutilier
Information Systems Coordinator
Sunshine Coast Regional District

-----Original Message-----
From: Kevin P. Fleming [mailto:kpfleming at backtobasicsmgmt.com]
Sent: September 2, 2004 7:42 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [Asterisk-Users] Any way to _always_ execute certain commands
in a dialplan context?


I've got a need to do something like the following:

[foo-context]
exten => _.,1,SetCIDNum(123)
exten => _.,2,SetCIDName(XYZ)
include => local
include => tollfree

But of course, this example won't work. The goal here is this: if a call 
ends up being handled by the "local" or "tollfree" contexts, I want 
those SetCID*** commands executed. Otherwise, I don't want them 
executed. I don't want to embed them into the local/tollfree contexts 
themselves, because then I'd have to figure out some way to store the 
"123" and "XYZ" values so that they could be used by commands in those 
contexts.

Essentially, what I want to do is override the CALLERIDNUM/CALLERIDNAME 
data for calls that are directed outside the PBX, and leave it alone for 
calls inside the PBX. That way internal users can see "John Q. Smith 
<322>" (different for each extension), but outside callees see "Smithco 
Widgets <602-555-1212>" (which would be identical for all of the 
extensions that can make outside calls).
{clip}



More information about the asterisk-users mailing list