mirror of https://github.com/sipwise/ngcpcfg.git
adds get_all_rtp_for_host helper script update sync-db to process rtp_interface preference Squashed commit of the following: commit f2be1ea221cd9da2e4d400bcfcac4baf914563db Author: Richard Fuchs <rfuchs@sipwise.com> Date: Thu Jan 22 11:59:27 2015 -0500 implement db syncing for rtp_interface enum prefs commit 584f52c6b0094c2ca01641cdac898436f3efce86 Author: Richard Fuchs <rfuchs@sipwise.com> Date: Thu Jan 22 10:32:08 2015 -0500 change name of generated.yml commit b980dff6a106256264c81ae1bf74aba20bf32383 Author: Richard Fuchs <rfuchs@sipwise.com> Date: Wed Jan 21 12:46:07 2015 -0500 MT#10059 make sync-db load generated yml commit 92d17d8c1895f4b04663a3e485be80402382522d Author: Richard Fuchs <rfuchs@sipwise.com> Date: Wed Jan 21 12:32:58 2015 -0500 fix comment syntax error commit af8500dc315b6c142250ab0119179cb1adc67e8c Author: Richard Fuchs <rfuchs@sipwise.com> Date: Wed Jan 21 12:04:25 2015 -0500 MT#10059 support undefined hostname commit 84b8a91de59ad8ae8ad944a784850e8ac08d94fe Author: Richard Fuchs <rfuchs@sipwise.com> Date: Wed Jan 21 11:57:16 2015 -0500 MT#10059 support plain list output format commit 2b9ec081c27842dc6839218f4e5c22b761d38550 Author: Richard Fuchs <rfuchs@sipwise.com> Date: Wed Jan 21 11:38:04 2015 -0500 MT#10059 adding get_all_rtp_for_host helperchanges/07/907/1
parent
f42a8240cd
commit
3b030ceb89
@ -0,0 +1,60 @@
|
||||
[%
|
||||
|
||||
# Returns a list of RTP-enabled interfaces for rtpengine
|
||||
#
|
||||
# @param argv.host The host to get interfaces for. If blank, helper
|
||||
# script will be called.
|
||||
# @param argv.format "list" for plain list of interfaces, blank or
|
||||
# "rtpengine" for full CLI options
|
||||
# @return out The array of interfaces
|
||||
|
||||
X_host = argv.host;
|
||||
X_format = argv.format;
|
||||
|
||||
IF ! X_host.defined;
|
||||
PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'
|
||||
X_host = out;
|
||||
END;
|
||||
|
||||
IF ! X_format.defined || X_format == '';
|
||||
X_format = 'rtpengine';
|
||||
END;
|
||||
|
||||
IF ! hosts.$X_host.defined;
|
||||
X_host = 'self';
|
||||
END;
|
||||
|
||||
out = [];
|
||||
|
||||
FOREACH X_iface IN hosts.$X_host.interfaces;
|
||||
X_ifc = hosts.$X_host.$X_iface;
|
||||
X_types = X_ifc.type.grep('^rtp_.');
|
||||
IF X_types.size();
|
||||
X_type = X_types.0;
|
||||
X_type = X_type.remove('^rtp_');
|
||||
|
||||
IF X_format == 'list';
|
||||
out.push(X_type);
|
||||
NEXT;
|
||||
END;
|
||||
|
||||
X_ips = X_ifc.shared_ip.list;
|
||||
IF !X_ips.size() || !X_ips.0.defined;
|
||||
X_ips = X_ifc.ip;
|
||||
END;
|
||||
X_adv_ips = X_ifc.advertised_ip.list;
|
||||
FOREACH X_ip IN X_ips;
|
||||
X_adv_ip = X_adv_ips.shift();
|
||||
out.push(X_type _ '/' _ X_ip _ (X_adv_ip ? ('!' _ X_adv_ip) : ''));
|
||||
END;
|
||||
|
||||
X_ips = X_ifc.shared_v6ip.list;
|
||||
IF !X_ips.size() || !X_ips.0.defined;
|
||||
X_ips = X_ifc.v6ip;
|
||||
END;
|
||||
FOREACH X_ip IN X_ips;
|
||||
out.push(X_type _ '/' _ X_ip);
|
||||
END;
|
||||
END;
|
||||
END
|
||||
-%]
|
Loading…
Reference in new issue