В какой момент обновляется переменная? Я пытаюсь приводить CID к "общему" виду, так чтобы можно было перезванивать назад без дополнительных телодвижений.
[cid-reread]
exten => cid-reread,1,Noop(=== Caller ID manipulation, CID=${CALLERID(num)} ===)
same => n,Set(CALLERID(num)=${IF([REGEX("\<7812[0-9]\{7\}\>" , ${CALLERID(num)} ) = 1 ]?${CALLERID(num):4}:${CALLERID(num)})})
same => n,NoOp(=== New CID is ${CALLERID(num)} ===)
same => n,Set(CALLERID(num)=${IF([REGEX("^812[0-9]\{7\}$" , ${CALLERID(num)} ) = 1 ]?${CALLERID(num):3}:${CALLERID(num)})})
same => n,NoOp(=== New CID is ${CALLERID(num)} ===)
same => n,Set(CALLERID(num)=${IF([REGEX("^[0-9]\{10\}$" , ${CALLERID(num)} ) = 1 ]?+7${CALLERID(num)}:${CALLERID(num)})})
same => n,NoOp(=== New CID is ${CALLERID(num)} ===)
same => n,GoTo(incoming,incoming,1)
в логе астериска странные вещи происходят
-- Executing [@:1] Goto("SIP/", "incoming,cid-reread,1") in new stack
-- Goto (incoming,cid-reread,1)
-- Executing [cid-reread@incoming:1] NoOp("SIP/", "=== Caller ID manipulation, CID=8121234567 ===") in new stack
-- Executing [cid-reread@incoming:2] Set("SIP/", "CALLERID(num)=234567") in new stack
-- Executing [cid-reread@incoming:3] NoOp("SIP/", "=== New CID is 234567 ===") in new stack
-- Executing [cid-reread@incoming:4] Set("SIP/", "CALLERID(num)=567") in new stack
-- Executing [cid-reread@incoming:5] NoOp("SIP/", "=== New CID is 567 ===") in new stack
-- Executing [cid-reread@incoming:6] Set("SIP/", "CALLERID(num)=+7567") in new stack
-- Executing [cid-reread@incoming:7] NoOp("SIP/", "=== New CID is +7567 ===") in new stack
-- Executing [cid-reread@incoming:8] Goto("SIP/", "incoming,incoming,1") in new stack
-- Goto (incoming,incoming,1)
-- Executing [incoming@incoming:1] NoOp("SIP/", "=== Incoming call from +7567 ===") in new stack
как получается что CALLERID(num) каждый раз перезаписывается, но подходит под все регэкспы?
при этом
root@Bakemono:~# cat test
1234567
8121234567
4951234567
78128128121
7495495495
9211234567
89219219212
79219219212
root@Bakemono:~# grep '^812[0-9]\{7\}$' test
8121234567
root@Bakemono:~# grep '^7812[0-9]\{7\}$' test
78128128121
root@Bakemono:~# grep '^[0-9]\{10\}$' test
8121234567
4951234567
7495495495
9211234567