Variables and extensions help (Call forwarding)

Here is the important bits of extensions.conf

Calls originating from our analog pbx (yuck) :stuck_out_tongue:

[pbx-a] include => intfeat exten => _NXXXXXX,1,Macro(out-cust,${EXTEN}) exten => _1NXXNXXXXXX,1,Macro(out-cust,${EXTEN})

Here is intfeat

[code]exten => *72,1,GotoIf($[ ${ONCALL} = 1]?2:5)
exten => *72,2,Playback(enabled)
exten => *72,3,SayDigits(${OCNUMBER})
exten => *72,4,Hangup()
exten => *72,5,SetAccount(transfer)
exten => *72,6,Background(beep)
exten => *72,7,Set(TIMEOUT(response)=15)
exten => _XXXXXXXXXX,1,SetGlobalVar(OCNUMBER=${EXTEN})
exten => _XXXXXXXXXX,n,SetGlobalVar(ONCALL=1)
exten => _XXXXXXXXXX,n,Wait(1)
exten => _XXXXXXXXXX,n,SayDigits(${OCNUMBER})
exten => _XXXXXXXXXX,n,Hangup()

exten => *73,1,SetGlobalVar(ONCALL=0)
exten => *73,n,SetAccount(transfer)
exten => *73,n,Playback(disabled)

exten => 778,1,VoicemailMain()[/code]

And finally inbound calls

[in-cust] exten => s,1,Answer() exten => s,2,Gosub(cid,s,1) exten => s,3,GotoIf($[ ${ONCALL}:1]?4:5) exten => s,4,Goto(ocmenu,s,1) exten => s,5,Macro(superdial,SIP/402,,,,spa2,1) exten => s,n,Macro(superdial,SIP/403,,,,spa3,1) exten => s,n,Macro(superdial,SIP/404,,,,spa4,1) exten => s,n,Hangup()

Inbound dialing is simpleish, asterisk answers, performs a callerid sub on it (checks for company cell phone numbers and rewrites the name if it is, so we get names instead of just cellular call), Checks the variable for being “on call” and if it is, jump to that menu, if not ring.

The problem is that every once in a while the system will flip to “on” without anyone dialing *72 first, I set the account code on that so I can see when that is being done, and it dosen’t show up in the CSV, what does happen is that on an occasional 11 digit number that gets set to the on call number, and the system sets oncall to “1”

Here is the line our of Master.csv where it happened last time

403 1734320072 pbx-a "403" <403> SIP/403-3f77 Hangup 5/24/2006 9:38 5/24/2006 9:38 8 0 NO ANSWER DOCUMENTATION

403 is the analog PBX (line 3), and somehow that 11 digit number made it into the oncall stuff.

It’s probbly something simple but i’m pulling my hair out trying to see where it’s screwing up, thanks for your help!


Could it be that your trunk (ZAP eg) is using TrunkMSD=1, therefore
01734320072 (11 digits) become 1734320072 which is matching your pattern unwanted due to the leading “1” ?

All the public trunks are broadvoice, and all the equipment to interface to our analog PBX is Sipura boxes, so no.