Second Incoming VoIP IAX Connection

My current configuration: One VoIP connection for incoming and outgoing on the IAX protocol (works great).

What I want to do: Have another VoIP incoming-only connection on either SIP or IAX (IAX preferred).

My question: Is it possible to register a second IAX VoIP connection for incoming calls and not associate it with any extensions as outgoing or will Asterisk only register one? Would I have to use a different protocol (SIP) to have both registered?

I’m a Linux nerd but new to Asterisk, so a bit lost and would love some input.

What do you mean by extension. In Asterisk things in sip.conf are devices and things in extensions.conf are extensions. Although considered bad security practice, it is quite common to make the device name the same as the principle extension number for outging calls, so that you can use SIP/${EXTEN} in your dialplan, but that is something that people do, not something that Asterisk requires. There is no obvious correlation between incoming devices an extensions.

Also note that Asterisk doesn’t require separate incoming and outgoing devices, and it is not that uncommon when people try and use them for the outgoing device to be the one actually used for incoming requests.

Thanks for your input david551!

When I said “extensions” I did in fact mean the extensions defined in extensions.conf.

Would you happen to know if multiple number registrations are possible in asterisk, using the same protocol? For example, having both these lines in iax.conf:

register => <number>:<secret>@<provider>
register => <second-number>:<second-secret>@<provider>

My concern is that only one will register and the other will be ignored.

Your second question isn’t about extensions.

Both registrations will work from the Asterisk point of view, but they will both match the same sip.conf entry. It will depend on the remote system as to whether they are delivered to extension s or one derived from the original dialed number. Particularly if they end up s, specifying an extension on the register line may help.

Unless the peer is naughty and misuses From, they will both select the same sip.conf entry.

You can register a second sip/iax account no problem there. If you don’t want your users to be able to dial out from this trunk just don’t put anywhere in the context of your extensions.

Sorry. I answered for SIP, not IAX. I don’t know the answer for IAX.

I imagine they would have similar capabilities on that level though. So far I haven’t gotten it to work though. I put the registration for the number right below the first one, added [1234567899-in] directive and the [1234567899] directive, I still get “The number you have called is not assigned”. Which to me sounds like a carrier message for “This number is not in our system anywhere” not “This number is in our system but we don’t know where it goes yet because someone (me) hasn’t configured her PBX”. Would it help for me to post my config in here? If so I will post it in a couple of days if that’s alright. Weekends are not for IAX protocol buzzing through my head. :wink:

Post your config because I couldn’t get what have you done! :smiley:

Here is the complete contents of iax.conf and extensions.conf. Details obviously changed for privacy. :wink:

iax.conf:

[general]
register => 6662229999:666secret@iax.provider.com
register => 7773339999:777secret@iax.provider.com



[6662229999]
disallow=all
allow=ulaw
context=from-pstn                                                                                                                                                                               
host=iax.provider.com                                                                                                                                                                         
secret=666secret                                                                                                                                                                                  
type=friend                                                                                                                                                                                     
canreinvite=no
username=6662229999
qualify=yes
qualifyfreqok=500
trunk=yes
accountcode=Main
language=en
callerid="It's me!" <6662229999>

[7773339999]
type=user
context=7773339999-in

Extensions.conf:

[general]
static=yes
writeprotect=no
clearglobalvars=no

[globals]
DIAL_OPTIONS=tr
DIAL_TIMEOUT=40


[macro-prepend-cid]
exten => s,1,GotoIf($["${RGPREFIX}" = ""]?REPCID)
 same => n,GotoIf($["${RGPREFIX}" != "${CALLERID(name):0:${LEN(${RGPREFIX})}}"]?REPCID)
 same => n,Set(CALLERID(name)=${CALLERID(name):${LEN(${RGPREFIX})}})
 same => n,Set(_RGPREFIX=)
 same => n(REPCID),Set(_RGPREFIX=${ARG1})
 same => n,Set(CALLERID(name)=${RGPREFIX}${CALLERID(name)})

;--== end of [macro-prepend-cid] ==--;


[from-pstn]
include = thisplace-welcome
include = thisplace-users
include = voicemail
include = directory

[from-internal]
include = thisplace-users
include = voicemail
include = directory
include = outgoing

