PJSIP VOIP.ms

Hi,

I’m wanting to setup some VOIP.ms numbers using Asterisk 13 with PJSIP.

I read the manual here:
wiki.voip.ms/article/Asterisk_%28SIP%29
But it is for SIP. Does anyone know the equivalent PJSIP settings?

(I’ve made an attempt, but my Asterisk box seems to forget it’s registration to voip.ms so won’t take incoming calls until restarted)

Thanks for any guidance

Try Here: wiki.asterisk.org/wiki/display/ … n+Examples

Thanks - it is helpful to have that starting point.
I’ve put the following together (see below) based on info on the page that you gave.

I can make calls. Problem: Not long after I hangup an incoming call I notice that incoming calls stop working and the voip.ms website reports “No registration found” (whereas before a call it reports the SIP connection “registered”)

Presumably I need to add something to pjsip.conf?

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0:5006 ; use a different port to help minimize exploits during setup!

[6001]
type=endpoint
context=from-internal
disallow=all
allow=ulaw
auth=auth6001
aors=6001

[auth6001]
type=auth
auth_type=userpass
password=MY-LOCAL-PASSWORD-HERE
username=6001

[6001]
type=aor
max_contacts=1

[voipms]
type=registration
transport=simpletrans
outbound_auth=voipms
server_uri=sip:MY-VOIPMS-USERNAME-HERE@london.voip.ms:5060
client_uri=sip:MY-VOIPMS-USERNAME-HERE@london.voip.ms:5060
retry_interval=60

[voipms]
type=auth
auth_type=userpass
password=MY-VOIPMS-PASSWORD-HERE
username=MY-VOIPMS-USERNAME-HERE

[voipms]
type=aor
contact=sip:london.voip.ms:5060

[voipms]
type=endpoint
transport=simpletrans
context=from-external
disallow=all
allow=ulaw
outbound_auth=voipms
aors=voipms

[voipms]
type=identify
endpoint=voipms
match=london.voip.ms

The type=registration section should keep an outbound registration going. What version of Asterisk 13? As well - what happens if you do module reload res_pjsip_outbound_registration.so?

Try this:

[voipms]
type=endpoint
transport=simpletrans
context=from-external
disallow=all
allow=ulaw
outbound_auth=voipms
aors=voipms
auth=voipms
from_user=MY-VOIPMS-USERNAME-HERE
send_rpid=yes (If you want asterisk to control outboud callerid)

[voipms]
type=registration
transport=simpletrans
outbound_auth=voipms
server_uri=sip:london.voip.ms:5060
client_uri=sip:MY-VOIPMS-USERNAME-HERE@london.voip.ms:5060
contact_user=MY-VOIPMS-USERNAME-HERE
retry_interval=60

Many thanks for these suggestions. It appeared that the initial connection worked (“service asterisk restart” therefore got things going well), but the keeping alive attempt at 60 seconds would cause unregister - and indeed so would reloading the module.

I ended up using IAX2 to get things working temporarily, but I also asked the voip.ms guys, and as a result they have now published guidance specifically for PJSIP. Here:

http://wiki.voip.ms/article/Asterisk_(PJSIP)

I’ll be trying that, and your suggestions, in the next week or so and will update here if I find it doesn’t work.

Thanks again

Another user here trying to get pjsip running on voip.ms.

I followed the voip support instructions very carefully but I get a segfault when reading pjsip.conf.
Asterisk 13, revision 434725 via svn. Latest pjsip. openSUSE 13.2 with repo kernel for desktop.
Installation ok after correcting the issue in include/asterisk/autoconfig.h

(note: attempting to use cmd service to start asterisk is bad in this case since it just respawns with error continuously based on sounds from asterisk server and will not stop.)
On bash command “asterisk -vvvvvvc” extensive startup output terminates in:

... Loading format_g729.so. == Registered file format g729, extension(s) g729 == format_g729.so => (Raw G.729 data) Loading res_pjsip_outbound_registration.so. == Parsing '/etc/asterisk/sorcery.conf': Found == Manager registered action PJSIPUnregister == Manager registered action PJSIPRegister == Manager registered action PJSIPShowRegistrationsOutbound == Parsing '/etc/asterisk/pjsip.conf': Found Segmentation fault

Since asterisk will not start properly I can’t get to a CLI to do futher testing.
Note that in the output from asterisk startup, the attempt here to parse pjsip.conf is about the fourth or fifth note in the log, previous attempts to read the file have evidently succeeded so that eliminates a lot of possibilities, bad formatting etc.

What would be enormously helpful here is for someone who has this running to say what asterisk is trying to do when the segfault occurs. Output from kernel messages is:

2015-06-18T08:53:50.759624-04:00 linux-yrir kernel: [ 248.808589] asterisk[4089]: segfault at 1cc ip b59c8488 sp b6540f30 error 4 in res_pjsip_outbound_registration.so[b5997000+55000]

Suggestions appreciated, thanks. I will contact voip.ms with details.

I’ve seen that happen when the PJSIP install on the system is compromised in some fashion. Multiple installs, no shared libraries installed. That sort of thing. Getting a backtrace[1] would confirm it.

[1] wiki.asterisk.org/wiki/display/ … +Backtrace

Thanks for the suggestion. I thought I had cleaned out a previous pjsip but maybe not thoroughly enough.

Here is a backtrace: https://www.dropbox.com/s/nyy7c0xvfg0cmvn/gdbstuf.zip?dl=0

PJSIP was not built with shared library support, as a result each module has its own copy of the entire PJSIP stack running in an isolated fashion. This will cause crashes and not work at all. You’ll need to clean it out of the system and then reinstall PJSIP with shared library support. Recommended build arguments are documented here[1].

[1] wiki.asterisk.org/wiki/display/ … +pjproject

Thankyou. Asterisk working again, this time with pjsip and voip.ms. Progress!
I did read that file, but became overconfident I knew what I was doing. Mistake.

With respect to the topic of the OP regarding registry failures after a certain period of time has elapsed, I had the same problem. It appears to be related to the setting regarding temporary and permanent failures as explained in:

https://wiki.asterisk.org/wiki/display/AST/Configuring+Outbound+Registrations

The default appears to be that as soon as there is a failure to renew a registration asterisk will instantly give up. I am experimenting with “auth_rejection_permanent=no”.

Edit: after a short time, asterisk thought it was properly registered, but calls would not go through the registered transport. So that’s not it.

Edit 2: looks like the timeout is about 5 minutes. Steps to reproduce:

  1. start asterisk with pjsip active. Switch on pjsip logger
  2. make calls from extension to my own DID, call is connected and my extensions ring.
  3. within 3-4 minutes calls continue to be successful and events recorded on logger
  4. after about 5 minutes calls are no longer connected. Silence as the number of rings times out, no extensions ring, then the voip.ms service offers to take a message. No sip events recorded in logger.

Edit 3:
After trying “expiration=300” for a while I find that about 50% of my attempts to call my DID fail. This is remarkable. It looks like an expiry of 3 minutes or less is required? I have no idea where the weakness is.