Conditional CallerID
From Etel
Contents |
[edit]
Title
Conditional CallerID
[edit]
Problem
You'd like to set outgoing CallerID for users who have an external DID to their own number, but use the default main number for all other extensions.
[edit]
Solution
Use func_odbc to retrieve DID information from a database and a Set combined with an IF() to get conditional setting.
func_odbc.conf:
[LOOKUP_DID]
read=SELECT did FROM extensions WHERE channel='${ARG1}'
dsn=asterisk
extensions.conf:
exten => _9-NXX-XXXX,1,Set(CALLERID(num)=${ODBC_LOOKUP_DID(${CUT(CHANNEL,-,1)})})
exten => _9-NXX-XXXX,n,Set(${IF($[${LEN(${CALLERID(num)})} = 0]?CALLERID(num):foo)}=6152345678)
exten => _9-NXX-XXXX,n,Dial(Zap/g0/${EXTEN:1})
[edit]
Discussion
It's important to note that you need the string "foo" in there, although its purpose is somewhat strange. Simply put, the Set application will always set some variable, but you're conditionally controlling which variable to set; "foo" is simply a placeholder for a garbage variable to set when you don't want another variable (in this case, the function CALLERID()) to be set.
[edit]
See Also:
[edit]
Metadata
- By: TilghmanLesher
