Time based rules and two registrations on the same ip addres

Hi,

I have two sip registrations into my asterisk machine from the same ip address using different ports (5060 and 5061). This works well (incoming and outgoing on the two ports) until I try to setup time based rules. It then becomes an all or nothing scenario.

Some of you may have already guessed I am using a sipura 3102 gateway but I don’t want those helping to focus too much on that as I think the problem has nothing to do with it and everything to do with * (or the way I set it up).

Background:

  1. The PSTN line on the 3102 is coming into * on port 5060. Incoming calls are routed to the correct extension, outgoing calls work fine too.
  2. The SIP line on the 3102 is coming into * on port 5061. Everything works well there too. The extension is even part of a ringgroup and that works as well.

The problem:

  1. If I create a time based rule where calls from the PSTN are sent to voicemail after 2pm or to a ring group otherwise it will also apply this rule to calls made from the SIP extension on the 3102. For example:
  • Call comes in on the PST. If it is after 2 pm it goes to voicemail or it rings the ring group if earlier. The CID displayed is the caller’s number
  • Extension on the 3102 makes a call. The call does not go through as it will either call the ring group or go to voice mail as if it was an incoming call on the PSTN. BUT it displays the extension number in the CID NOT the PSTN trunk number or any other number that would make you think the PSTN and the SIP extension are actually using the same port. THis is also backed by the debug from the CLI which shows the call coming in on the right port.
  1. If I disable the time based rule everything works fine: The SIP extension on the 3102 can make calls , etc.

So my questions are:

  1. Is there a documented problem with time based rules and having two registrations on the same IP address?
  2. Has anyone got this to work?

I can post config files / debug logs but I am actually running *Now and didn’t want to get told to post on that section of the forums as there aren’t many people replying there.

Thanks in advance

Diego

BTW. *NOw has the latest updates and the 3102 is running firmware 5.1.7

extensions.conf

Here is the extensions.conf with the time based rules enabled on the PST trunk. I never deleted the sample stuff though.

Here is some info that may help understand the file:

  1. Trunk_2 is for PennyTel my main VOIP acct
  2. Trunk_1 is for Faktortel my backup VOIP acct
  3. Trunk_3 is for another asterisk server located in another country.
  4. Trunk_4 is the PSTN line. It is meant for incoming calls only (and for dialing 000).
  5. the RMS Ringgroup is ext 4010 and 4012 (which is the sip extension on the 3102)

[general]
static=yes
writeprotect=no
clearglobalvars=no
[dundi-e164-canonical]

[dundi-e164-customers]

[dundi-e164-via-pstn]

[dundi-e164-local]
include=dundi-e164-canonical
include=dundi-e164-customers
include=dundi-e164-via-pstn
[dundi-e164-switch]
switch=DUNDi/e164
[dundi-e164-lookup]
include=dundi-e164-local
include=dundi-e164-switch
[macro-dundi-e164]
exten=s,1,Goto(${ARG1},1)
include=dundi-e164-lookup
[iaxtel700]
exten=_91700XXXXXXX,1,Dial(IAX2/${GLOBAL(IAXINFO)}@iaxtel.com/${EXTEN:1}@iaxtel)
[iaxprovider]

