<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6741">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">contrib/script/sip_to_pjsip: implement 'all' for allow/disallow<br><br>when 'all' is specified in an allow or disallow section, it should erase<br>all values from the inverse section in the default config. E.G.<br>allow=all should erase any deny values from default config &<br>vice-versa<br><br>ASTERISK-27333 #close<br><br>Change-Id: I99219478fb98f08751d769daaee0b7795118a5a6<br>---<br>M contrib/scripts/sip_to_pjsip/sip_to_pjsip.py<br>1 file changed, 42 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py b/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py<br>index eb3aab3..533e4ba 100755<br>--- a/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py<br>+++ b/contrib/scripts/sip_to_pjsip/sip_to_pjsip.py<br>@@ -77,6 +77,46 @@<br> section_to if section_to else section,<br> pjsip, nmapped, type)<br> <br>+def merge_codec_value(key=None, val=None, section=None, pjsip=None,<br>+ nmapped=None, type='endpoint', section_to=None,<br>+ key_to=None):<br>+ """Merge values from allow/deny with those from the default. Special treatment for all"""<br>+ def _merge_codec_value(k, v, s, r, n):<br>+ merge_codec_value(key if key else k, v, s, r, n, type, section_to, key_to)<br>+<br>+ # if no value or section return the merge_codec_value<br>+ # function with the enclosed key and type<br>+ if not val and not section:<br>+ return _merge_codec_value<br>+<br>+ if key == 'allow':<br>+ try:<br>+ disallow = sip.get(section, 'disallow')[0]<br>+ if disallow == 'all':<br>+ #don't inherit<br>+ for i in sip.get(section, 'allow'):<br>+ set_value(key, i, section, pjsip, nmapped, type)<br>+ else:<br>+ merge_value(key, val, section, pjsip, nmapped, type, section_to, key_to)<br>+ except LookupError:<br>+ print "lookup error"<br>+ merge_value(key, val, section, pjsip, nmapped, type, section_to, key_to)<br>+ return<br>+ elif key == 'disallow':<br>+ try:<br>+ allow = sip.get(section, 'allow')[0]<br>+ if allow == 'all':<br>+ #don't inherit<br>+ for i in sip.get(section, 'disallow'):<br>+ set_value(key, i, section, pjsip, nmapped, type)<br>+ else:<br>+ merge_value(key, val, section, pjsip, nmapped, type, section_to, key_to)<br>+ except LookupError:<br>+ merge_value(key, val, section, pjsip, nmapped, type, section_to, key_to)<br>+ return<br>+ else:<br>+ merge_value(key, val, section, pjsip, nmapped, type, section_to, key_to)<br>+<br> <br> def non_mapped(nmapped):<br> """Write non-mapped sip.conf values to the non-mapped object"""<br>@@ -404,8 +444,8 @@<br> ###########################################################################<br> ['context', set_value],<br> ['dtmfmode', set_dtmfmode],<br>- ['disallow', merge_value],<br>- ['allow', merge_value],<br>+ ['disallow', merge_codec_value],<br>+ ['allow', merge_codec_value],<br> ['nat', from_nat], # rtp_symmetric, force_rport,<br> # rewrite_contact<br> ['rtptimeout', set_value('rtp_timeout')],<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6741">change 6741</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6741"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I99219478fb98f08751d769daaee0b7795118a5a6 </div>
<div style="display:none"> Gerrit-Change-Number: 6741 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Torrey Searle <tsearle@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>