[asterisk-users] set(CALLERID(name) not working

sean darcy seandarcy2 at gmail.com
Tue Nov 11 21:50:59 CST 2008


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




More information about the asterisk-users mailing list