Simple(?) extension question

I have multiple phone numbers under the same SIP service provider.
Neet to have dial in rules when a direct number is being used. Thought I can do this very easily…
Using AsteriksNow GUI I was not able to do this at all.

So trying manually…
Starting situation generated by GUI:
[DID_trunk_1]
include = default
exten = _X.,1,Goto(default|6005|1)
exten = s,1,ExecIf($[ “${CALLERID(num)}”="" ],SetCallerPres,unavailable)
exten = s,2,ExecIf($[ “${CALLERID(num)}”="" ],Set,CALLERID(all)=unknown <0000000>)
exten = s,3,Goto(default|6005|1)

(all incoming calls are routed to 6005)

I thought I can do the trick just adding one rule by GUI:
[DID_trunk_1]
include = default
exten = _X.,1,Goto(default|6005|1)
exten = _0XXXXXXX50,1,Goto(default|6000|1)
exten = s,1,ExecIf($[ “${CALLERID(num)}”="" ],SetCallerPres,unavailable)
exten = s,2,ExecIf($[ “${CALLERID(num)}”="" ],Set,CALLERID(all)=unknown <0000000>)
exten = s,3,Goto(default|6005|1)

(All incoming calls are still routed to 6005)

So, I tried this:
[DID_trunk_1]
include = default
exten = _X.,1,Goto(default|6005|1)
exten = s,1,ExecIf($[ “${CALLERID(num)}”="" ],SetCallerPres,unavailable)
exten = s,2,ExecIf($[ “${CALLERID(num)}”="" ],Set,CALLERID(all)=unknown <0000000>)
exten = _0XXXXXXX50,3,Goto(default|6000|1)
exten = s,4,Goto(default|6005|1)

Incoming calls are rejected. Asterisk console says:
== Auto fallthrough, channel ‘SIP/0555555550-b5900dc0’ status is ‘UNKNOWN’

Anyway, incoming call rules are not working - at least the way AsteriskNow generates extension lines…

Maybe you can help me out. Thanks,

Axel

I figured it out. Cia,

Axel

this line states
exten = _X.,1,Goto(default|6005|1)

Anything started with number and any lenght go to 6005. So it is normal that you call go to 6005.

First you need to determine in what format your provider send you DID’s

Sample:
Lets say you got 5 numbers there

08000031
08000032
08000033
08000034
08000035

Provider send you the complete chain, and you have sip phones set correctly with this usernames (31-35)

so you need to add extension like this
exten => _0800003X,1,Dial(Sip/{EXTEN:6})

where {EXTEN:6} cut first 6 numbers from variable.
So you will be dialing Sip/31-35

have fun

Thanks Reaper.

Provider send targer number as sip:ccccccc@domain
So,
exten = _X.,1,Goto(default|6005|1)
is not true because the target “number” does not start with a digit.

exten = s,3,Goto(default|6005|1)
is true and it handles the forwarding to a default 6005 extension.

This is what I made:
[DID_trunk_1_2ndphase]
include = default
exten = _X.,1,Goto(default|6005|1)
exten = s,1,ExecIf($[ “${CALLERID(num)}”="" ],SetCallerPres,unavailable)
exten = s,2,ExecIf($[ “${CALLERID(num)}”="" ],Set,CALLERID(all)=unknown <0000000>)
exten = s,3,Goto(default|6000|1)
exten = 0XXXXXX750,1,Goto(default|6000|1)

[DID_trunk_1]
; has to be _. otherwise does not work properly
exten => _.,1,Noop(Fixing DID using information from SIP TO header)
exten => _.,n,Set(pseudodid=${SIP_HEADER(To)})
exten => _.,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => _.,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => _.,n,Goto(DID_trunk_1_2ndphase,${pseudodid},1)

Another issue:
Is there a way to play “person you tried to reach is speaking on the phone” while calling to a person whom is speaking at the moment? After that it may go to voice mail.

Thanks and ciao,

Axel

yes send them on s-${DIALSTATUS}

in case s-BUSY,1,Voicemail(b${PeersVoicemailExt}@context)

and also use ‘u’ option of voicemail.
easy as a cake, have fun.