[thisplace-welcome]
; IRV menus
exten => 6662229999,1,Verbose(Call received on main line)
 same => n,Set(CHANNEL(language)=en)
; same => n,Answer()
 same => n,Background(tpwelcome-2015-11)
 same => n,WaitExten(5)
 same => n,Background(tpwelcome-2015-11)
 same => n,WaitExten(10)
 same => n,Background(tpwelcome-2015-11)
 same => n,WaitExten(10)

[thisplace-users]
;; Extension '0' Rings phone 1
exten => 0,1,Verbose(Call received to General0)
 same => n,Macro(prepend-cid,General:)
; same => n,Dial(SIP/Linksys1,${DIAL_TIMEOUT},${DIAL_OPTIONS})
 same => n,Dial(SIP/Gold1,${DIAL_TIMEOUT},${DIAL_OPTIONS})
 same => n,voicemail(1@thisplace-voicemail,u)
 same => n,Wait(2)
 same => n,Hangup()

;; Extension '1'
exten => 1,1,Verbose(Call received to Ext1)
 same => n,Macro(prepend-cid,Ext1:)
; same => n,Dial(SIP/Linksys1,${DIAL_TIMEOUT},${DIAL_OPTIONS})
 same => n,Dial(SIP/Gold1,${DIAL_TIMEOUT},${DIAL_OPTIONS})
 same => n,voicemail(1@thisplace-voicemail,u)
 same => n,Wait(2)
 same => n,Hangup()

;; Extension '2'
exten => 2,1,Verbose(Call received to Ext2)
 same => n,Macro(prepend-cid,Ext2:)
; same => n,Dial(SIP/Linksys2,${DIAL_TIMEOUT},${DIAL_OPTIONS})
 same => n,Dial(SIP/Gold2,${DIAL_TIMEOUT},${DIAL_OPTIONS})
 same => n,voicemail(2@thisplace-voicemail,u)
 same => n,Wait(2)
 same => n,Hangup()

;; Extension '3'
exten => 3,1,Verbose(Call received to Ext3)
 same => n,Set(CALLERID(num)=0003339999)
 same => n,Set(CALLERID(name)=thisplace)
;; Uncomment one of the following
;; MG's cell
 same => n,Goto(Outbound-Internal-Dial,0003339999,1)

;; Extension '4'
exten => 4,1,Verbose(Call received to Ext4)
 same => n,Macro(prepend-cid,Ext4:)
 same => n,Dial(SIP/Aastra4,${DIAL_TIMEOUT},${DIAL_OPTIONS})
 same => n,voicemail(4@thisplace-voicemail,u)
 same => n,Wait(2)
 same => n,Hangup()

;; Extension '5'
exten => 5,1,Verbose(Call received to Ext5)
 same => n,Macro(prepend-cid,Ext5:)
; same => n,Dial(SIP/Linksys2,20,${DIAL_OPTIONS})
 same => n,Dial(SIP/Gold2,20,${DIAL_OPTIONS})
 same => n,voicemail(5@thisplace-voicemail,u)
 same => n,Wait(2)
 same => n,Hangup()

;; Extension '6' 
exten => 6,1,Verbose(Call received to Ext6)
 same => n,Macro(prepend-cid,Ext6:)
 same => n,Dial(SIP/Phone6,20,${DIAL_OPTIONS})
 same => n,Wait(2)
 same => n,Hangup()

;; Extension '7'
exten => 7,1,Verbose(Call received to Cell)
 same => n,Goto(Outbound-Internal-Dial,1234567899,1)

;; Extension '9'
exten => 9,1,Verbose(Call received to Cell)
 same => n,Goto(Outbound-Internal-Dial,9876543211,1)

;; Extension '11'
exten => 11,1,Verbose(Call received to Cell)
 same => n,Goto(Outbound-Internal-Dial,8528528522,1)

;; Extension '23'
exten => 23,1,Verbose(Call received to Cell)
 same => n,Goto(Outbound-Internal-Dial,9639639633,1)

;; Extension '12'
exten => 12,1,Verbose(Call received to Cell)
 same => n,Goto(Outbound-Internal-Dial,7417417411,1)

