[Home]

Summary:ASTERISK-29142: sip_to_pjsip.py: doesn't read globbed includes
Reporter:Michael Newton (miken32)Labels:patch
Date Opened:2020-10-28 16:05:43Date Closed:2020-11-05 08:38:26.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Contrib/General
Versions:16.14.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 0001-astconfigparser.py-Handle-wildcards-in-include-s.patch
Description:My `sip.conf` includes `#include pbx/*.sip.conf` which is not processed properly. Output looks like this:

{noformat}
Please, report any issue at:
   https://issues.asterisk.org/
Reading sip.conf
Could not open file pbx/*.sip.conf for reading
Converting to PJSIP...
Writing pjsip.conf
Could not open file pjsip_pbx/*.sip.conf for writing
{noformat}

Globs should be interpreted correctly (and it should not error out when trying to create a directory.)
Comments:By: Asterisk Team (asteriskteam) 2020-10-28 16:05:44.305-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Sean Bright (seanbright) 2020-10-29 10:25:36.316-0500

[~miken32] - I'm not really a python developer, but I _think_ the [attached patch|^0001-astconfigparser.py-Handle-wildcards-in-include-s.patch] may resolve this. Could you test and let us know?

By: Michael Newton (miken32) 2020-10-29 12:26:50.625-0500

Afraid not:
{noformat}
Please, report any issue at:
   https://issues.asterisk.org/
Reading sip.conf
Converting to PJSIP...
Traceback (most recent call last):
 File "/root/sip2pjsip/sip_to_pjsip.py", line 1322, in <module>
   pjsip, non_mappings = convert(sip, pjsip_filename, dict(), False)
 File "/root/sip2pjsip/sip_to_pjsip.py", line 1243, in convert
   map_peer(sip, section, pjsip, nmapped)
 File "/root/sip2pjsip/sip_to_pjsip.py", line 1153, in map_peer
   i[1](i[0], sip.get(section, i[0])[0], section, pjsip, nmapped)
 File "/root/sip2pjsip/astconfigparser.py", line 414, in get
   return self.find_value(self.section(section), key)
 File "/root/sip2pjsip/astconfigparser.py", line 310, in find_value
   sections.sort(reverse=True)
TypeError: '<' not supported between instances of 'Section' and 'Section'
{noformat}

By: Sean Bright (seanbright) 2020-10-29 12:28:53.045-0500

Interesting - possible to attach your sip.conf file (redacting hosts/passwords/etc?) - I just need the file with the {{#include}} in it.

By: Michael Newton (miken32) 2020-10-29 13:18:55.917-0500

Looks like this is caused by having two identically named sections, and is unrelated to the includes. In this case, one of the sections was in an included file and one in the main, but it shows the same result when both are in the main file.

By: Sean Bright (seanbright) 2020-10-29 13:24:14.436-0500

Just attached a new patch which _may_ resolve that too

By: Michael Newton (miken32) 2020-10-29 14:48:40.961-0500

Confirmed working

By: Friendly Automation (friendly-automation) 2020-11-05 08:38:28.049-0600

Change 15080 merged by Friendly Automation:
sip_to_pjsip.py: Handle #include globs and other fixes

[https://gerrit.asterisk.org/c/asterisk/+/15080|https://gerrit.asterisk.org/c/asterisk/+/15080]

By: Friendly Automation (friendly-automation) 2020-11-05 08:39:38.466-0600

Change 15108 merged by Friendly Automation:
sip_to_pjsip.py: Handle #include globs and other fixes

[https://gerrit.asterisk.org/c/asterisk/+/15108|https://gerrit.asterisk.org/c/asterisk/+/15108]

By: Friendly Automation (friendly-automation) 2020-11-05 08:56:58.090-0600

Change 15109 merged by George Joseph:
sip_to_pjsip.py: Handle #include globs and other fixes

[https://gerrit.asterisk.org/c/asterisk/+/15109|https://gerrit.asterisk.org/c/asterisk/+/15109]