My idea is to use a variable as a extension.
The dialplan is:
[globals]
USER_1=1111
SUBSCRIBER_NUMBER=2222
[outgoing_CALL-7777]
exten => _.,1,Verbose(SUBSCRIBER_NUMBER before value assignment is:${SUBSCRIBER_NUMBER})
same => n,Set(SUBSCRIBER_NUMBER=${SHELL(echo 3333)})
same => n,Verbose(SUBSCRIBER_NUMBER after value assignment is:${SUBSCRIBER_NUMBER})
exten => ${SUBSCRIBER_NUMBER},n,Dial(SIP/${EXTEN})
same => n,Hangup()
and the CLI output is:
== Using SIP RTP CoS mark 5
> 0xb670a020 -- Strict RTP learning after remote address set to: 192.168.1.132:8000
-- Executing [3333@outgoing_CALL-7777:1] Verbose("SIP/7777-00000003", "SUBSCRIBER_NUMBER before value assignment is:2222") in new stack
SUBSCRIBER_NUMBER before value assignment is:2222
-- Executing [3333@outgoing_CALL-7777:2] Set("SIP/7777-00000003", "SUBSCRIBER_NUMBER=3333
-- ") in new stack
-- Executing [3333@outgoing_CALL-7777:3] Verbose("SIP/7777-00000003", "SUBSCRIBER_NUMBER after value assignment is:3333
-- ") in new stack
SUBSCRIBER_NUMBER sfter value assignment is:3333
-- Auto fallthrough, channel 'SIP/7777-00000003' status is 'UNKNOWN'
As u can see command exten => ${SUBSCRIBER_NUMBER},n,Dial(SIP/${EXTEN})
isn’t recognized…because of command:
same => n,Set(SUBSCRIBER_NUMBER=${SHELL(echo 6666)})
in other words if I assignement it in dialplan. Verbose showing real value but it isnt recognize as extension typed as: ${SUBSCRIBER_NUMBER}
If I omitt the line:
same => n,Set(SUBSCRIBER_NUMBER=${SHELL(echo 3333)})
variable in as extension is recognised and the call is routed.
Why it do not working if I reassignement the global variable again?
I even try instead of line:
same => n,Set(SUBSCRIBER_NUMBER=${SHELL(echo 3333)})
to type:
same => n,Set(SUBSCRIBER_NUMBER=3333)
but the result is same…
Any idea?