Advanced Dial Plan

Hi Guys,

I Have this peers on my sip.conf

[provider-302333-3000]
type=friend
context=provider
secret=xpto
username=3023333000
host=sip.provider.com
fromuser=3023333000
insecure=very
canreinvite=no

[provider-302222-3001]
type=friend
context=provider
secret=xpto
username=3022223001
host=sip.provider.com
fromuser=3022223001
insecure=very
canreinvite=no

I Have in my sip.conf two extension 3000 and 3001.

I have this rule in my extensions.conf

exten=> _X.,1,Dial(SIP/${EXTEN}@provider-302333-${CALLERID(num)},60,Tt)
exten=> _X.,2,Hangup

exten=> _X.,1,Dial(SIP/${EXTEN}@provider-302222-${CALLERID(num)},60,Tt)
exten=> _X.,2,Hangup

And every calls made by my both extension was using the first rule, so calls from extension 3000 match with peer and work, but calls from 3001 didn’t match with peer and I got error.

How can I use a conditional sentence like:

if {${CALLERID(num)}=3000)
{
exten=> _X.,1,Dial(SIP/${EXTEN}@provider-302333-${CALLERID(num)},60,Tt)
exten=> _X.,2,Hangup
}
else
if {${CALLERID(num)}=3001)
{
exten=> _X.,1,Dial(SIP/${EXTEN}@provider-302222-${CALLERID(num)},60,Tt)
exten=> _X.,2,Hangup
}

Thanks.


Frederico Madeira
fmadeira@gmail.com
www.madeira.eng.br

try this:

try this:

http://www.voip-info.org/wiki-Asterisk+cmd+GotoIf

Hi,

This may help.

[outgoing]
exten => _X.,1,GotoIf($["${CALLERID(num)}" = “3000”]?provider-302333,${EXTEN},1)
exten => _X.,2,GotoIf($["${CALLERID(num)}" = “3001”]?provider-302222,${EXTEN},1)
exten => _X.,3,Congestion()

[provider-302333]
exten=> _X.,1,Dial(SIP/${EXTEN}@provider-302333-${CALLERID(num)},60,Tt)
exten=> _X.,2,Hangup

[provider-302222]
exten=> _X.,1,Dial(SIP/${EXTEN}@provider-302222-${CALLERID(num)},60,Tt)
exten=> _X.,2,Hangup