Asterisk 1.4.0 - Broadvoice - Incoming Calls

Well I’ve successfully managed to make 2 polycom 501’s work internally VM/Extensions. I’ve also got outbound calls working with broadvoice but for the life of me can not figure out what I’m doing wrong with inbound calls. My suspicion would be that I’m doing something wrong with NAT but I’ve tried both externip / localnet which for some reason appear to be mutually exclusive (1 or the other). The asterisk box is in a DMZ behind a single wireless router. For brevity I’ve included only what I thought was pertinent. As I understand it the end of the register statement is the local extension the call should match. I’ve tried both the BV phone number, s, and 101 (the first extension in the dial plan). Also under the sip.broadvoice.com is the context from-broadvoice to which I understand those calls are “routed”. Right now when I call the BV number it acts like BV can’t route the call or maybe its not matching any dial plan entry so it says something like “The caller you are trying to reach cannot be reached at this time.” If anyone can lend a hand I would greatly appreciate it. Thanks!

– SIP.CONF –

[general]
srvlookup=yes
pedantic=no
context=default
callerid=Unknown
externip=MYIP
;localnet=192.168.10.0/255.255.255.0
register => PHONE@sip.broadvoice.com:PASS:PHONE@sip.broadvoice.com/PHONE

[sip.broadvoice.com]
type=peer
user=phone
host=sip.broadvoice.com
fromdomain=sip.broadvoice.com
fromuser=PHONE
secret=PASS
username=PHONE
insecure=very
context=from-broadvoice
authname=PHONE
dtmfmode=inband
dtmf=inband
;Disable canreinvite if you are behind a NAT
canreinvite=no
callerid=PHONE
nat=yes

– EXTENSIONS.CONF –

