字符串模式匹配的问题

时间:2014-03-14 10:13:06

标签: asterisk

Asterisk抱怨不存在一个扩展名:

[Mar 14 11:07:22] NOTICE[28139]: chan_sip.c:22622 handle_request_invite: Call from 'sippartner1' (99.23.69.31:5060) to extension 'iax2partner69#4000' rejected because extension not found in context 'carriers'.

但我确实在上下文carriers中定义了这种模式:

pbx1*CLI> dialplan show @carriers

  '_iax2.' =>       1. Set(exten=${EXTEN:5})                      [pbx_config]
                    2. Set(iax2partner=${CUT(exten,#,1)})         [pbx_config]
                    3. Set(iax2exten=${CUT(exten,#,2)})           [pbx_config]
                    4. Log(NOTICE,EXTEN=${EXTEN} exten=${exten} iax2partner=${iax2partner} iax2exten=${iax2exten}) [pbx_config]
                    5. Dial(IAX2/${iax2partner}/${iax2exten})     [pbx_config]

这是运营商的来源:

[carriers]

...

exten => _iax2.,1,Set(exten=${EXTEN:5})
exten => _iax2.,n,Set(iax2partner=${CUT(exten,#,1)})
exten => _iax2.,n,Set(iax2exten=${CUT(exten,#,2)})
exten => _iax2.,n,Log(NOTICE,EXTEN=${EXTEN} exten=${exten} iax2partner=${iax2partner} iax2exten=${iax2exten})
exten => _iax2.,n,Dial(IAX2/${iax2partner}/${iax2exten})

为什么星号与模式_iax2.不匹配?

1 个答案:

答案 0 :(得分:0)

快速而肮脏的方法

exten => _[i][a][x][2].,1,Set(exten=${EXTEN:5})
same=>n,Set(iax2partner=${CUT(exten,#,1)})
same=>n,Set(iax2exten=${CUT(exten,#,2)})
same=>n,Log(NOTICE,EXTEN=${EXTEN} exten=${exten} iax2partner=${iax2partner} iax2exten=${iax2exten})
same=>n,Dial(IAX2/${iax2partner}/${iax2exten})