PJSIP conversion

I am digging into the PJSIP conversion… I found the type=wizard which may work well for me.

Some field I used to use I dont know how to handle

callerid=
description=
rtptimeout=
rtpholdtimeout=
rtpkeepalive=
callerid=
qualify=
insecure=
canreinvite=
timezone=
nat=

What do these map to ?

THanks

Jerry

Note most of this can be answered from res_pjsip - Asterisk Documentation

callerid (endpoint)

Not used by chan_sip.

rtp_timeout (endpoint)

rtp_timeout_hold

rtp_keepalive

You already asked.

qualify_timeout (endpoint) - no = 0; yes is whatever the chan_sip default was.

For the invite parameter, whether the to use both auth and outbound_auth, or just outbound_auth, but only if there was a secret in the sip.conf, otherwise ignored. The just auth case is academic, as outbound_auth is only actually used if the remote side asks for it. insecure cannot cope with different authorisations in both directions, although that could be done, using remotesecret, in later versions of chan_sip. chan_pjsip always treats them as independent.

The port option is widely misused for chan_sip, but, although I’m not sure, whether or not the port is included in the match= option for type=identify.

This name was retired around a decade ago, in chan_sip. The chan_sip replacement is directmedia, and the pjsip equivalent of that is direct_media.

Does not exist in chan_sip, and I believe, never has.

Appropriate settings of force_rport, rtp_symmetric, and rewrite_contact. NB this is heavily overused in chan_sip, and I think the first two are on, by default, in chan_pjsip. It is not needed for well behaved providers, when you are behind NAT. The chan_sip default was auto, which meant using heuristics to determine if these hacks were needed.

Thanks - very helpful.

I also Tried to edit the pjsip_wizard.conf file, removed the semicolon for a few items.
[wizard]
inbound_auth/
outbound_auth/

to try to then see some definitions. I see nothing.
I tried “pjsip show endpoints” and a couple others.

I think I am missing something easy - to get this going.
What might that be?

Jerry

I don’t understand what you mean by seeing definitions. Those are auth sections[1]. Endpoint is also documented[2].

[1] res_pjsip - Asterisk Documentation
[2] res_pjsip - Asterisk Documentation

So before in chan_sip - I could to “sip show peers” and list all the items and their IP.

I am trying to find the same for PJSIP.
I defined one device with the wizard.
[501]
type=wizard
inbound_auth/username=501
inbound_auth/password=501pass
disallow=all
allow=ulaw
allow=alaw
allow=gsm

Then I was trying to find the command that lists that on the CLI - like the old sip show peers.

I am not able to list anything yet.

jerry

The closest equivalent would be “pjsip show endpoints”. Note that the wizard configuration is converted into the standard configuration, which is what will be shown.

Ok - when I run that I get No Objects found

jerry

I was able to make progress.

My “#include” of the Wizard definition was “not” in pjsip_wizard.conf file - I put it there and now it works. Why does it have to be in the wizard file. The “type=wizard” isnt that enough ???

Also - on chan_sip I used to get 501/501 192.168.1.1 type of listing - (as example)
how do I get that in pjsip ? I need a listing of extension and IP address or Unspecified if not connected.

Thanks

Jerry

Because the res_pjsip_config_wizard module loads the pjsip_wizard.conf file for its configuration.

Neither chan_sip nor chan_pjsip know about extensions, except in a limited way, that few people use.

The nearest information to IP addresses is the list of contacts. Why are you interested in the addresses of what FreePBX calls extensions? Most people use registration for these (FreePBX only uses it) and the whole point of registration is that you have no prior knowledge of the address, so the only use of it is for directing calls towards the device.

Like list listing “sip show peers”

Name/username Host Dyn Forcerport Comedia ACL Port Status Description
111/111 192.168.1.83 D No No 5060 Unmonitored TOA - SIP Ceiling speaker
112/112 (Unspecified) D No No 0 Unmonitored TOA - SIP Horn speaker
113/113 (Unspecified) D No No 0 Unmonitored Grandstream HT813
116/116 192.168.2.225 D No No 5060 Unmonitored IP button 2046f90a002a

How do I get the equivalent

Jerry

The equivalent would be “pjsip show endpoints”. There is no 1-to-1 CLI output equivalent.

Is there any way to reduce that output and just show
Endpoint and bindaddress (perhaps)
Any way to show it in a csv (perhaps)

Jerry

Tab completion and “help pjsip” will show you the CLI commands and their various options. In general CLI commands are for human consumption, not for programmatic/scripting.

Is there a way to get output for scripting ?
or again “options” for saying show me the endpoint and the IP - nothing else ?

Jerry

Nothing comes to mind, which is why I said to use the tab completion and CLI command to explore to see what is possible from the CLI. If there isn’t, then there isn’t. Others use AMI for scripting because that is its purpose.

OK I tried the PJSIPShowEndpoints with AMI

Action: Command[CR ][LF ]Command: PJSIPShowEndpoints[CR ][LF ]’ Response: Error[CR ][LF ]Message: Command output follows[CR ][LF ]Output: No such command ‘PJSIPShowEndpoints’ (type ‘core show help PJSIPShowEndpoints’ for other possible commands)[CR ][LF ][CR ][LF ]

If I do the “manager show commands” it is listed.

Jerry

The ‘Command’ AMI action is for executing CLI commands. You would want to execute the ‘PJSIPShowEndpoints’ AMI action.

OK - I am able to run:
pjsip list endpoints

Endpoint: <Endpoint/CID…> <State…> <Channels.>

Endpoint: 501 Unavailable 0 of inf
Endpoint: 502 Unavailable 0 of inf
Endpoint: 503 Unavailable 0 of inf
Endpoint: 504 Unavailable 0 of inf

I am also able to run that through the AMI

Event: EndpointList
ObjectType: endpoint
ObjectName: 501
Transport:
Aor: 501
Auths:
OutboundAuths:
Contacts:
DeviceState: Unavailable
ActiveChannels:

Neither are showing me the IP address like chan_sip did.
Name/username Host Dyn Forcerport Comedia ACL Port Status Description
111/111 192.168.1.83 D No No 5060 Unmonitored TOA - SIP Ceiling speaker

How do I get the IP for the endpoint ?
thank you.

Jerry

From the Contacts. Note that there may be more than one, and you may have to resolve the domain name (unlikely to be needed for a phone).

Again you haven’t said why you need this. Knowing the answer to that may suggest alternative solutions to your requirements.

Your current listing seems to show no valid registrations, so Asterisk hasn’t received the information.