;; Extension '24'
exten => 24,1,Verbose(Call received to cell)
 same => n,Goto(Outbound-Internal-Dial,7897897899,1)


; Outbound-Internal-Dial
;
; This is the single point for dialing "internal" extensions that are actually external
[Outbound-Internal-Dial]
; Dial outbound through our IAX Trunk.
exten => _X.,1,Set(CDR(accountCode)=Int-6662229999)
 same => n,Set(CALLERID(num)=6662229999)
 same => n,Set(CALLERID(name)="thisplace Forward")
 same => n,Set(CALLERID(all)="thisplace Forward" <6662229999>)
 same => n,Dial(IAX2/6662229999/${EXTEN},60,${DIAL_OPTIONS})
 same => n,Hangup()

; Outbound-Dial
;
; Before we dial, see if the extension matches our restricted number patterns.
; Note that this is a basic set of numbers which could incur a fee if dialed.
; The NANP includes many other numbers that you may want to block. If you feel
; it is necessary to block further number patterns you'll have to add them below
; or you may consider implementing a blacklist via methods beyond the scope of
; this example.
[Outbound-Dial]
; Dial outbound through our IAX Trunk.
exten => _X.,1,Set(CDR(accountCode)=Out-6662229999)
 same => n,Set(CALLERID(num)=6662229999)
 same => n,Set(CALLERID(name)=thisplace)
 same => n,Set(CALLERID(all)="thisplace" <6662229999>)
 same => n,Dial(IAX2/6136866736/${EXTEN},60,r)
 same => n,Hangup()


[outgoing]
exten => _011X.,1,Goto(Outbound-Dial,${EXTEN},1)
exten => _911.,1,Goto(Outbound-Dial,${EXTEN},1)

; local 7 & 10 digit
exten => _NXXXXXX,1,Goto(Outbound-Dial,613${EXTEN},1)
exten => _666NXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)
; toll-free
exten => _1800NXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)
exten => _1888NXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)
exten => _1877NXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)
exten => _1866NXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)
; non-local 10 && 11 digit
exten => _NXXNXXXXXX,1,Goto(Outbound-Dial,1${EXTEN},1)
exten => _1NXXNXXXXXX,1,Goto(Outbound-Dial,${EXTEN},1)


[voicemail]
exten => *98,1,Answer
 same => n,VoiceMailMain(@thisplace-voicemail)

;exten => *98,n,VoiceMailMain(${CALLERID(num)}@thisplace-voicemail,s)


[directory]
exten => #,1,Answer()
 same => n,Directory(thisplace-voicemail,thisplace-users)

exten => 9,1,Answer()
 same => n,Directory(thisplace-voicemail,thisplace-users)

Well just copy the first trunk that you have got working, replace the number between the [] ,username, secret and callerid with the ones that you have for the second account and you are good to go. The rest of the dialplan is ok. You don’t have any extensions that lead to this trunk, so you will have incoming calls but no outbound.

Aha! Thank you! That and creating a unique context (which forwarded to a unique welcome) worked. Here’s what worked:

Added in iax.conf:

register => < second-number>:< secret>@< carrier>

[<second-number>]
disallow=all
allow=ulaw
context=from-pstn-second
host=<carrier>
secret=<secret>
type=friend
canreinvite=no
username=<second-number>
qualify=yes
qualifyfreqok=500
trunk=yes
accountcode=Main
language=en
callerid="SecondNumber" <second-number>

Added in extensions.conf:

[from-pstn-second]
include = second-welcome
include = thisplace-users  ;This stayed the same as defined in [from-pstn] for the original number
include = voicemail  ;This stayed the same as defined in [from-pstn] for the original number
include = directory  ;This stayed the same as defined in [from-pstn] for the original number

[second-welcome]
; IRV menus
exten => < second-number>,1,Verbose(Call received on main line for SecondNumber)
 same => n,Set(CHANNEL(language)=en)
; same => n,Answer()
 same => n,Background(tpwelcome-2015-11)
 same => n,WaitExten(5)
 same => n,Background(tpwelcome-2015-11)
 same => n,WaitExten(10)
 same => n,Background(tpwelcome-2015-11)
 same => n,WaitExten(10)