Fwconsole convert2pjsip conversion command questiong

Hello all I am looking at the documentation here:
https://wiki.freepbx.org/pages/viewpage.action?pageId=91357370
Specifically at: fwconsole convert2pjsip (Chan_SIP to PJSIP extension conversion)

If I run:
fwconsole convert2pjsip --all
fwconsole reload
or
fwconsole convert2pjsip -r 5000-5100,6020-6040
fwconsole reload

Does the script/command preserve the SIP port I have chosen for my Chan_SIP extension/driver, or do I have to put in an option or switch to preserve or Tell the command what port I want to use with the new PJSIP converted extension? (Maybe it just converts the extension pound for pound to PJSIP, keeping the current port that was chosen for the Chan_SIP Extension ?)

Thanks for the clarification in advance. Just want to know the behavior before I run it.

Signaling ports are defined in Asterisk SIP Settings, and are set independently from the extension. When you convert an extension from chan_sip to pjsip, the updated extension will use a different port.

Okay, so if I understand correctly if I activate the PJSIP driver, whatever the port is set to under Asterisk SIP Settings, will be what is populated for the converted extensions?

If that is the case, could I set the port to what I wanted under the Asterisk SIP Settings for PJSIP, and then run the conversion script, and this port will be the one for the new PJSIP extension? Maybe I’m still misunderstanding?

I guess what I am ultimately asking is, how do I choose the port I want for PJSIP upon extension conversion, will it inherit it from the Asterisk SIP Settings for PJSIP, or is there a way to specify the port I want upon conversion with the fwconsole convert2pjsip?

Thanks in advance.

I think there has been confusion between the local and remote port numbers. The remote port number is something determined by the endpoint, and shouldn’t be changed by the conversion.

The local ports are properties of the transports of which there are a small fixed number in chan_sip and the GUI support for chan_pjsip. They are only indirect properties of the endpoints.

Also the GUI doesn’t allow you to specify remote ports for extensions, only for trunks.

Hmm, I think there is more confusion now ha ha ha. I am only talking about the port settings for PJSIP on the FreePBX server and sip in general for my FreePBX nothing external to the PBX :slight_smile: I will leave that alone its all working, I am the one who set it up.

So specifically what I need to know for example is, if all chan_sip extension ports were set to let’s say 5060, when the conversion script is run, will the new converted Extension, that was converted to PJSIP be on or use 5060?

For example, I have an extension lets say I have an Ext 4160 it is chan_sip and on port 5060. When the script converts this Ext, will the new PJSIP EXT be on 5060? (I hope that makes sense, thanks in advance.)

I was thinking this was based on the Asterisk sip to pjsip conversion tool, but it’s really acting on the internal database and then reprovisioning the phone.

It definitely changes the dialstring format, and the driver name, and then does something with defaults. I haven’t followed the last part through to be absolutely sure what is doing, but I suspect what it may be doing is to replace all values that haven’t been overridden by the user with the corresponding default values for a pjsip extension. I think the same happens if you manually change the type.

What I can fairly confidently say is that it is not going to touch anything in the general section or a type=transport section which is where the normal values for the local port numbers are stored. It can’t safely do anything like that, as it an be used on subsets of the chan_sip extensions.

I haven’t followed the code through far enough to see if a working copy of the local port number is held for the extension, but I rather suspect it is not, and is actually fetched from the global settings when generating the provisioning request for the phone. As it does seem to initiate reprovisioning, I think it has to send the local port number to the phone, to not be broken.

FreePBX doesn’t allow you to set the remote port numbers for extensions, as it treats them all as Registration=Inbound, in which that port number is taken from the Contact header in the registration, not from any local configuration.

The core code that implements this is:

convert2pjsip, itself, just iterates over this for each specified extension, and reports on the success.

Okay, wow this is doing more than I thought. I thought it was just looking at the extension that is set up on the FreePBX server, and physically modifying that extension in the database. All 700 of my phones were programmed using a universal config file, with small changes made where needed, and the config file as a part of it’s configuration, just looks populates the sip server and port, the phone is just looking for ANY form of SIP…so really All I need done, is I need the script to just convert the extension to PJSIP on FreePBX and call it a day…nothing else needed…so does the script do this, and if I don’t need any provisioning, all is well?

This article seems to convey…that this is the case:

chan_sip and chan_pjsip don’t generate different forms of SIP; they are different implementations of the same thing. One may be more complete or correct in some areas than the other one, and there may be cases where the other party reads more into SIP constructs than the RFC implies, and one of the two drivers copes better.

If you are provisioning with hard code configurations, rather than endpoint manager, I image the EPM calls are wasted on you.

I did find the article you mentioned, but it basically seemed to say to me that the fwconsole command basically automated the manual procedures described, although I didn’t read the manual procedure in too much detail.

Okay. And it’s okay if you don’t know the answer, but I’m really unclear still. Based on my previous question and explanation, will the script functionally convert ALL my extensions on my FreePBX box from CHAN_SIP to PJSIP. That’s all I need it to do. My phones are manually provisioned so nothing in the script will apply there, but if it Converts the Extensions on the FreePBX to PJSIP, that’s really all I need. do you know if it does that? IE:

" All I need to be done, is I need the script to just convert the extension to PJSIP on FreePBX and call it a day…nothing else is needed…so does the script do this? I don’t need any functions to provision the phones, I just simplly need the script to convert the extensions from CHAN_SIP to PJSIP."

I have 800 extensions on my FreePBX box. That’s why the script would be nice if it does this.

If you don’t know I’ll just test it, I was just hoping a bunch of people had already used this script and possibly knew.

@Igaetz Does the script, convert the extension and assign it a new SIP port? Or can I tell the script what PORT I want to use on all converted extensions? (I would prefer to specify the port for converted extensions), If that’s possible.

There is no reason why it would touch the remote port. The local port is a property of the transport, not the extension, and I’d expect it to use the relevant standard transport.

Happy cake day @david55

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.