[trunkint]
exten=_9011.,1,Macro(dundi-e164,${EXTEN:4})
exten=_9011.,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[trunkld]
exten=_91NXXNXXXXXX,1,Macro(dundi-e164,${EXTEN:1})
exten=_91NXXNXXXXXX,n,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[trunklocal]
exten=_9NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[trunktollfree]
exten=_91800NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten=_91888NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten=_91877NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
exten=_91866NXXXXXX,1,Dial(${GLOBAL(TRUNK)}/${EXTEN:${GLOBAL(TRUNKMSD)}})
[international]
ignorepat=9
include=longdistance
include=trunkint
[longdistance]
ignorepat=9
include=local
include=trunkld
[local]
ignorepat=9
include=default
include=trunklocal
include=iaxtel700
include=trunktollfree
include=iaxprovider
include=parkedcalls
[macro-trunkdial]
exten=s,1,Dial(${ARG1})
exten=s,n,Goto(s-${DIALSTATUS},1)
exten=s-NOANSWER,1,Hangup
exten=s-BUSY,1,Hangup
exten=_s-.,1,NoOp
[macro-stdexten]
exten=s,1,Dial(${ARG2},20)
exten=s,2,Goto(s-${DIALSTATUS},1)
exten=s-NOANSWER,1,Voicemail(${ARG1},u)
exten=s-NOANSWER,2,Goto(default,s,1)
exten=s-BUSY,1,Voicemail(${ARG1},b)
exten=s-BUSY,2,Goto(default,s,1)
exten=_s-.,1,Goto(s-NOANSWER,1)
exten=a,1,VoicemailMain(${ARG1})
[macro-stdPrivacyexten]
exten=s,1,Dial(${ARG2},20|p)
exten=s,2,Goto(s-${DIALSTATUS},1)
exten=s-NOANSWER,1,Voicemail(${ARG1},u)
exten=s-NOANSWER,2,Goto(default,s,1)
exten=s-BUSY,1,Voicemail(${ARG1},b)
exten=s-BUSY,2,Goto(default,s,1)
exten=s-DONTCALL,1,Goto(${ARG3},s,1)
exten=s-TORTURE,1,Goto(${ARG4},s,1)
exten=_s-.,1,Goto(s-NOANSWER,1)
exten=a,1,VoicemailMain(${ARG1})
[macro-page]
exten=s,1,ChanIsAvail(${ARG1}|js)
exten=s,n,GoToIf([${AVAILSTATUS} = “1”]?autoanswer:fail)
exten=s,n(autoanswer),Set(_ALERT_INFO=“RA”)
exten=s,n,SIPAddHeader(Call-Info: Answer-After=0)
exten=s,n,NoOp()
exten=s,n,Dial(${ARG1}||)
exten=s,n(fail),Hangup
[demo]
exten=s,1,Wait(1)
exten=s,n,Answer
exten=s,n,Set(TIMEOUT(digit)=5)
exten=s,n,Set(TIMEOUT(response)=10)
exten=s,n(restart),BackGround(demo-congrats)
exten=s,n(instruct),BackGround(demo-instruct)
exten=s,n,WaitExten
exten=2,1,BackGround(demo-moreinfo)
exten=2,n,Goto(s,instruct)
exten=3,1,Set(LANGUAGE()=fr)
exten=3,n,Goto(s,restart)
exten=1000,1,Goto(default,s,1)
exten=1234,1,Playback(transfer,skip)
exten=1234,n,Macro(stdexten,1234,${GLOBAL(CONSOLE)})
exten=1235,1,Voicemail(1234,u)
exten=1236,1,Dial(Console/dsp)
exten=1236,n,Voicemail(1234,b)
exten=#,1,Playback(demo-thanks)
exten=#,n,Hangup
exten=t,1,Goto(#,1)
exten=i,1,Playback(invalid)
exten=500,1,Playback(demo-abouttotry)
exten=500,n,Dial(IAX2/guest@misery.digium.com/s@default)
exten=500,n,Playback(demo-nogo)
exten=500,n,Goto(s,6)
exten=600,1,Playback(demo-echotest)
exten=600,n,Echo
exten=600,n,Playback(demo-echodone)
exten=600,n,Goto(s,6)
exten=76245,1,Macro(page,SIP/Grandstream1)
exten=_7XXX,1,Macro(page,SIP/${EXTEN})
exten=7999,1,Set(TIMEOUT(absolute)=60)
exten=7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n|d)
exten=8500,1,VoicemailMain
exten=8500,n,Goto(s,6)
[page]
exten=_X.,1,Macro(page,SIP/${EXTEN})
[default]
exten=8500,1,VoicemailMain
exten=8500,n,Hangup
include=voicemenu-custom-1
exten=7002,1,Goto(ringroups-custom-1|s|1)
exten=4000,1,Goto(voicemenu-custom-1|s|1)
[asterisk_guitools]
exten=executecommand,1,System(${command})
exten=executecommand,n,Hangup()
exten=record_vmenu,1,Answer
exten=record_vmenu,n,Playback(vm-intro)
exten=record_vmenu,n,Record(${var1})
exten=record_vmenu,n,Playback(vm-saved)
exten=record_vmenu,n,Playback(vm-goodbye)
exten=record_vmenu,n,Hangup
exten=play_file,1,Answer
exten=play_file,n,Playback(${var1})
exten=play_file,n,Hangup
hasbeensetup=Y
[DID_trunk_1]
include=default
[DID_trunk_2]
include=default
exten=_X.,1,Goto(default|4010|1)
exten=s,1,Goto(default|4010|1)
[timebasedrules]
exten=1,1,NoOp(RMS Hours)
exten=1,n,GotoIfTime(04:00-14:00|tue-sat|01-31|jan-dec?ringroups-custom-1,s,1)
exten=1,n,Goto(default,4001,1)
[DID_trunk_3]
include=default
exten=_X.,1,Goto(default|4010|1)
exten=s,1,Goto(default|4010|1)
[globals]
CONSOLE=Console/dsp
IAXINFO=guest
TRUNK=Zap/g2
TRUNKMSD=1
trunk_1=SIP/trunk_1
trunk_2=SIP/trunk_2
trunk_3=SIP/trunk_3
trunk_4=SIP/trunk_4
[numberplan-custom-1]
plancomment=DialPlan1
include=default
exten=_1XXX,1,Macro(trunkdial,${trunk_3}/${EXTEN:0})
comment=_1XXX,1,JTC 1xxx,standard
exten=_4XX,1,Macro(trunkdial,${trunk_3}/${EXTEN:0})
comment=_4XX,1,JTC 4xx,standard
exten=_04XXXXXXXX,1,Macro(trunkdial,${trunk_2}/${EXTEN:0})
comment=_04XXXXXXXX,1,Aust- Mobile,standard
exten=_9XXXXXXX,1,Macro(trunkdial,${trunk_2}/612${EXTEN:0})
comment=_9XXXXXXX,1,Local,standard
exten=_000,1,Macro(trunkdial,${trunk_4}/${EXTEN:0})
comment=_000,1,000,standard
exten=_011XXXXXXXXXX!,1,Macro(trunkdial,${trunk_2}/${EXTEN:3})
comment=_011XXXXXXXXXX!,1,International,standard
exten=_1800XXXXXX,1,Macro(trunkdial,${trunk_2}/61${EXTEN:0})
comment=_1800XXXXXX,1,1800 Numbers,standard
exten=_0XXXXXXXXX,1,Macro(trunkdial,${trunk_2}/61${EXTEN:1})
comment=_0XXXXXXXXX,1,Long Distance STD,standard
exten=_1300XXXXXX,1,Macro(trunkdial,${trunk_2}/61${EXTEN:0})
comment=_1300XXXXXX,1,1300 Numbers,standard
[voicemenu-custom-1]
comment=mainmenu
exten=s,1,Answer
exten=s,2,Background(thank-you-for-calling)
exten=s,3,Background(if-u-know-ext-dial)
exten=s,4,Background(otherwise)
exten=s,5,Background(pls-hold-while-try)
exten=s,6,Background(to-reach-operator)
include=numberplan-custom-1
include=default
exten=0,1,AGI(jukebox.agi)
exten=9,1,DISA(no-password|default)
[numberplan-custom-2]
include=default
plancomment=DialPlan2
exten=_0406XXXXXX,1,Macro(trunkdial,${trunk_4}/${EXTEN:0})
comment=_0406XXXXXX,1,test,standard
[DID_trunk_4]
include=default
exten=_X.,1,Goto(timebasedrules|1|1)
exten=s,1,Goto(timebasedrules|1|1)
[ringroups-custom-1]
gui_ring_groupname=RMS
exten=s,1,NoOp(RINGGROUP)
exten=s,n,Dial(SIP/4010&SIP/4012,15)
exten=s,n,Voicemail(4010,b)
[numberplan-custom-3]
include=default
plancomment=Faktortel
exten=_0406X!,1,Macro(trunkdial,${trunk_1}/${EXTEN:0})
comment=_0406X!,1,mobile,standard
exten=_1X!,1,Macro(trunkdial,${trunk_1}/${EXTEN:0})
comment=_1X!,1,1,standard