What is ext-did,${Var_TO_DID},1?

Greetings,

My first ‘installation’ of Asterisk was a Switchvox SMB server. This really peaked my interest so my second installation was a FreePBX server. I was able to get everything working except DID based call routing. My client has 2 separate companies sharing the same PBX so we need a different greeting depending on the DID his customer dials.

CallCentric has been very patient. They sent over the following script which was copied/pasted into my extensions_custom.conf file.

The first line appears to parse the header then compares the string to see if the call originated from a CallCentric server. If it does then it assigns the DID to Var_TO_DID.

I do not understand the next line.

GotoIF($["${Var_TO_DID}" != “”]?ext-did,${Var_TO_DID},1:7)

The way I read it… If $Var_TO_DID is not a zero length string (which means it is a CallCentric call) then ext-did,${Var_TO_DID},1 else goto from-pstn.

What is ext-did,${Var_TO_DID},1 and what does it do? This process seems problematic (calls route fine at night when calls fail to mach the Business Hours call condition but if they do match then the calls fail). If I can understand how this process works from beginning to end then I am more likely to resolve this issue.

[custom-incoming]
exten => s,1,Set(Var_FROM_DOMAIN=${CUT(CUT(SIP_HEADER(TO),@,2),>,1)})
exten => s,2,GotoIF($["${Var_FROM_DOMAIN}" = “callcentric.com”]?5:3)
exten => s,3,GotoIF($["${Var_FROM_DOMAIN}" = “ss.callcentric.com”]?5:4)
exten => s,4,GotoIF($["${Var_FROM_DOMAIN}" = “66.193.176.35”]?5:7)
exten => s,5,Set(Var_TO_DID=${CUT(CUT(SIP_HEADER(TO),@,1),:,2)})
exten => s,6,GotoIF($["${Var_TO_DID}" != “”]?ext-did,${Var_TO_DID},1:7)
exten => s,7,GoTo(from-pstn,s,1)
exten => h,8,Macro(hangupcall)

Callcentric don’t present the DID number in the normal way so it needs to be extracted from the SIP headers.

Here’s my callcentric config that works if it helps - sysadminman.net/blog/archives/210

[quote=“bucasia”]Callcentric don’t present the DID number in the normal way so it needs to be extracted from the SIP headers.

Here’s my callcentric config that works if it helps - sysadminman.net/blog/archives/210[/quote]

I understood that part and I appreciate the workaround. That will clean-up the CallCentric mess!

I’m still curious exactly what this string does:

exten => s,6,GotoIF($["${Var_TO_DID}" != “”]?ext-did,${Var_TO_DID},1:7)