I've tried to create a subroutine that sets callerid name based on number.
extensions.conf:
...........
exten => s,1,Answer()
exten => s,n,GoSub(set-callerid-name,0${CALLERID(num)},1)
exten => s,n,Dial(${mainline},60)
.......
[set-callerid-name]
exten => 0,1,NoOp( no CALLERID num set)
exten => 02025462677,1,Set(CALLERID(name) = "Fred" )
................
exten => _X.,2,NoOp(CALLERID: ${CALLERID(name)})
exten => _X.,3,Return()
But it doesn't work. CALLERID(name) isn't changed:
...............
-- Executing [2026478447 at teliax-in:2] Answer("IAX2/john-7775",
"")
in new stack
-- Executing [2026478447 at teliax-in:4] Gosub("IAX2/john-7775",
"set-callerid-name|02025462677|1") in new stack
-- Executing [02025462677 at set-callerid-name:1]
Set("IAX2/john-7775", "CALLERID(name) = "Fred" ")
in new stack
-- Executing [02025462677 at set-callerid-name:2]
NoOp("IAX2/john-7775", "CALLERID: Cell Phone CT") in new
stack
-- Executing [02025462677 at set-callerid-name:3]
Return("IAX2/john-7775", "") in new stack
-- Executing [2026478447 at teliax-in:5] Dial("IAX2/john-7775",
"DAHDI/1|60") in new stack
-- Called 1
............
Why not? How come CALLERID(name) isn't Fred??
sean
sean darcy wrote:> [set-callerid-name] > exten => 0,1,NoOp( no CALLERID num set) > exten => 02025462677,1,Set(CALLERID(name) = "Fred" ) > ................ > exten => _X.,2,NoOp(CALLERID: ${CALLERID(name)}) > exten => _X.,3,Return() > > But it doesn't work. CALLERID(name) isn't changed: >Perhaps try this: [set-callerid-name] exten => 02025462677,1,Set(CALLERID(name)=Fred)
sean darcy wrote:> > [set-callerid-name] > exten => 0,1,NoOp( no CALLERID num set) > exten => 02025462677,1,Set(CALLERID(name) = "Fred" ) > ................ >Try adding the following to your subroutine: SetCallerPres(allowed) I would also suggest that you put the name/number groups in either the internal database or mysql and then query against incoming number to name settings. It's quite simple. Doug -- Ben Franklin quote: "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."
sean darcy wrote:> I've tried to create a subroutine that sets callerid name based on number. > > extensions.conf: > > ........... > exten => s,1,Answer() > exten => s,n,GoSub(set-callerid-name,0${CALLERID(num)},1) > exten => s,n,Dial(${mainline},60) > ....... > > [set-callerid-name] > exten => 0,1,NoOp( no CALLERID num set) > exten => 02025462677,1,Set(CALLERID(name) = "Fred" ) > ................ > exten => _X.,2,NoOp(CALLERID: ${CALLERID(name)}) > exten => _X.,3,Return() > > But it doesn't work. CALLERID(name) isn't changed: > > ............... > -- Executing [2026478447 at teliax-in:2] Answer("IAX2/john-7775", "") > in new stack > -- Executing [2026478447 at teliax-in:4] Gosub("IAX2/john-7775", > "set-callerid-name|02025462677|1") in new stack > -- Executing [02025462677 at set-callerid-name:1] > Set("IAX2/john-7775", "CALLERID(name) = "Fred" ") in new stack > -- Executing [02025462677 at set-callerid-name:2] > NoOp("IAX2/john-7775", "CALLERID: Cell Phone CT") in new stack > -- Executing [02025462677 at set-callerid-name:3] > Return("IAX2/john-7775", "") in new stack > -- Executing [2026478447 at teliax-in:5] Dial("IAX2/john-7775", > "DAHDI/1|60") in new stack > -- Called 1 > ............ > > > Why not? How come CALLERID(name) isn't Fred?? > > sean > >Well I never did find out. What I did find out is that I could only set CALLERID(name) in the context the received the call, not in the subroutine. But if I set a dummy variable ( Set(cidname="Fred") ) in the subroutine, I could set the callerid back in the originating context ( Set(CALLERID(name) = ${cidname} ). Makes no sense, but there you are. sean