Converting SIP to PJSIP

Hi,

I am currently testing v4 and I have noticed the following.
An backup from version 3 and an import to version 4 basically worked at first.
But now all devices are available as SIP again. Is there a possibility to create/convert all devices directly as PJSIP during the import or later?

If I think about doing this for a customer with over 50 end devices, it makes no sense to use SIP again.

best regards, Oliver

2 Likes

Export and Import Extensions could do it.

Might need to also use that to delete all extensions at once first.

Unfortunately, an import does not work either.
I have previously exported all extensions from v3, then changed all sip fields in the CSV to pjsip, when importing into v4 the log also says “Updated extension xx” but it remains with sip.

It is not so easy to delete all extensions. You can’t delete an extension if it is still used somewhere, then you would have to delete all ring groups, IVR, night modes etc… So delete everything where the extension is used and that makes no sense, then I can just start from scratch.

Or can I delete everything at once with the CSV, if so how?

Check the instructions in the csv file. I think there there is add, modify and delete as command.
So multiple delete could be possible.

Thank you, with a “delete” and then another import with “add” the extensions are actually converted to PJSIP.

Unfortunately this is not a solution either, a delete removes all the device data from the ring groups etc. This means that some manual work is still required here.

That is not good, I agree.

Yeah, having a convert option would’ve been good, but unfortunately there isn’t one.

Below is a small script I used to convert sip devices to pjsip in the past, it isn’t perfect, especially not for large environments, since it has no error checking and it creates a new sql connection for each device, but 50ish devices should be fine.

pjsip_prfile_id=$(mysql -sN -D ombutel -e "SELECT profile_id FROM ombu_device_profiles WHERE name = 'Default PJSIP Profile' LIMIT 1")
sip_devices=$(mysql -sN -D ombutel -e"select device_id,codecs,deny,permit from ombu_sip_devices")

while read -r sip_device codecs deny permit
do
    mysql -D ombutel <<FIN
        INSERT INTO ombu_pjsip_devices VALUES($sip_device,$codecs,'rfc4733',1,'$deny','$permit');
        DELETE FROM ombu_sip_devices WHERE device_id = $sip_device;
        UPDATE ombu_devices SET technology = 'pjsip', profile_id = $pjsip_prfile_id WHERE device_id = $sip_device
FIN
done < <(printf '%s\n' "$sip_devices")
vitalpbx fully-gen-conf

This script will create a pjsip device for each sip device it finds, and delete the sip device, it’ll then update the ombu_devices table, stting the device technology to pjsip and the device profile to the “Default PJSIP Profile”

PS. I’d recommend taking a snapshot/backup before running the script.

2 Likes

Wow, thank you very much for the script.
What exactly do I do with it, is it a normal shell script?

Yes, it’s a regular shell/bash script.