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 [EMAIL PROTECTED]:2] Answer("IAX2/john-7775", "")
> in new stack
> -- Executing [EMAIL PROTECTED]:4] Gosub("IAX2/john-7775",
> "set-callerid-name|02025462677|1") in new stack
> -- Executing [EMAIL PROTECTED]:1]
> Set("IAX2/john-7775", "CALLERID(name) = "Fred" ") in new stack
> -- Executing [EMAIL PROTECTED]:2]
> NoOp("IAX2/john-7775", "CALLERID: Cell Phone CT") in new stack
> -- Executing [EMAIL PROTECTED]:3]
> Return("IAX2/john-7775", "") in new stack
> -- Executing [EMAIL PROTECTED]: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
_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users