[Home]

Summary:ASTERISK-22374: Finish mapping the sip.conf parameters to res_sip.conf parameters
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2013-08-23 12:01:46Date Closed:2013-10-31 17:09:01
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Contrib/General Resources/res_pjsip
Versions:12 13.10.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) certificates.patch
( 1) cos_and_tos.patch
( 2) encryption.patch
( 3) expiry.patch
( 4) extern.patch
( 5) merge_value.patch
( 6) register_transport.patch
( 7) register_username.patch
( 8) session-timers.patch
( 9) system.patch
(10) tls_client_method.patch
Description:The sip to res_pjsip script still needs a number of mappings. These include the following:

{noformat}
#### maps to auth ###
#        type = auth
#        username
#        password
#        md5_cred
#        realm
#        nonce_lifetime
#        auth_type
### maps to transport ###
#        type = transport
#        protocol
#        bind
#        async_operations
#        ca_list_file
#        cert_file
#        privkey_file
#        password
#        external_signaling_address - externip & externhost
#        external_signaling_port
#        external_media_address
#        domain
#        verify_server
#        verify_client
#        require_client_cert
#        method
#        cipher
#        localnet
### maps to domain_alias ###
#        type = domain_alias
#        domain
### maps to registration ###
#        type = registration
#        server_uri
#        client_uri
#        contact_user
#        transport
#        outbound_proxy
#        expiration
#        retry_interval
#        max_retries
#        auth_rejection_permanent
#        outbound_auth
### maps to identify ###
#        type = identify
#        endpoint
#        match
{noformat}

Let's knock out as many as possible :-)
Comments:By: Alexander Traud (traud) 2016-08-18 08:22:29.904-0500

Thanks to this Python script, the migration from the channel driver chan_sip to the channel driver based on the PJProject (res_pjsip) was much easier.

However, my sip.conf was not migrated completely. Looking at the source of the Python script revealed several different causes, ranging from simple typos, over wrong value names, different defaults, dead functions, re-naming issues, parsing errors, to architectural misunderstandings. I did not do a full code review but fixed those issues which just my sip.conf revealed:

- media_encryption was not printed to pjsip.conf, because of scrambled letters; fixed through {{encryption.patch}}

- cos and tos were not printed to pjsip.conf, as they were not found in sip.conf, because of scrambled letters. Furthermore now, set_value was called with one to much parameter and with one wrong parameter value, because of a copy-and-paste error; fixed in {{cos_and_tos.patch}}

- session-timers=accept and session-timers=refuse were migrated to wrong values; fixed through {{session-timers.patch}}

- local_net, contact_acl, contact_deny, contact_permit were not printed to pjsip.conf, because these keys have a different name than in sip.conf; fixed through {{merge_value.patch}}

- compactheaders, timerb, timert1, useragent were not mapped to pjsip.conf, because no section of type=system was created; fixed through {{system.patch}}

- defaultexpiry, maxexpiry, and minexpiry were not mapped to pjsip.conf (AOR) why ever; fixed through {{expiry.patch}}

- externip and externhost were mapped into each Endpoint instead of the Transports. This is not supported by PJProject and all Endpoints got rejected. Fixed through {{extern.patch}}

- username was only printed to pjsip.conf, if the (optional) field ‘authname’ was present in the register string. This happened because of a logical error. Now, the (mandatory) field ‘user’ is printed, if there is no authname, see {{register_username.patch}}

- if the register string started with tls://, tcp://, or udp://, the whole string was parsed incorrectly because the amount of colons was not calculated correctly. Furthermore, UDP was used always. Fixed through {{register_transport.patch}}.

- tlscertfile was not mapped to pjsip.conf, although mentioned in the comments. tlscapath was not mapped, because it was introduced later with and nobody updated the migration script. Fixed through {{certificates.patch}}

- tlsclientmethod of chan_sip has a different default value (sslv23) than ‘method’ in PJProject (tlsv1). The latter disables TLSv1.2. Therefore, if that key does not exist in sip.conf, it must be printed in pjsip.conf. Furthermore, the setting changed in semantic, because in chan_sip it is just for outgoing client connections. In PJProject, this setting affects both client and server. This was fixed through {{tls_client_method.patch}} which displays a note to the user, when this was set in chan_sip. By the way, setting this in chan_sip was wrong in near to all cases, because it disabled TLSv1.2 there.

- none-mapped keys are added at the top of the resulting pjsip.conf. That does not work reliable because only the first key of each section is mentioned there. It should display all affected keys. Furthermore, that list contains false negatives because the keys are filtered against those keys which were in a chan_sip Peer. Keys which are just listed in the General section, are listed as not-mapped (like bindaddr) although they were mapped.

I fixed all those issues except the last one. I hope those changes help others and are considered to be included.

By: Alexander Traud (traud) 2016-08-24 10:25:57.928-0500

The above changes/patches were all accepted by the team and are part of Asterisk now. However, the last point (none-mapped keys) is not addressed yet. I have no idea, how to solve that. Therefore, someone else has to look into that.

By: Rusty Newton (rnewton) 2016-09-01 08:01:45.591-0500

Okay I'm going to go ahead and close this again.

[~traud] your updates and patches should have been put on a new issue and not on an issue from 2014.

We rarely ever re-open older issues to track new fixes, it makes things really confusing. Try to avoid this in the future! However, thanks for all your hard work!