[from-broadvoice]
exten => s,1,Answer()
exten => s,2,Playback(hello-world)
exten => s,3,Hangup()
--- (10 headers 14 lines) ---
Sending to 147.135.28.128 : 5060 (no NAT)
Using INVITE request as basis request - 110187-11@147.135.28.128
Found peer 'sip.broadvoice.com'
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 2
Found RTP audio format 18
Found RTP audio format 96
Found RTP audio format 97
Peer audio RTP is at port 147.135.28.250:14704
Found description format PCMU for ID 0
Found description format PCMA for ID 8
Found description format G726-32 for ID 2
Found description format G729 for ID 18
Found description format iLBC for ID 96
Found description format t38 for ID 97
Capabilities: us - 0x8000e (gsm|ulaw|alaw|h263), peer - audio=0xd0c
(ulaw|alaw|g726|g729|ilbc)/video=0x0 (nothing), combined - 0xc
(ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x0
(nothing), combined - 0x0 (nothing)
Peer audio RTP is at port 147.135.28.250:14704
Looking for BVLINE in from-broadvoice (domain 192.168.10.192)

<--- Reliably Transmitting (NAT) to 147.135.28.128:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 147.135.28.128:5060;received=147.135.28.128
From: "CELLCALLERID"<sip:CELLPHONE@147.135.28.128;user=phone>;tag=nprs
To: "BVCALLERID"<sip:s@EXTERNIP>;tag=as0d3afbf8
Call-ID: 110187-11@147.135.28.128
CSeq: 1 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '110187-11@147.135.28.128' in 32000
ms (Method: INVITE)
localhost*CLI>
<--- SIP read from 147.135.28.128:5060 --->
ACK sip:s@EXTERNIP:5060 SIP/2.0
Call-ID: 110187-11@147.135.28.128
CSeq: 1 ACK
From: "CELLCALLERID"<sip:CELLPHONE@147.135.28.128;user=phone>;tag=nprs
To: "BVCALLERID"<sip:s@EXTERNIP>;tag=as0d3afbf8
Via: SIP/2.0/UDP 147.135.28.128:5060;received=EXTERNIP
Content-Length:    0


<------------->
--- (7 headers 0 lines) ---
Really destroying SIP dialog '110187-11@147.135.28.128' Method: ACK
[Mar  6 00:44:41] NOTICE[6220]: chan_sip.c:7055 sip_reregister:    --
Re-registration for  BVLINE@sip.broadvoice.com@sip.broadvoice.com
REGISTER 12 headers, 0 lines
Reliably Transmitting (NAT) to 147.135.28.128:5060:
REGISTER sip:sip.broadvoice.com SIP/2.0
Via: SIP/2.0/UDP 192.168.10.192:5060;branch=z9hG4bK3d9318e8;rport
From: <sip:BVLINE@sip.broadvoice.com>;tag=as39b3d8a7
To: <sip:BVLINE@sip.broadvoice.com>
Call-ID: 3f30be0279c4e07f0065d5e57a888456@sip.broadvoice.com
CSeq: 106 REGISTER
User-Agent: Asterisk PBX
Max-Forwards: 70
Expires: 120
Contact: <sip:s@192.168.10.192>
Event: registration
Content-Length: 0


---
localhost*CLI>
<--- SIP read from 147.135.28.128:5060 --->
SIP/2.0 200 OK
Call-ID: 3f30be0279c4e07f0065d5e57a888456@sip.broadvoice.com
CSeq: 106 REGISTER
From: <sip:BVLINE@sip.broadvoice.com>;tag=as39b3d8a7
To: <sip:BVLINE@sip.broadvoice.com>
Via: SIP/2.0/UDP 192.168.10.192:5060;branch=z9hG4bK3d9318e8
Contact: <sip:s@192.168.10.192:5060>
Expires: 30
Event: registration
Content-Length:    0


<------------->

“Looking for BVLINE in from-broadvoice”

It’s looking for an extension called “BVLINE” in the “from-broadvoice” context.

You do not have PHONE defined in context “from-broadvoice”, right ?
Then remove /PHONE from the ‘register’ line in sip.conf and the ‘magic’ s will do the job.

Ok, apparently the only way I can get it to match is if I explicitly define the PHONE in the dial plan. Removing /PHONE for some reason doesn’t work even though I see the following in the sip debug:

<--- SIP read from 147.135.28.128:5060 --->
ACK sip:s@EXTERNIP:5060 SIP/2.0
Call-ID: 2902a6-29@147.135.28.128
CSeq: 1 ACK
From: "CELLCALLERID"<sip:CELLPHONE@147.135.28.128;user=phone>;tag=uxz0
To: "BVCALLERID"<sip:s@EXTERNIP>;tag=as3f7331ee
Via: SIP/2.0/UDP 147.135.28.128:5060;received=EXTERNIP
Content-Length:    0

either way I’m happy if it’s answering. Any ideas why the “s” extension wouldn’t work? Also is “sip reload” and “extensions reload” enough to re-read the configuration files or do I have to actually stop the asterisk service?

Re-registration for BVLINE@sip.broadvoice.com@sip.broadvoice.com

  • this is quite strange and wrong

register => PHONE@sip.broadvoice.com:PASS:PHONE@sip.broadvoice.com/PHONE - looks strange as well

It is not useful to just show To & From, you should show us the INVITE in order to find why s doesn’t work.

Make your config simpler. Delete register from sip.conf
Edit your users.conf:

[sip.broadvoice.com]
secret = password
md5secret =
provider =
trunkstyle = customvoip
username = PHONE
trunkname = BW incoming
callerid =
hasexten = no
hassip = yes
hasiax = no
registeriax =
registersip = yes
host = sip.broadvoice.com
dialformat = ${EXTEN:1}
context = from-broadvoice
group =
insecure = invite
;contact = PHONE
fromuser = PHONE
fromdomain = sip.broadvoice.com
nat = yes

As soon as you have contact= commented out you will be registered with your provider as s@…, so your existing dialplan should work.
If you will uncomment that line then you will need to handle the PHONE extension in your dialplan.

Well, I moved the registration to users.conf and contact= seems to have no effect commented or not. I’m not sure I really care as I can always pass the extensions to match in but just for my edification any ideas?

– DEBUG –

<------------->
--- (10 headers 14 lines) ---
Sending to 147.135.28.128 : 5060 (no NAT)
Using INVITE request as basis request - 67026a-67@147.135.28.128
Found peer 'sip.broadvoice.com'
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 2
Found RTP audio format 18
Found RTP audio format 96
Found RTP audio format 97
Peer audio RTP is at port 147.135.28.250:17542
Found description format PCMU for ID 0
Found description format PCMA for ID 8
Found description format G726-32 for ID 2
Found description format G729 for ID 18
Found description format iLBC for ID 96
Found description format t38 for ID 97
Capabilities: us - 0x8000e (gsm|ulaw|alaw|h263), peer - audio=0xd0c (ulaw|alaw|g726|g729|ilbc)/video=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x0 (nothing), combined - 0x0 (nothing)
Peer audio RTP is at port 147.135.28.250:17542
Looking for BVNUMBER in from-broadvoice (domain 192.168.10.192)
list_route: hop: <sip:CELLPHONE@147.135.28.128:5060>

<--- Transmitting (NAT) to 147.135.28.128:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 147.135.28.128:5060;received=147.135.28.128
From: "CELLCALLERID"<sip:CELLPHONE@147.135.28.128;user=phone>;tag=1356
To: "BVCALLERID"<sip:s@EXTERNIP>
Call-ID: 67026a-67@147.135.28.128
CSeq: 1 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:BVNUMBER@192.168.10.192>
Content-Length: 0


<------------>
    -- Executing [BVNUMBER@from-broadvoice:1] Answer("SIP/BVNUMBER-094ce320", "") in new stack
Audio is at 192.168.10.192 port 11774
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
localhost*CLI>
<--- Reliably Transmitting (NAT) to 147.135.28.128:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 147.135.28.128:5060;received=147.135.28.128
From: "CELLCALLERID"<sip:CELLPHONE@147.135.28.128;user=phone>;tag=1356
To: "BVCALLERID"<sip:s@EXTERNIP>;tag=as6d054345
Call-ID: 67026a-67@147.135.28.128
CSeq: 1 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Contact: <sip:BVNUMBER@192.168.10.192>
Content-Type: application/sdp
Content-Length: 212

v=0
o=root 12181 12181 IN IP4 192.168.10.192
s=session
c=IN IP4 192.168.10.192
t=0 0
m=audio 11774 RTP/AVP 0 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<------------>

– EXTENSIONS.CONF –

[from-broadvoice]
exten => s,1,Answer()
exten => s,2,Playback(enter-ext-of-person)
exten => s,3,Hangup()

exten => PHONE,1,Answer()
exten => PHONE,2,Playback(hello-world)
exten => PHONE,3,Hangup()  

If users and the registration request (trunks) go in users.conf then what is sip.conf really for? As of yet AsteriskTFOT doesn’t make mention of users.conf. It would make sense if the registration requests were all in sip.conf and all the users were in users.conf but… Thanks again for all your help.

[quote]Re-registration for BVLINE@sip.broadvoice.com@sip.broadvoice.com

  • this is quite strange and wrong

register => PHONE@sip.broadvoice.com:PASS:PHONE@sip.broadvoice.com/PHONE - looks strange as well
[/quote]

The registration string came direct from Broadvoices website http://www.broadvoice.com/support_install_asterisk.html although I’ve seen the same request in many different forms. I’m assuming you get re-registration requests like BVLINE@sip.broadvoice.com@sip.broadvoice.com because of the way BV has you register but to be honest I’m definately out of my element. Despite it being wrong it did work. I just figured I would use what they (BV) had on their website as it was more likely to work then some random forum.