Issue with a custom context

Looking to see if anyone has run across this, or my commands are slightly off or something. I’m manually applying the outgoing callerid when a person dials an outside number. Instead of applying the callerid on each dialplan (or route plan in Cisco’s world), I am trying to use something a bit different.

; 1040 begin --------------

[1040]

exten => _NXXXXXX,1,Set(CALLERID(num)=5202205056
exten => _NXXXXXX,2,GoTo(1040-local,${EXTEN})
exten => _NXXNXXXXXX,1,Set(CALLERID(num)=5202205056)
exten => _NXXNXXXXXX,2,GoTo(1040-local,${EXTEN})
exten => _1NXXNXXXXXX,1,Set(CALLERID(num)=5202205056)
exten => _1NXXNXXXXXX,2,GoTo(1040-local,${EXTEN})

[1040-local]

exten => _220XXXX,1,Macro(outbound-hunt,1040,1520${EXTEN})
exten => _226XXXX,1,Macro(outbound-hunt,1040,1520${EXTEN})
exten => _NXXNXXXXXX,1,Macro(outbound-hunt,1040,${EXTEN})
exten => _1NXXNXXXXXX,1,Macro(outbound-hunt,1040,${EXTEN})

; 1040 end ----------------

When I try making a call (tried 10 digit/11 digit/7 digit), I get the below error. Anyone see where I missed something?

[INSERT INTO cel (eventtype,eventtime,cid_name,cid_num,cid_ani,cid_rdnis,cid_dnid,exten,context,channame,appname,appdata,amaflags,accountcode,uniqueid,linkedid,peer,userdeftype,userfield) VALUES (‘CHAN_START’,{ts ‘2014-02-07 21:30:37’},‘test’,‘1234’,‘’,‘’,‘’,‘7605838270’,‘1040’,‘SIP/1234-00001041’,‘’,‘’,3,‘’,‘1391837437.4163’,‘1391837437.4163’,‘’,‘’,‘’)]
– Executing [7605838270@1040:1] Set(“SIP/1234-00001041”, “CALLERID(num)=5202205056”) in new stack
– Executing [7605838270@1040:2] Goto(“SIP/1234-00001041”, “1040-local”) in new stack
– Goto (1040,7605838270,1040)
– Auto fallthrough, channel ‘SIP/1234-00001041’ status is ‘UNKNOWN’
[INSERT INTO cel (eventtype,eventtime,cid_name,cid_num,cid_ani,cid_rdnis,cid_dnid,exten,context,channame,appname,appdata,amaflags,accountcode,uniqueid,linkedid,peer,userdeftype,userfield) VALUES (‘HANGUP’,{ts ‘2014-02-07 21:30:37’},‘test’,‘5202205056’,‘1234’,‘’,‘7605838270’,‘7605838270’,‘1040’,‘SIP/1234-00001041’,‘’,‘’,3,‘’,‘1391837437.4163’,‘1391837437.4163’,‘’,‘’,‘’)]
[INSERT INTO cel (eventtype,eventtime,cid_name,cid_num,cid_ani,cid_rdnis,cid_dnid,exten,context,channame,appname,appdata,amaflags,accountcode,uniqueid,linkedid,peer,userdeftype,userfield) VALUES (‘CHAN_END’,{ts ‘2014-02-07 21:30:37’},‘test’,‘5202205056’,‘1234’,‘’,‘7605838270’,‘7605838270’,‘1040’,‘SIP/1234-00001041’,‘’,‘’,3,‘’,‘1391837437.4163’,‘1391837437.4163’,‘’,‘’,‘’)]
[INSERT INTO cel (eventtype,eventtime,cid_name,cid_num,cid_ani,cid_rdnis,cid_dnid,exten,context,channame,appname,appdata,amaflags,accountcode,uniqueid,linkedid,peer,userdeftype,userfield) VALUES (‘LINKEDID_END’,{ts ‘2014-02-07 21:30:37’},‘test’,‘5202205056’,‘1234’,‘’,‘7605838270’,‘7605838270’,‘1040’,‘SIP/1234-00001041’,‘’,‘’,3,‘’,‘1391837437.4163’,‘1391837437.4163’,‘’,‘’,‘’)]

There are three required arguments to a Goto command, you are missing the ‘priority’ in all cases.

I’m not sure I’m following you. Can you give me an example?

OK, I found it.

exten => _NXXNXXXXXX,2,GoTo(1040-local,${EXTEN},1) <<<—It was missing the “1” at the end". I’m assuming thats the priority. Now, what would it look like where there are multiple priorities? What would be the advantage?