PJSIP with my endpoints behind a proxy

#1

I’m having trouble configuring pjsip.

Asterisk is running on the host 192.168.84.197
I have a sip proxy at 192.168.84.194 that has my endpoints registered to it.

The proxy will locally handle calls to registered users, calls from registered users to E164 formatted telephone numbers are routed to Asterisk.

Calling is working but my asterisk instance isn’t able to send NOTIFY messages for voicemail.

[Apr 11 11:54:11] ERROR[32663]: res_pjsip.c:3588 create_out_of_dialog_request: Unable to create outbound NOTIFY request to endpoint 7001@cust0001.sip.simplybits.net
[Apr 11 11:54:11] WARNING[32663]: res_pjsip_mwi.c:497 send_unsolicited_mwi_notify_to_contact: Unable to create unsolicited NOTIFY request to endpoint 7001@cust0001.sip.simplybits.net URI sip:7001@cust0001.sip.simplybits.net
[Apr 11 11:54:11] ERROR[32663]: res_pjsip.c:3588 create_out_of_dialog_request: Unable to create outbound NOTIFY request to endpoint 7002@cust0001.sip.simplybits.net
[Apr 11 11:54:11] WARNING[32663]: res_pjsip_mwi.c:497 send_unsolicited_mwi_notify_to_contact: Unable to create unsolicited NOTIFY request to endpoint 7002@cust0001.sip.simplybits.net URI sip:7002@cust0001.sip.simplybits.net

my pjsip.conf is pretty bare:


[transport-udp-nat]
type = transport
protocol = udp
bind = 0.0.0.0

[aor-single-reg](!)
type = aor
max_contacts = 1
outbound_proxy=sip:192.168.84.194\;lr

[7001@cust0001.sip.simplybits.net](aor-single-reg)
contact=sip:7001@cust0001.sip.simplybits.net
[7002@cust0001.sip.simplybits.net](aor-single-reg)
contact=sip:7002@cust0001.sip.simplybits.net

[generic-endpoint](!)
allow = !all,g722,ulaw
trust_id_inbound=yes
device_state_busy_at = 1
dtmf_mode = rfc4733
outbound_proxy=sip:192.168.84.194\;lr

[7001@cust0001.sip.simplybits.net](generic-endpoint)
type=endpoint
context=cust0001-internal
aors=7001@cust0001.sip.simplybits.net
accountcode=cust0001-001-7001
mailboxes=7001@cust0001.sip.simplybits.net

[7002@cust0001.sip.simplybits.net](generic-endpoint)
type=endpoint
aors=7002@cust0001.sip.simplybits.net
context=cust0001-internal
accountcode=cust0001-001-7002
mailboxes=7002@cust0001.sip.simplybits.net

voicemail.conf is pretty simple.

[general]
format = wav49

[default]

[cust0001.sip.simplybits.net]
7001 = 1234,Box 7001
7002 = 1234,Box 7002
0 Likes

#2

I’m not sure why you need dots (.) in your voicemail context, you can just give it a more cleaner name scheme.

The same with the endpoints and AORs. I’ve been down this road and using a URI still name for the endpoint/aor seems to cause these issues. When I don’t do that, the issue goes away. There really isn’t a lot of domain based support so far, so having the domain doesn’t do much.

0 Likes

#3

Very true, I was making everything match the domain for the just to tie things together logically.

If the Endpoint name isn’t the same as the RURI then Asterisk wasn’t matching it to the correct context and accountcode.

0 Likes

#4

That’s completely untrue. When a call comes in from the phone you can use username,ip,header,auth_username to authenticate with. The username will match username@domain then username by itself. You don’t need the domain, no one does it that way normally.

Now if you’re trying to do this to be multi-tenant/domain then you can use identify options to match against IPs or headers and associate it with the endpoint. I do this right now, I have four different locations with the “user” 208 I just have different endpoints configured and use the various auth options, like identify, to associate/auth that call/request to the endpoint in question.

So yes, this can be done with out the use of full URIs to try and break things up.

0 Likes

#5

The username will match username@domain then username by itself. You don’t need the domain, no one does it that way normally.

I’m under the impression chan_sip was not able to match on the full user@domain, only on the userpart which is why traditionally the user portion had to be unique. The good news is these days we have a better sip stack to work with.

I’m using a proxy to handle my registration and authentication, Endpoint’s won’t have unique IP’s, asterisk see’s allt he traffic coming from the same proxy no matter what the domain is.

How are you using header matching? I don’t see it being well documented and trying to just use match_header = From didn’t work.

0 Likes

#6

Well I use Kamailio as the SIP Proxy for the users. In the case of my hosted voice users (ones that are using a virtual PBX style service) I create individual endpoints/aors, etc for the users. The name of the endpoint or the aor doesn’t matter. I use match_header= and use a custom header. I agree the documentation on this option is lacking. I’ve been struggling with the regex matching and using standard headers so I just send my own.

So I use something along the lines of match_header=X-USERID: user@domain note the syntax so using match_header=From: <must be exact match to From header including tags> is going to be problematic, this is where the regex issue has me banging my head. I just then associate them with the endpoint I need to.

On the AOR side I just set static a static contact=sip:user@domain:port which is their actual SIP URI on the proxy. Works like a champ so far.

In fact I have one system that is just a gateway to pass the calls through for the SIP Trunk and Resi/SOHO users and I have one single endpoint on Asterisk for the proxy, I use custom headers to send user details to allow looking up things in AstDB for the call and any “premium functions”. I also use that single endpoint with an single AOR to send calls to the proxy for all the users by just using setting the static contact as contact=sip:domain:port and setting the user portion via the Dial() string. Dial(PJSIP/${EXTEN}@endpoint)

1 Like