├── debian ├── docs ├── compat ├── source │ └── format ├── clearwater-sip-perf.install ├── sprout-base.triggers ├── clearwater-sip-stress.install ├── gemini-as.install ├── sprout-icscf.install ├── call-diversion-as.install ├── mangelwurzel-as.install ├── clearwater-sipp.install ├── clearwater-sip-stress-stats.install ├── bono.install ├── sprout-mmtel-as.install ├── sprout-bgcf.links ├── sprout-libs.install ├── restund.install ├── bono.logrotate ├── sprout-base.logrotate ├── sprout-bgcf.install ├── gemini-as.postrm ├── sprout-bgcf.postrm ├── sprout-icscf.postrm ├── sprout-scscf.postrm ├── mangelwurzel-as.postrm ├── sprout-mmtel-as.postrm ├── call-diversion-as.postrm ├── sprout-scscf.links ├── .gitignore ├── bono.postrm ├── sprout-base.postrm ├── sprout-base.install ├── gemini-as.prerm ├── sprout-bgcf.prerm ├── sprout-icscf.prerm ├── sprout-scscf.prerm ├── mangelwurzel-as.prerm ├── sprout-mmtel-as.prerm ├── clearwater-sip-stress.postinst ├── clearwater-sip-perf.postinst ├── gemini-as.postinst ├── sprout-bgcf.postinst ├── sprout-icscf.postinst ├── sprout-scscf.postinst ├── clearwater-sip-stress-stats.postinst ├── mangelwurzel-as.postinst ├── sprout-mmtel-as.postinst ├── call-diversion-as.postinst ├── sprout-scscf.install └── rules ├── src ├── .gitignore ├── ut │ ├── test_empty_rph.json │ ├── test_fifc_empty_file.xml │ ├── test_sifc_empty_file.xml │ ├── test_invalid_rph.json │ ├── test_sifc_parse_error.xml │ ├── test_bgcf_missing_block.json │ ├── test_scscf_missing_block.json │ ├── test_no_priority_blocks_rph.json │ ├── test_sifc_no_entries.xml │ ├── test_fifc_empty_valid.xml │ ├── test_fifc_invalid.xml │ ├── test_sifc_missing_set.xml │ ├── test_invalid_priority_rph.json │ ├── test_non_integer_priority_rph.json │ ├── mocktsxhelper.cpp │ ├── mock_analytics_logger.cpp │ ├── test_bgcf_misspelt_route.json │ ├── sprout_test.supp │ ├── test_duplicated_value_rph.json │ ├── test_scscf_sproutlet_scscf.json │ ├── README.txt │ ├── test_badly_ordered_rph.json │ ├── test_bgcf_default_route.json │ ├── test_bgcf_extra_parts.json │ ├── mock_sproutlet.cpp │ ├── coverage-not-yet │ ├── test_enum_prefix_matching.json │ ├── test_enum_strip_separator.json │ ├── test_bgcf_parse_error.json │ ├── test_fifc_missing_node.xml │ ├── test_scscf_parse_error.json │ ├── test_scscf_fifc.xml │ ├── mock_hss_connection.cpp │ ├── mock_notify_sender.cpp │ ├── mock_rph_service.cpp │ ├── mock_xdm_connection.cpp │ ├── mock_sifc_parser.cpp │ ├── mock_registration_sender.cpp │ ├── mock_subscriber_manager.cpp │ ├── test_bgcf_missing_parts.json │ ├── test_enum_regex.json │ ├── test_icscf.json │ ├── test_utils.hpp │ ├── basetest.hpp │ ├── mock_sproutletproxy.h │ ├── mock_ralf_processor.h │ ├── basetest.cpp │ ├── mock_xdm_connection.h │ ├── acr_scscfnotify.json │ ├── mock_rph_service.h │ ├── ifc_parsing_utils.h │ ├── mock_impi_store.h │ ├── mock_as_communication_tracker.h │ ├── acr_asregister.json │ ├── test_enum_bad_regex.json │ ├── test_fifc.xml │ ├── test_fifc_changed.xml │ ├── test_fifc_one_invalid.xml │ ├── mock_notify_sender.h │ ├── mock_sifc_parser.h │ ├── test_bgcf.json │ ├── test_stateful_proxy_bgcf.json │ ├── acr_scscfsubscribe.json │ ├── test_scscf.json │ ├── test_scscf_missing_parts.json │ ├── test_sifc_missing_set_id.xml │ ├── mock_hss_connection.h │ ├── test_bgcf_sproutlet_bgcf.json │ ├── test_rph.json │ ├── test_sifc_invalid_set_id.xml │ ├── acr_bgcforigcall_start.json │ ├── acr_scscfpublish.json │ ├── sessioncase_test.cpp │ ├── acr_pcscfregister.json │ ├── acr_icscfregister_caps.json │ ├── acr_ibcftermcall_start.json │ ├── test_registrar_fifc.xml │ ├── acr_scscfcancel.json │ ├── mock_sproutlet.h │ ├── mock_registration_sender.h │ ├── mock_pjsip_module.h │ ├── handlers_test.h │ ├── acr_scscftermcall_interim.json │ ├── acr_scscforigcall_stop.json │ ├── acr_scscfregister.json │ ├── acr_scscftermcall_stop.json │ ├── acr_scscforigcall_interim.json │ ├── test_bgcf_sproutlet_enum.json │ ├── test_stateful_proxy_enum.json │ └── acr_ibcforigcall_start.json ├── sessioncase.cpp └── compositesproutlet.cpp ├── plugins └── .gitignore ├── modules └── .gitignore ├── bono.root ├── etc │ ├── clearwater │ │ └── logging │ │ │ └── bono │ └── security │ │ └── limits.conf.bono └── usr │ └── share │ └── clearwater │ ├── node_type.d │ └── 20_bono │ ├── infrastructure │ └── scripts │ │ ├── restart │ │ └── bono_restart │ │ └── bono.monit │ ├── clearwater-diags-monitor │ └── scripts │ │ └── bono_diags │ └── bin │ └── poll_bono.sh ├── scripts ├── sipp-stats │ ├── Gemfile │ ├── bin │ │ └── clearwater-sipp-stats │ ├── Gemfile.lock │ └── clearwater-sipp-stats.gemspec ├── pbx │ ├── input.csv │ └── README.md ├── bono-log-cleanup └── sprout-log-cleanup ├── CHANGELOG.md ├── sprout-base.root ├── etc │ ├── clearwater │ │ └── logging │ │ │ └── sprout │ ├── security │ │ └── limits.conf.sprout │ └── logrotate.d │ │ └── sproutanalytics └── usr │ └── share │ └── clearwater │ ├── node_type.d │ └── 20_sprout │ ├── infrastructure │ ├── scripts │ │ ├── restart │ │ │ └── sprout_restart │ │ └── reload │ │ │ ├── memcached │ │ │ └── sprout_reload │ │ │ ├── sas_json │ │ │ └── sprout_reload │ │ │ ├── shared_ifcs_xml │ │ │ └── sprout_reload │ │ │ └── fallback_ifcs_xml │ │ │ └── sprout_reload │ ├── monit_stability │ │ └── sprout-stability │ └── monit_uptime │ │ └── check-sprout-uptime │ ├── clearwater-diags-monitor │ └── scripts │ │ └── sprout_base_diags │ ├── clearwater-config-manager │ └── scripts │ │ └── config_validation │ │ ├── enum_schema.json │ │ ├── rph_schema.json │ │ └── scscf_schema.json │ └── bin │ ├── poll_sprout_http.sh │ └── poll_sprout_sip.sh ├── restund.root ├── etc │ └── security │ │ └── limits.conf.restund └── usr │ └── share │ └── clearwater │ └── bin │ └── poll_restund.sh ├── .settings └── org.eclipse.cdt.ui.prefs ├── .gitignore ├── clearwater-sipp.root └── etc │ └── sysctl.conf.clearwater-sipp ├── tests └── pbxas │ ├── Makefile │ └── README.md ├── mk ├── sipp.mk ├── libre.mk ├── sas-client.mk ├── websocketpp.mk ├── sprout.mk ├── c-ares.mk ├── pjsip.mk ├── restund.mk ├── curl.mk ├── openssl.mk ├── libevhtp.mk └── libmemcached.mk ├── clearwater-sip-stress.root ├── etc │ └── cron.hourly │ │ └── clearwater-sip-stress-log-cleanup └── usr │ └── share │ └── clearwater │ └── infrastructure │ └── scripts │ └── sip-stress ├── on-eclipse-build.sh ├── include ├── options.h ├── websockets.h ├── sproutletplugin.h ├── chronoshandlers.h ├── fork_error_state.h ├── common_sip_processing.h ├── vped_sprout_types.h ├── servercaps.h ├── mangelwurzel │ └── mangelwurzelsasevent.h ├── sm_sip_mapping.h ├── scscf_utils.h ├── uri_classifier.h ├── aor_utils.h ├── xdmconnection.h ├── compositesproutlet.h ├── dialog_tracker.hpp ├── mmtelsasevent.h ├── pluginloader.h ├── scscfselector.h ├── sessioncase.h ├── fifcservice.h └── bgcfservice.h ├── .externalToolBuilders └── Run on-eclipse-build.sh.launch ├── clearwater-sip-perf.root └── usr │ └── share │ └── clearwater │ ├── infrastructure │ └── scripts │ │ └── sip-perf │ └── bin │ └── sip-perf ├── sprout-mmtel-as.root └── usr │ └── share │ └── clearwater │ └── clearwater-diags-monitor │ └── scripts │ └── sprout_mmtel_as_diags ├── docs ├── Plugins.md ├── Mangelwurzel.md └── IOTraps.md ├── .github └── ISSUE_TEMPLATE.md └── sprout-bgcf.root └── usr └── share └── clearwater └── clearwater-config-manager └── scripts ├── upload_bgcf_json └── config_validation └── bgcf_schema.json /debian/docs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 8 2 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | *.gcov 2 | -------------------------------------------------------------------------------- /src/ut/test_empty_rph.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ut/test_fifc_empty_file.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/ut/test_sifc_empty_file.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /src/ut/test_invalid_rph.json: -------------------------------------------------------------------------------- 1 | { 2 | -------------------------------------------------------------------------------- /plugins/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /src/ut/test_sifc_parse_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/ut/test_fifc_empty_valid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/ut/test_fifc_invalid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/ut/test_sifc_missing_set.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /debian/clearwater-sip-stress-stats.install: -------------------------------------------------------------------------------- 1 | scripts/sipp-stats/clearwater-sipp-stats-*.gem /usr/share/clearwater/gems/ 2 | -------------------------------------------------------------------------------- /debian/bono.install: -------------------------------------------------------------------------------- 1 | build/bin/bono usr/share/clearwater/bin 2 | bono.root/* / 3 | scripts/bono-log-cleanup etc/cron.hourly 4 | -------------------------------------------------------------------------------- /debian/sprout-mmtel-as.install: -------------------------------------------------------------------------------- 1 | build/bin/sprout_mmtel_as.so usr/share/clearwater/sprout/plugins 2 | sprout-mmtel-as.root/* / 3 | -------------------------------------------------------------------------------- /debian/sprout-bgcf.links: -------------------------------------------------------------------------------- 1 | /usr/share/clearwater/clearwater-config-manager/scripts/upload_bgcf_json /usr/bin/cw-upload_bgcf_json 2 | -------------------------------------------------------------------------------- /scripts/pbx/input.csv: -------------------------------------------------------------------------------- 1 | SEQUENTIAL 2 | pbx@ajh1.cw-ngv.com;[authentication username=pbx@ajh1.cw-ngv.com password=password];alice@ajh1.cw-ngv.com 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.ui.prefs: -------------------------------------------------------------------------------- 1 | #Wed Aug 15 09:51:24 PDT 2012 2 | eclipse.preferences.version=1 3 | formatter_profile=_Sprout 4 | formatter_settings_version=1 5 | -------------------------------------------------------------------------------- /src/ut/test_invalid_priority_rph.json: -------------------------------------------------------------------------------- 1 | { 2 | "priority_blocks" : [ 3 | { "priority" : 25, 4 | "rph_values" : ["wps.0"] 5 | } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /src/ut/test_non_integer_priority_rph.json: -------------------------------------------------------------------------------- 1 | { 2 | "priority_blocks" : [ 3 | { "priority" : 2.71828, 4 | "rph_values" : ["wps.0"] 5 | } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /src/ut/mocktsxhelper.cpp: -------------------------------------------------------------------------------- 1 | #include "mocktsxhelper.h" 2 | 3 | MockSproutletTsxHelper::MockSproutletTsxHelper() {}; 4 | MockSproutletTsxHelper::~MockSproutletTsxHelper() {}; 5 | 6 | -------------------------------------------------------------------------------- /src/ut/mock_analytics_logger.cpp: -------------------------------------------------------------------------------- 1 | #include "mock_analytics_logger.h" 2 | 3 | MockAnalyticsLogger::MockAnalyticsLogger() {}; 4 | MockAnalyticsLogger::~MockAnalyticsLogger() {}; 5 | 6 | -------------------------------------------------------------------------------- /debian/sprout-libs.install: -------------------------------------------------------------------------------- 1 | usr/lib/*.so usr/share/clearwater/sprout/lib 2 | usr/lib/*.so.* usr/share/clearwater/sprout/lib 3 | build/bin/sprout_io_trap.so usr/share/clearwater/sprout/lib 4 | -------------------------------------------------------------------------------- /debian/restund.install: -------------------------------------------------------------------------------- 1 | usr/sbin/restund usr/share/clearwater/bin 2 | usr/lib/libre.* usr/share/clearwater/restund/lib 3 | usr/lib/restund/modules/* usr/share/clearwater/restund/lib 4 | restund.root/* / 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | /usr/ 3 | /build/ 4 | *.o 5 | *.swp 6 | *.gem 7 | on-eclipse-build.local.sh 8 | 9 | .openssl_config_run 10 | 11 | # Ignore ctags tag-file 12 | tags 13 | 14 | debian/copyright 15 | -------------------------------------------------------------------------------- /clearwater-sipp.root/etc/sysctl.conf.clearwater-sipp: -------------------------------------------------------------------------------- 1 | ################################################################### 2 | # Increase ephemeral TCP port range 3 | net.ipv4.ip_local_port_range = 1024 65535 4 | -------------------------------------------------------------------------------- /src/ut/test_bgcf_misspelt_route.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes" : [ 3 | { 4 | "name": "Default route", 5 | "domain": "*", 6 | "routes": [ "sip:trunk.cw-ngv.com:5060;transport=tcp;lr" ] 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /src/ut/sprout_test.supp: -------------------------------------------------------------------------------- 1 | { 2 | "Ignore libc double free during exit" 3 | Memcheck:Free 4 | fun:free 5 | fun:__libc_freeres 6 | fun:_vgnU_freeres 7 | fun:__run_exit_handlers 8 | fun:exit 9 | fun:(below main) 10 | } 11 | -------------------------------------------------------------------------------- /src/ut/test_duplicated_value_rph.json: -------------------------------------------------------------------------------- 1 | { 2 | "priority_blocks" : [ 3 | { "priority" : 1, 4 | "rph_values" : ["wps.0"] 5 | }, 6 | { "priority" : 2, 7 | "rph_values" : ["WPS.0"] 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /src/ut/test_scscf_sproutlet_scscf.json: -------------------------------------------------------------------------------- 1 | { 2 | "s-cscfs" : [ 3 | { "server" : "sip:scscf2.homedomain:5058", 4 | "priority" : 0, 5 | "weight" : 100, 6 | "capabilities" : [123, 432] 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /tests/pbxas/Makefile: -------------------------------------------------------------------------------- 1 | pbxas-plugin.so: pbxas.cpp 2 | g++ pbxas.cpp -shared -fPIC -o pbxas-plugin.so -I../../include -I../../modules/rapidjson/include -I../../modules/cpp-common/include -I../../usr/include/ -std=c++11 3 | 4 | clean: 5 | rm pbxas-plugin.so 6 | .PHONY: clean 7 | -------------------------------------------------------------------------------- /src/ut/README.txt: -------------------------------------------------------------------------------- 1 | Naming convention: 2 | 3 | foo_test.cpp is a suite of unit tests for the production foo. 4 | 5 | fakefoo.cpp is a fake (or stub) foo. 6 | 7 | test_foo_* is support data for the test of foo. 8 | 9 | test_foo.cpp is support code (e.g., test_main, test_utils). 10 | 11 | -------------------------------------------------------------------------------- /debian/bono.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/bono/bono_out.log /var/log/bono/bono_err.log { 2 | rotate 4 3 | weekly 4 | minsize 1M 5 | missingok 6 | create 640 root adm 7 | notifempty 8 | compress 9 | delaycompress 10 | copytruncate 11 | } 12 | 13 | -------------------------------------------------------------------------------- /debian/sprout-base.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/sprout/sprout_out.log /var/log/sprout/sprout_err.log { 2 | rotate 4 3 | weekly 4 | minsize 1M 5 | missingok 6 | create 640 root adm 7 | notifempty 8 | compress 9 | delaycompress 10 | copytruncate 11 | } 12 | 13 | -------------------------------------------------------------------------------- /src/ut/test_badly_ordered_rph.json: -------------------------------------------------------------------------------- 1 | { 2 | "priority_blocks" : [ 3 | { "priority" : 1, 4 | "rph_values" : ["wPs.0"] 5 | }, 6 | { "priority" : 2, 7 | "rph_values" : ["WpS.2"] 8 | }, 9 | { "priority" : 3, 10 | "rph_values" : ["wps.1"] 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /scripts/sipp-stats/Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | clearwater-sipp-stats (1.0.0) 5 | ffi-rzmq 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | ffi (1.7.0) 11 | ffi-rzmq (1.0.0) 12 | ffi 13 | 14 | PLATFORMS 15 | ruby 16 | 17 | DEPENDENCIES 18 | clearwater-sipp-stats! 19 | -------------------------------------------------------------------------------- /mk/sipp.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the sipp module 2 | 3 | SIPP_DIR := ${MODULE_DIR}/sipp 4 | 5 | sipp: 6 | ${MAKE} -j1 -C ${SIPP_DIR} debug_ossl 7 | 8 | sipp_test: 9 | true 10 | 11 | sipp_clean: 12 | ${MAKE} -j1 -C ${SIPP_DIR} clean 13 | 14 | sipp_distclean: sipp_clean 15 | 16 | .PHONY: sipp sipp_test sipp_clean sipp_distclean 17 | -------------------------------------------------------------------------------- /clearwater-sip-stress.root/etc/cron.hourly/clearwater-sip-stress-log-cleanup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ONE_GIG=1073741824 3 | WEEK_COUNT=168 4 | max_log_directory_size=$ONE_GIG 5 | . /etc/clearwater/config 6 | 7 | python2.7 /usr/share/clearwater/bin/log_cleanup.py /var/log/clearwater-sipp --prefix sip-stress --maxsize $max_log_directory_size --count $WEEK_COUNT 8 | -------------------------------------------------------------------------------- /src/ut/test_bgcf_default_route.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes" : [ 3 | { "name" : "Alameda PBX", 4 | "domain" : "198.147.226.2", 5 | "route" : ["ec2-54-243-253-10.compute-1.amazonaws.com"] 6 | }, 7 | { "name" : "Default Route", 8 | "domain" : "*", 9 | "route" : ["sip.example.com"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /debian/sprout-bgcf.install: -------------------------------------------------------------------------------- 1 | build/bin/sprout_bgcf.so usr/share/clearwater/sprout/plugins 2 | sprout-bgcf.root/* / 3 | 4 | # Install the etcd plugin 5 | modules/clearwater-etcd-plugins/sprout/sprout_bgcf_json_plugin.py /usr/share/clearwater/clearwater-config-manager/plugins/ 6 | 7 | modules/clearwater-etcd-plugins/clearwater_config_access/bgcf_json_config_plugin.py /usr/share/clearwater/clearwater-config-access/plugins/ 8 | -------------------------------------------------------------------------------- /scripts/bono-log-cleanup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ONE_GIG=1073741824 3 | WEEK_COUNT=168 4 | max_log_directory_size=$ONE_GIG 5 | . /etc/clearwater/config 6 | 7 | python2.7 /usr/share/clearwater/bin/log_cleanup.py /var/log/bono --prefix bono_ --maxsize $max_log_directory_size --count $WEEK_COUNT 8 | python2.7 /usr/share/clearwater/bin/log_cleanup.py /var/log/bono --prefix log_ --maxsize $max_log_directory_size --count $WEEK_COUNT 9 | -------------------------------------------------------------------------------- /src/ut/test_bgcf_extra_parts.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes" : [ 3 | { "name" : "Route 1", 4 | "domain" : "route1", 5 | "number" : "+123-123", 6 | "route" : ["sip.example.com"] 7 | }, 8 | { "name" : "Route 2", 9 | "domain" : "route2", 10 | "number" : 123123, 11 | "route" : ["sip.example.com"] 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /src/ut/mock_sproutlet.cpp: -------------------------------------------------------------------------------- 1 | #include "mock_sproutlet.h" 2 | 3 | MockSproutlet::MockSproutlet( 4 | const std::string& service_name="mock-sproutlet", 5 | int port=0, 6 | const std::string& service_host="") : 7 | Sproutlet(service_name, port, service_host) {} 8 | 9 | MockSproutlet::~MockSproutlet() {} 10 | 11 | MockSproutletTsx::MockSproutletTsx() : 12 | SproutletTsx(NULL) 13 | {} 14 | 15 | MockSproutletTsx::~MockSproutletTsx() {} 16 | -------------------------------------------------------------------------------- /src/ut/coverage-not-yet: -------------------------------------------------------------------------------- 1 | # This file lists filenames for which we do not currently expect 100% 2 | # coverage. These are files that existed before we introduced unit 3 | # tests to Sprout, and for which we have not yet written tests. New 4 | # code and new files should have 100% code coverage (by lines); it may 5 | # be acceptable to use exclusion markers to achieve this. 6 | src/pjutils.cpp 7 | src/bono.cpp 8 | src/sip_connection_pool.cpp 9 | src/sproutletappserver.cpp 10 | -------------------------------------------------------------------------------- /mk/libre.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the libre module 2 | 3 | LIBRE_DIR := ${MODULE_DIR}/libre 4 | LIBRE_FLAGS := EXTRA_CFLAGS="-D_GNU_SOURCE" 5 | 6 | libre: 7 | ${MAKE} -j1 -C ${LIBRE_DIR} ${LIBRE_FLAGS} 8 | ${MAKE} -j1 -C ${LIBRE_DIR} install DESTDIR=${ROOT} ${LIBRE_FLAGS} 9 | 10 | libre_test: 11 | @echo "No tests for libre" 12 | 13 | libre_clean: 14 | ${MAKE} -j1 -C ${LIBRE_DIR} clean 15 | 16 | libre_distclean: 17 | ${MAKE} -j1 -C ${LIBRE_DIR} distclean 18 | 19 | .PHONY: libre libre_test libre_clean libre_distclean 20 | -------------------------------------------------------------------------------- /src/ut/test_enum_prefix_matching.json: -------------------------------------------------------------------------------- 1 | { 2 | "number_blocks": [ 3 | { 4 | "regex": "!(^.*$)!tel:\\1;two-digits-prefix-match;npdi!", 5 | "prefix": "+22", 6 | "name": "+22 Numbers" 7 | }, 8 | { 9 | "regex": "!(^.*$)!tel:\\1;four-digits-prefix-match;npdi!", 10 | "prefix": "+2222", 11 | "name": "+2222 Numbers" 12 | }, 13 | { 14 | "regex": "!(^.*$)!tel:\\1;three-digits-prefix-match;npdi!", 15 | "prefix": "+222", 16 | "name": "+222 Numbers" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/ut/test_enum_strip_separator.json: -------------------------------------------------------------------------------- 1 | { 2 | "number_blocks": [ 3 | { 4 | "regex": "!(^.*$)!tel:\\1;two-digits-prefix-match;npdi!", 5 | "prefix": "+2.2", 6 | "name": "+22 Numbers" 7 | }, 8 | { 9 | "regex": "!(^.*$)!tel:\\1;three-digits-prefix-match;npdi!", 10 | "prefix": "+2.2-2", 11 | "name": "+222 Numbers" 12 | }, 13 | { 14 | "regex": "!(^.*$)!tel:\\1;four-digits-prefix-match;npdi!", 15 | "prefix": "+2.2-(22)", 16 | "name": "+2222 Numbers" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/ut/test_bgcf_parse_error.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes" : [ 3 | { "name" : "Alameda PBX", 4 | "domain" : "198.147.226.2", 5 | "route" : ["ec2-54-243-253-10.compute-1.amazonaws.com"] 6 | } 7 | { "name" : "Oakland PBX", 8 | "domain" : "foreign-domain.example.com", 9 | "route" : ["sip.example.com"] 10 | }, 11 | { "name" : "San Leandro PBX", 12 | "domain" : "198.147.226.99", 13 | "route" : ["fd3.amazonaws.com"] 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /mk/sas-client.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the sas-client module 2 | 3 | SAS_CLIENT_DIR := ${MODULE_DIR}/sas-client 4 | 5 | sas-client: 6 | ${MAKE} -j1 -C ${SAS_CLIENT_DIR} 7 | cp ${SAS_CLIENT_DIR}/*.a ${LIB_DIR}/ 8 | cp ${SAS_CLIENT_DIR}/include/*.h ${INCLUDE_DIR} 9 | 10 | sas-client_test: 11 | @echo "No tests for sas-client" 12 | 13 | sas-client_clean: 14 | ${MAKE} -j1 -C ${SAS_CLIENT_DIR} clean 15 | 16 | sas-client_distclean: 17 | ${MAKE} -j1 -C ${SAS_CLIENT_DIR} clean 18 | 19 | .PHONY: sas-client sas-client_test sas-client_clean sas-client_distclean 20 | -------------------------------------------------------------------------------- /src/ut/test_fifc_missing_node.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | 0 6 | 7 | 0 8 | 0 9 | INVITE 10 | 11 | 12 | 13 | 14 | example.com 15 | 0 16 | 17 | 18 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/infrastructure/scripts/restart/sprout_restart: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file sprout_restart 4 | # 5 | # Copyright (C) Metaswitch Networks 2015 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | service sprout quiesce 13 | -------------------------------------------------------------------------------- /on-eclipse-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file on-eclipse-build.sh 4 | # 5 | # Copyright (C) Metaswitch Networks 2013 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | if [ -e 'on-eclipse-build.local.sh' ]; then 13 | ./on-eclipse-build.local.sh 14 | fi 15 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/infrastructure/scripts/reload/memcached/sprout_reload: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file sprout_reload 4 | # 5 | # Copyright (C) Metaswitch Networks 2015 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | service sprout reload 13 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/infrastructure/scripts/reload/sas_json/sprout_reload: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file sprout_reload 4 | # 5 | # Copyright (C) Metaswitch Networks 2017 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | service sprout reload 13 | -------------------------------------------------------------------------------- /mk/websocketpp.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the websocket++ module 2 | 3 | WEBSOCKETPP_DIR := ${MODULE_DIR}/websocketpp 4 | 5 | websocketpp: 6 | ${MAKE} -j1 -C ${WEBSOCKETPP_DIR} 7 | ${MAKE} -j1 -C ${WEBSOCKETPP_DIR} install prefix=${PREFIX} 8 | 9 | websocketpp_test: 10 | ${MAKE} -j1 -C ${WEBSOCKETPP_DIR}/test/basic BOOST_LIB_PATH=/usr/lib 11 | 12 | websocketpp_clean: 13 | ${MAKE} -j1 -C ${WEBSOCKETPP_DIR} clean 14 | 15 | websocketpp_distclean: 16 | ${MAKE} -j1 -C ${WEBSOCKETPP_DIR} clean 17 | 18 | .PHONY: websocketpp websocketpp_test websocketpp_clean websocketpp_distclean 19 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/infrastructure/scripts/reload/shared_ifcs_xml/sprout_reload: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file sprout_reload 4 | # 5 | # Copyright (C) Metaswitch Networks 2017 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | service sprout reload 13 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/infrastructure/scripts/reload/fallback_ifcs_xml/sprout_reload: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file sprout_reload 4 | # 5 | # Copyright (C) Metaswitch Networks 2017 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | service sprout reload 13 | -------------------------------------------------------------------------------- /src/ut/test_scscf_parse_error.json: -------------------------------------------------------------------------------- 1 | { 2 | "s-cscfs" : [ 3 | { "server" : "cw-scscf.cw-ngv.com", 4 | "priority" : 0, 5 | "weight" : 100, 6 | "capabilities" : [123, 432] 7 | } 8 | { "server" : "cw-scscf2.cw-ngv.com", 9 | "priority" : 0, 10 | "weight" : 100, 11 | "capabilities" : [123, 432] 12 | }, 13 | { "server" : "cw-scscf3.cw-ngv.com", 14 | "priority" : 0, 15 | "weight" : 100, 16 | "capabilities" : [123, 432] 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /mk/sprout.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the sprout SIP router 2 | 3 | ifndef PJSIP_DIR 4 | include ${MK_DIR}/pjsip.mk 5 | endif 6 | 7 | ifndef LIBMEM_DIR 8 | include ${MK_DIR}/libmemcached.mk 9 | endif 10 | 11 | SPROUT_DIR := ${ROOT}/src 12 | 13 | sprout: pjsip libmemcached 14 | ${MAKE} -C ${SPROUT_DIR} 15 | 16 | sprout_test: 17 | ${MAKE} -C ${SPROUT_DIR} test 18 | 19 | sprout_full_test: 20 | ${MAKE} -C ${SPROUT_DIR} full_test 21 | 22 | sprout_clean: 23 | ${MAKE} -C ${SPROUT_DIR} clean 24 | 25 | sprout_distclean: sprout_clean 26 | 27 | .PHONY: sprout sprout_test sprout_clean sprout_distclean 28 | -------------------------------------------------------------------------------- /tests/pbxas/README.md: -------------------------------------------------------------------------------- 1 | This directory contains a plugin that acts like a TAS for a non-registering PBX. When it is invoked it: 2 | 3 | * Rewrites the request URI to be the contact URI of the PBX. 4 | * Adds route headers specifying the path to the PBX (e.g. through a P-CSCF). 5 | 6 | To use the plugin: 7 | 8 | * Edit the TARGET and PATH variables to be the values you need. 9 | * Run `make` 10 | * Copy the resulting `pbxas-plugin.so` to `/usr/share/clearwater/sprout/plugins/` on your sprout node, and restart sprout. 11 | * Configure the iFCs for the PBX to invoke `pbxas.` for terminating requests. 12 | -------------------------------------------------------------------------------- /src/ut/test_scscf_fifc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | 6 | 0 7 | 8 | 0 9 | 0 10 | INVITE 11 | 12 | 13 | 14 | 15 | sip:1.2.3.5:56789;transport=UDP 16 | 0 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/ut/mock_hss_connection.cpp: -------------------------------------------------------------------------------- 1 | #include "mock_hss_connection.h" 2 | 3 | MockHSSConnection::MockHSSConnection(): 4 | HSSConnection("localhost", 5 | NULL, 6 | NULL, 7 | &SNMP::FAKE_IP_COUNT_TABLE, 8 | &SNMP::FAKE_EVENT_ACCUMULATOR_TABLE, 9 | &SNMP::FAKE_EVENT_ACCUMULATOR_TABLE, 10 | &SNMP::FAKE_EVENT_ACCUMULATOR_TABLE, 11 | &SNMP::FAKE_EVENT_ACCUMULATOR_TABLE, 12 | &SNMP::FAKE_EVENT_ACCUMULATOR_TABLE, 13 | NULL, 14 | NULL, 15 | 0) {}; 16 | MockHSSConnection::~MockHSSConnection() {}; 17 | 18 | -------------------------------------------------------------------------------- /debian/gemini-as.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file gemini-as.postrm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # Restart sprout so it unloads the plug-in that has been removed. 18 | sudo service sprout stop || /bin/true 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /src/ut/mock_notify_sender.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_notify_sender.cpp 3 | * 4 | * Copyright (C) Metaswitch Networks 2018 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #include "mock_notify_sender.h" 13 | 14 | MockNotifySender::MockNotifySender() : 15 | NotifySender() 16 | {} 17 | 18 | MockNotifySender::~MockNotifySender() 19 | {} 20 | -------------------------------------------------------------------------------- /debian/sprout-bgcf.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-bgcf.postrm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # Restart sprout so it unloads the plug-in that has been removed. 18 | sudo service sprout stop || /bin/true 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /debian/sprout-icscf.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-icscf.postrm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # Restart sprout so it unloads the plug-in that has been removed. 18 | sudo service sprout stop || /bin/true 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /debian/sprout-scscf.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-scscf.postrm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # Restart sprout so it unloads the plug-in that has been removed. 18 | sudo service sprout stop || /bin/true 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /bono.root/usr/share/clearwater/infrastructure/scripts/restart/bono_restart: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file bono_restart 4 | # 5 | # Copyright (C) Metaswitch Networks 2016 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # Use stop rather than quiesce as quiesce is currently bugged 13 | # (see https://github.com/Metaswitch/sprout/issues/1296). 14 | service bono stop 15 | -------------------------------------------------------------------------------- /debian/mangelwurzel-as.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file mangelwurzel-as.postrm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # Restart sprout so it unloads the plug-in that has been removed. 18 | sudo service sprout stop || /bin/true 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /debian/sprout-mmtel-as.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-mmtel-as.postrm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # Restart sprout so it unloads the plug-in that has been removed. 18 | sudo service sprout stop || /bin/true 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /debian/call-diversion-as.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file call-diversion-as.postrm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # Restart sprout so it unloads the plug-in that has been removed. 18 | sudo service sprout stop || /bin/true 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /sprout-base.root/etc/logrotate.d/sproutanalytics: -------------------------------------------------------------------------------- 1 | /var/log/sprout/analytics.log { 2 | su sprout sprout 3 | daily 4 | # Keep 36500 log files (i.e. 100 years worth). The log cleanup scripts will 5 | # clean up this directory if the files become too big. 6 | rotate 36500 7 | # Add a date and timestamp to the rotated log file. 8 | dateext 9 | dateformat .%Y-%m-%d-%s 10 | extension .log 11 | missingok 12 | # Allow rsyslog to create the new file. 13 | nocreate 14 | # After rotating, rsyslog still has the rotated file open; reload it so that 15 | # it starts writing to the new file. 16 | postrotate 17 | reload rsyslog >/dev/null 2>&1 || true 18 | endscript 19 | } 20 | -------------------------------------------------------------------------------- /src/ut/mock_rph_service.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_rph_service.h 3 | * Mocks out parsing RPH configuration. 4 | * 5 | * Copyright (C) Metaswitch Networks 2017 6 | * If license terms are provided to you in a COPYING file in the root directory 7 | * of the source code repository by which you are accessing this code, then 8 | * the license outlined in that COPYING file applies to your use. 9 | * Otherwise no rights are granted except for those provided to you by 10 | * Metaswitch Networks in a separate written agreement. 11 | */ 12 | 13 | #include "mock_rph_service.h" 14 | 15 | MockRPHService::MockRPHService() : 16 | RPHService(NULL) 17 | {} 18 | 19 | MockRPHService::~MockRPHService() 20 | {} 21 | -------------------------------------------------------------------------------- /src/ut/mock_xdm_connection.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_xdm_connection.cpp 3 | * 4 | * Copyright (C) Metaswitch Networks 2018 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #include "mock_xdm_connection.h" 13 | 14 | MockXDMConnection::MockXDMConnection() : 15 | XDMConnection("server", nullptr, nullptr, nullptr, nullptr) 16 | {} 17 | 18 | MockXDMConnection::~MockXDMConnection() {} 19 | -------------------------------------------------------------------------------- /debian/sprout-scscf.links: -------------------------------------------------------------------------------- 1 | /usr/share/clearwater/clearwater-config-manager/scripts/validate_shared_ifcs_xml /usr/bin/cw-validate_shared_ifcs_xml 2 | /usr/share/clearwater/clearwater-config-manager/scripts/validate_fallback_ifcs_xml /usr/bin/cw-validate_fallback_ifcs_xml 3 | /usr/share/clearwater/clearwater-config-manager/scripts/display_shared_ifcs /usr/bin/cw-display_shared_ifcs 4 | /usr/share/clearwater/clearwater-config-manager/scripts/display_fallback_ifcs /usr/bin/cw-display_fallback_ifcs 5 | 6 | /usr/share/clearwater/clearwater-config-manager/scripts/remove_shared_ifcs_xml /usr/sbin/cw-remove_shared_ifcs_xml 7 | /usr/share/clearwater/clearwater-config-manager/scripts/remove_fallback_ifcs_xml /usr/sbin/cw-remove_fallback_ifcs_xml 8 | -------------------------------------------------------------------------------- /src/ut/mock_sifc_parser.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_sifc_parser.cpp 3 | * Mocks out parsing shared iFC set id into list of iFCs. 4 | * 5 | * Copyright (C) Metaswitch Networks 6 | * If license terms are provided to you in a COPYING file in the root directory 7 | * of the source code repository by which you are accessing this code, then 8 | * the license outlined in that COPYING file applies to your use. 9 | * Otherwise no rights are granted except for those provided to you by 10 | * Metaswitch Networks in a separate written agreement. 11 | */ 12 | 13 | #include "mock_sifc_parser.h" 14 | 15 | MockSIFCService::MockSIFCService() : 16 | SIFCService(NULL, NULL) 17 | {} 18 | 19 | MockSIFCService::~MockSIFCService() 20 | {} 21 | 22 | -------------------------------------------------------------------------------- /src/ut/mock_registration_sender.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_registration_sender.cpp 3 | * 4 | * Copyright (C) Metaswitch Networks 2018 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #include "mock_registration_sender.h" 13 | 14 | MockRegistrationSender::MockRegistrationSender() : 15 | RegistrationSender({}, NULL, NULL, false) 16 | {} 17 | 18 | MockRegistrationSender::~MockRegistrationSender() 19 | {} 20 | -------------------------------------------------------------------------------- /src/ut/mock_subscriber_manager.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_subscriber_manager.cpp 3 | * 4 | * Copyright (C) Metaswitch Networks 2018 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #include "mock_subscriber_manager.h" 13 | 14 | MockSubscriberManager::MockSubscriberManager() : 15 | SubscriberManager(NULL, NULL, NULL, NULL, NULL) 16 | {} 17 | 18 | MockSubscriberManager::~MockSubscriberManager() 19 | {} 20 | -------------------------------------------------------------------------------- /include/options.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file options.h Initialization and termination functions for Sprout OPTIONS module. 3 | * 4 | * Copyright (C) Metaswitch Networks 2013 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | /// 13 | /// 14 | 15 | #ifndef OPTIONS_H__ 16 | #define OPTIONS_H__ 17 | 18 | extern pjsip_module mod_options; 19 | 20 | pj_status_t init_options(); 21 | 22 | void destroy_options(); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /.externalToolBuilders/Run on-eclipse-build.sh.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /mk/c-ares.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the c-ares module 2 | 3 | C_ARES_DIR := ${MODULE_DIR}/c-ares 4 | C_ARES_CONFIGURE := ${C_ARES_DIR}/configure 5 | C_ARES_MAKEFILE := ${C_ARES_DIR}/Makefile 6 | 7 | ${C_ARES_CONFIGURE}: 8 | cd ${C_ARES_DIR} && ./buildconf 9 | 10 | ${C_ARES_MAKEFILE}: ${C_ARES_CONFIGURE} 11 | cd ${C_ARES_DIR} && ./configure --prefix=${INSTALL_DIR} 12 | 13 | c-ares: ${C_ARES_MAKEFILE} 14 | ${MAKE} -j1 -C ${C_ARES_DIR} 15 | ${MAKE} -j1 -C ${C_ARES_DIR} install 16 | 17 | c-ares_test: 18 | true 19 | 20 | c-ares_clean: ${C_ARES_MAKEFILE} 21 | ${MAKE} -j1 -C ${C_ARES_DIR} clean 22 | 23 | c-ares_distclean: ${C_ARES_MAKEFILE} 24 | ${MAKE} -j1 -C ${C_ARES_DIR} distclean 25 | 26 | .PHONY: c-ares c-ares_test c-ares_clean c-ares_distclean 27 | -------------------------------------------------------------------------------- /scripts/sipp-stats/clearwater-sipp-stats.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = 'clearwater-sipp-stats' 3 | s.version = '1.0.0' 4 | s.date = '2013-04-15' 5 | s.summary = "Statistics server for SIPp stress nodes" 6 | s.description = "Statistics server for SIPp stress nodes. Parses the counts CSV file generated by SIPp and reports a select subset over 0MQ" 7 | s.authors = ["Andy Caldwell"] 8 | s.email = 'andrew.caldwell@metaswitch.com' 9 | s.homepage = 'http://projectclearwater.org' 10 | s.license = 'GPL3' 11 | 12 | s.bindir = "bin" 13 | s.files = ["lib/clearwater-sipp-stats.rb"] 14 | s.executables << "clearwater-sipp-stats" 15 | 16 | s.add_dependency 'ffi-rzmq' 17 | end 18 | -------------------------------------------------------------------------------- /mk/pjsip.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the pjsip module 2 | 3 | PJSIP_DIR := ${MODULE_DIR}/pjsip 4 | PJSIP_CONFIG_ARTIFACT := ${PJSIP_DIR}/build.mak 5 | 6 | ${PJSIP_CONFIG_ARTIFACT}: 7 | cd ${MODULE_DIR}/pjsip && ./configure --without-ffmpeg --disable-ffmpeg --prefix=${INSTALL_DIR} --enable-epoll CFLAGS=-ggdb3 8 | 9 | pjsip: ${PJSIP_CONFIG_ARTIFACT} 10 | ${MAKE} -j1 -C ${MODULE_DIR}/pjsip dep 11 | ${MAKE} -j1 -C ${MODULE_DIR}/pjsip 12 | ${MAKE} -j1 -C ${MODULE_DIR}/pjsip install 13 | 14 | pjsip_test: 15 | ${MAKE} -j1 -C ${MODULE_DIR}/pjsip selftest 16 | 17 | pjsip_clean: 18 | ${MAKE} -j1 -C ${MODULE_DIR}/pjsip clean 19 | 20 | pjsip_distclean: 21 | ${MAKE} -j1 -C ${MODULE_DIR}/pjsip distclean 22 | 23 | .PHONY: pjsip pjsip_test pjsip_clean pjsip_distclean 24 | -------------------------------------------------------------------------------- /src/ut/test_bgcf_missing_parts.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes" : [ 3 | { "name" : "Alameda PBX", 4 | "route" : ["ec2-54-243-253-10.compute-1.amazonaws.com"] 5 | }, 6 | { "name" : "Oakland PBX", 7 | "domain" : ["foreign-domain.example.com"] 8 | }, 9 | { "name" : "San Leandro PBX", 10 | "domain" : [], 11 | "route" : ["fd3.amazonaws.com"] 12 | }, 13 | { "name" : "Berkeley PBX", 14 | "domain" : "198.147.226.99", 15 | "route" : { "route" : "whatsit.example.com" } 16 | }, 17 | { "name" : "Hayward PBX", 18 | "domain" : "198.147.226.98", 19 | "route" : ["fd4.amazonaws.com"] 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/ut/test_enum_regex.json: -------------------------------------------------------------------------------- 1 | { 2 | "number_blocks" : [ 3 | { "name" : "Basic number 5108580271", 4 | "prefix" : "5108580271", 5 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 6 | }, 7 | { "name" : "With +1 prefix", 8 | "prefix" : "+15108580271", 9 | "regex" : "!^\\+1(.*)$!sip:\\1@ut.cw-ngv.com!" 10 | }, 11 | { "name" : "With 0111 prefix", 12 | "prefix" : "01115108580271", 13 | "regex" : "!^0111(.*)$!sip:\\1@ut.cw-ngv.com!" 14 | }, 15 | { "name" : "Basic number 5108580272 using unusual separators", 16 | "prefix" : "5108580272", 17 | "regex" : "/(^.*$)/sip:\\1@ut.cw-ngv.com/" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /bono.root/usr/share/clearwater/clearwater-diags-monitor/scripts/bono_diags: -------------------------------------------------------------------------------- 1 | # @file bono_diags 2 | # 3 | # Copyright (C) Metaswitch Networks 2013 4 | # If license terms are provided to you in a COPYING file in the root directory 5 | # of the source code repository by which you are accessing this code, then 6 | # the license outlined in that COPYING file applies to your use. 7 | # Otherwise no rights are granted except for those provided to you by 8 | # Metaswitch Networks in a separate written agreement. 9 | 10 | # This script is executed in the context of the clearwater_diags_monitor script 11 | # (in the clearwater-infrastruture project). 12 | 13 | . /etc/clearwater/config 14 | 15 | # Check we can contact sprout. 16 | check_connectivity_to_domain "$sprout_hostname" 5054 17 | -------------------------------------------------------------------------------- /clearwater-sip-perf.root/usr/share/clearwater/infrastructure/scripts/sip-perf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set up defaults, then dot in base configuration. 4 | # - base - base directory number 5 | # - count - number of directory numbers per instance (must be even) 6 | # - password - SIP password to use for all DNs (insecure but OK for stress) 7 | base=2010000000 8 | count=5000 9 | password=7kkzTyGW 10 | . /etc/clearwater/config 11 | 12 | # Create configuration file. 13 | { echo USER 14 | for dn in $(eval echo {$((base))..$((base + count - 2))..2}) 15 | do 16 | echo "$dn;[authentication username=$dn@$home_domain password=$password];$((dn + 1));[authentication username=$((dn + 1))@$home_domain password=$password]" 17 | done 18 | } > /usr/share/clearwater/sip-perf/users.csv 19 | -------------------------------------------------------------------------------- /debian/.gitignore: -------------------------------------------------------------------------------- 1 | *.debhelper 2 | *.debhelper.log 3 | *.substvars 4 | /changelog 5 | /files 6 | /bono-dbg/ 7 | /bono/ 8 | /bono-node-dbg/ 9 | /bono-node/ 10 | /clearwater-sipp/ 11 | /clearwater-sipp-dbg/ 12 | /clearwater-sip-stress/ 13 | /clearwater-sip-stress-stats/ 14 | /clearwater-sip-perf/ 15 | /restund/ 16 | /sprout-dbg/ 17 | /sprout-libs-dbg/ 18 | /sprout-libs/ 19 | /sprout-node-dbg/ 20 | /sprout-node/ 21 | /sprout/ 22 | /sprout-base/ 23 | /sprout-base-dbg/ 24 | /sprout-scscf/ 25 | /sprout-scscf-dbg/ 26 | /sprout-icscf/ 27 | /sprout-icscf-dbg/ 28 | /sprout-bgcf/ 29 | /sprout-bgcf-dbg/ 30 | /sprout-mmtel-as/ 31 | /sprout-mmtel-as-dbg/ 32 | /gemini-as/ 33 | /gemini-as-dbg/ 34 | /call-diversion-as/ 35 | /call-diversion-as-dbg/ 36 | /mangelwurzel-as/ 37 | /mangelwurzel-as-dbg/ 38 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/infrastructure/monit_stability/sprout-stability: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file sprout-stability 4 | # 5 | # Copyright (C) Metaswitch Networks 2017 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # Used for monitoring the stability of the sprout process. 13 | 14 | PROCESS_NAME="sprout" 15 | GRACE_PERIOD=20 16 | 17 | method=$1 18 | 19 | /usr/share/clearwater/bin/process-stability $method $PROCESS_NAME $GRACE_PERIOD 20 | exit $? 21 | -------------------------------------------------------------------------------- /sprout-mmtel-as.root/usr/share/clearwater/clearwater-diags-monitor/scripts/sprout_mmtel_as_diags: -------------------------------------------------------------------------------- 1 | # @file sprout_mmtel_as_diags 2 | # 3 | # Copyright (C) Metaswitch Networks 2014 4 | # If license terms are provided to you in a COPYING file in the root directory 5 | # of the source code repository by which you are accessing this code, then 6 | # the license outlined in that COPYING file applies to your use. 7 | # Otherwise no rights are granted except for those provided to you by 8 | # Metaswitch Networks in a separate written agreement. 9 | 10 | # This script is executed in the context of the clearwater_diags_monitor script 11 | # (in the clearwater-infrastructure project). 12 | 13 | . /etc/clearwater/config 14 | 15 | # Check we can contact homer. 16 | check_connectivity_to_domain "$xdms_hostname" 7888 17 | -------------------------------------------------------------------------------- /include/websockets.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file websockets.h Definitions for WebSockets class. 3 | * 4 | * Copyright (C) Metaswitch Networks 2013 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | /// 13 | /// 14 | 15 | #ifndef WEBSOCKETS_H__ 16 | #define WEBSOCKETS_H__ 17 | 18 | #include 19 | 20 | extern pjsip_module mod_ws_transport; 21 | extern pj_status_t init_websockets(unsigned short port); 22 | extern void destroy_websockets(); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /mk/restund.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the libre module 2 | 3 | ifndef LIBRE_DIR 4 | include ${MK_DIR}/libre.mk 5 | endif 6 | 7 | RESTUND_DIR := ${MODULE_DIR}/restund 8 | 9 | restund: libre 10 | ${MAKE} -j1 -C ${RESTUND_DIR} LIBRE_MK=${LIBRE_DIR}/mk/re.mk \ 11 | EXTRA_CFLAGS='-I${INCLUDE_DIR}/re -I${RESTUND_DIR}/include -D_GNU_SOURCE' \ 12 | LIBRE_SO='${LIB_DIR}' 13 | ${MAKE} -j1 -C ${RESTUND_DIR} install DESTDIR=${ROOT} \ 14 | LIBRE_MK=${LIBRE_DIR}/mk/re.mk 15 | 16 | restund_test: 17 | @echo "No tests for restund" 18 | 19 | restund_clean: 20 | ${MAKE} -j1 -C ${RESTUND_DIR} clean \ 21 | LIBRE_MK=${LIBRE_DIR}/mk/re.mk 22 | 23 | restund_distclean: 24 | ${MAKE} -j1 -C ${RESTUND_DIR} distclean \ 25 | LIBRE_MK=${LIBRE_DIR}/mk/re.mk 26 | 27 | .PHONY: restund restund_test restund_clean restund_distclean 28 | -------------------------------------------------------------------------------- /mk/curl.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the curl module 2 | 3 | CURL_DIR := ${MODULE_DIR}/curl 4 | CURL_CONFIGURE := ${CURL_DIR}/configure 5 | CURL_MAKEFILE := ${CURL_DIR}/Makefile 6 | 7 | ${CURL_CONFIGURE}: 8 | cd ${CURL_DIR} && ./buildconf 9 | 10 | ${CURL_MAKEFILE}: ${CURL_CONFIGURE} 11 | cd ${CURL_DIR} && LDFLAGS=-ldl ./configure --prefix=${INSTALL_DIR} --enable-ares=${INSTALL_DIR} --without-librtmp --disable-ldap --disable-ldaps 12 | 13 | curl: ${CURL_MAKEFILE} 14 | ${MAKE} -j1 -C ${CURL_DIR} 15 | ${MAKE} -j1 -C ${CURL_DIR} install 16 | 17 | curl_test: ${CURL_MAKEFILE} 18 | ${MAKE} -j1 -C ${CURL_DIR} test 19 | 20 | curl_clean: ${CURL_MAKEFILE} 21 | ${MAKE} -j1 -C ${CURL_DIR} clean 22 | 23 | curl_distclean: ${CURL_MAKEFILE} 24 | ${MAKE} -j1 -C ${CURL_DIR} distclean 25 | 26 | .PHONY: curl curl_test curl_clean curl_distclean 27 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/infrastructure/monit_uptime/check-sprout-uptime: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file check-sprout-uptime 4 | # 5 | # Copyright (C) Metaswitch Networks 2016 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # Monit 5.8.1 does not support passing arguments to check program scripts. 13 | # check-uptime provides common uptime-checking code. This wrapper script 14 | # uses it, and can be called with no arguments. 15 | /usr/share/clearwater/bin/check-uptime /var/run/sprout/sprout.pid monit 1000.1 16 | -------------------------------------------------------------------------------- /docs/Plugins.md: -------------------------------------------------------------------------------- 1 | # Plugins 2 | 3 | Additional sproutlets can be built as plugins by placing their source code in a subdirectory of the `plugins` directory. 4 | 5 | The plugin's source tree should have a Makefile at the top level that provides the following targets: 6 | 7 | * `build` - which builds the plugin code. 8 | * `test` - which builds and runs all unit tests. 9 | * `clean` - which cleans the source tree of built objects. 10 | * `deb-only` - which builds a deb package of the plugin. 11 | * `deb` - which should cause both `build` and `deb-only` steps to run. 12 | 13 | The `deb-only` step can be implemented using the `build-infra/cw-deb.mk` Makefile in the containing sprout repository. 14 | 15 | A sample app server plugin with appropriate Makefile is provided [in the greeter repository](https://github.com/Metaswitch/greeter). 16 | 17 | -------------------------------------------------------------------------------- /include/sproutletplugin.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sproutletplugin.h Abstract definition for Sproutlet Plug-in interface. 3 | * 4 | * Copyright (C) Metaswitch Networks 2015 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef SPROUTLETPLUGIN_H__ 13 | #define SPROUTLETPLUGIN_H__ 14 | 15 | #include "sproutlet.h" 16 | 17 | class SproutletPlugin 18 | { 19 | public: 20 | virtual bool load(struct options& opt, std::list& sproutlets) = 0; 21 | virtual void unload() = 0; 22 | }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /mk/openssl.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the openssl module 2 | 3 | OPENSSL_DIR := ${MODULE_DIR}/openssl 4 | OPENSSL_CONFIGURE := ${OPENSSL_DIR}/config 5 | OPENSSL_CONFIG_MARKER := .openssl_config_run 6 | OPENSSL_MAKEFILE := ${OPENSSL_DIR}/Makefile 7 | 8 | ${OPENSSL_CONFIG_MARKER}: 9 | cd ${OPENSSL_DIR}; \ 10 | ./config --prefix=${INSTALL_DIR} -fPIC 11 | touch ${OPENSSL_CONFIG_MARKER} 12 | 13 | openssl: ${OPENSSL_CONFIG_MARKER} 14 | ${MAKE} -j1 -C ${OPENSSL_DIR} 15 | ${MAKE} -j1 -C ${OPENSSL_DIR} install_sw 16 | 17 | openssl_test: ${OPENSSL_CONFIG_MARKER} 18 | ${MAKE} -j1 -C ${OPENSSL_DIR} test 19 | 20 | openssl_clean: ${OPENSSL_CONFIG_MARKER} 21 | ${MAKE} -j1 -C ${OPENSSL_DIR} clean 22 | 23 | openssl_distclean: openssl_clean 24 | rm -f ${OPENSSL_CONFIG_MARKER} 25 | 26 | .PHONY: openssl openssl_test openssl_clean openssl_distclean 27 | -------------------------------------------------------------------------------- /scripts/sprout-log-cleanup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ONE_GIG=1073741824 3 | WEEK_COUNT=168 4 | max_log_directory_size=$ONE_GIG 5 | . /etc/clearwater/config 6 | 7 | python2.7 /usr/share/clearwater/bin/log_cleanup.py /var/log/sprout --prefix ramtrace --maxsize $max_log_directory_size --count 2 8 | python2.7 /usr/share/clearwater/bin/log_cleanup.py /var/log/sprout --prefix sprout_ --maxsize $max_log_directory_size --count $WEEK_COUNT 9 | python2.7 /usr/share/clearwater/bin/log_cleanup.py /var/log/sprout --prefix log_ --maxsize $max_log_directory_size --count $WEEK_COUNT 10 | python2.7 /usr/share/clearwater/bin/log_cleanup.py /var/log/sprout --prefix access --maxsize $max_log_directory_size --count $WEEK_COUNT 11 | python2.7 /usr/share/clearwater/bin/log_cleanup.py /var/log/sprout --prefix analytics --maxsize $max_log_directory_size --count $WEEK_COUNT 12 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/clearwater-diags-monitor/scripts/sprout_base_diags: -------------------------------------------------------------------------------- 1 | # @file sprout_base_diags 2 | # 3 | # Copyright (C) Metaswitch Networks 2014 4 | # If license terms are provided to you in a COPYING file in the root directory 5 | # of the source code repository by which you are accessing this code, then 6 | # the license outlined in that COPYING file applies to your use. 7 | # Otherwise no rights are granted except for those provided to you by 8 | # Metaswitch Networks in a separate written agreement. 9 | 10 | # This script is executed in the context of the clearwater_diags_monitor script 11 | # (in the clearwater-infrastructure project). 12 | 13 | . /etc/clearwater/config 14 | 15 | # Check we can contact homestead and bono. 16 | check_connectivity_to_domain "$hs_hostname" 8888 17 | check_connectivity_to_domain "$home_domain" 5058 18 | -------------------------------------------------------------------------------- /src/ut/test_icscf.json: -------------------------------------------------------------------------------- 1 | { 2 | "s-cscfs" : [ 3 | { "server" : "sip:scscf1.homedomain:5058;transport=TCP", 4 | "priority" : 1, 5 | "weight" : 100, 6 | "capabilities" : [123, 432, 345] 7 | }, 8 | { "server" : "sip:scscf2.homedomain:5058;transport=TCP", 9 | "priority" : 1, 10 | "weight" : 100, 11 | "capabilities" : [123, 432, 654] 12 | }, 13 | { "server" : "sip:scscf3.homedomain:5058;transport=TCP", 14 | "priority" : 2, 15 | "weight" : 100, 16 | "capabilities" : [654, 567, 789] 17 | }, 18 | { "server" : "sip:scscf4.homedomain:5058;transport=TCP", 19 | "priority" : 0, 20 | "weight" : 100, 21 | "capabilities" : [654, 567] 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /bono.root/usr/share/clearwater/bin/poll_bono.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file poll_bono.sh 4 | # 5 | # Copyright (C) Metaswitch Networks 2015 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # This script uses a SIP message to poll a process and check whether it is 13 | # healthy. 14 | 15 | . /etc/clearwater/config 16 | [ -z $signaling_namespace ] || namespace_prefix="ip netns exec $signaling_namespace" 17 | 18 | # Just call into the poll-sip script, specifying our port. 19 | $namespace_prefix /usr/share/clearwater/bin/poll-sip 5058 20 | exit $? 21 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/clearwater-config-manager/scripts/config_validation/enum_schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "All ENUM Entries", 3 | "type": "object", 4 | "properties": { 5 | "number_blocks": { 6 | "type": "array", 7 | "items": { 8 | "title": "Each number block", 9 | "type": "object", 10 | "properties": { 11 | "name": { 12 | "type": "string" 13 | }, 14 | "prefix": { 15 | "type": "string", 16 | "pattern": "^\\+{0,1}[0-9]*$" 17 | }, 18 | "regex": { 19 | "type": "string" 20 | } 21 | }, 22 | "required": [ 23 | "name", 24 | "prefix", 25 | "regex" 26 | ], 27 | "additionalProperties": false 28 | } 29 | } 30 | }, 31 | "additionalProperties": false 32 | } 33 | -------------------------------------------------------------------------------- /src/ut/test_utils.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file test_utils.hpp Unit test utility functions header file 3 | * 4 | * Copyright (C) Metaswitch Networks 2015 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | 13 | #pragma once 14 | 15 | #include "gtest/gtest.h" 16 | #include 17 | #include 18 | 19 | /// Expect that std::list L contains value X. 20 | #define EXPECT_CONTAINED(X, L) \ 21 | EXPECT_TRUE(find((L).begin(), (L).end(), (X)) != (L).end()) 22 | 23 | /// The directory that contains the unit tests. 24 | extern const std::string UT_DIR; 25 | -------------------------------------------------------------------------------- /src/ut/basetest.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file basetest.hpp Base class for UTs. 3 | * 4 | * Copyright (C) Metaswitch Networks 2016 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | /// 13 | ///---------------------------------------------------------------------------- 14 | 15 | #pragma once 16 | 17 | #include "gmock/gmock.h" 18 | #include "gtest/gtest.h" 19 | 20 | #include "fakelogger.h" 21 | #include "stack.h" 22 | #include "snmp_event_accumulator_table.h" 23 | 24 | /// Fixture for test. 25 | class BaseTest : public ::testing::Test 26 | { 27 | virtual ~BaseTest(); 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /src/ut/mock_sproutletproxy.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_sproutletproxy.hpp Mock SproutletProxy 3 | * 4 | * Copyright (C) Metaswitch Networks 2015 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MOCKSPROUTLETPROXY_H__ 13 | #define MOCKSPROUTLETPROXY_H__ 14 | 15 | #include "gmock/gmock.h" 16 | #include "sproutletproxy.h" 17 | 18 | // Mock class for SproutletProxy. 19 | class MockSproutletProxy : public SproutletProxy 20 | { 21 | public: 22 | MockSproutletProxy(pjsip_endpoint* endpt) : 23 | SproutletProxy(endpt, 0, "", {}, {}, true, {}, NULL, NULL) {} 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /debian/bono.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file bono.postrm 4 | # 5 | # Copyright (C) Metaswitch Networks 2013 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # Call into clearwater-logging-update to update logging now that we've removed 18 | # removing configuration files. 19 | [ ! -x /usr/share/clearwater/bin/clearwater-logging-update ] || /usr/share/clearwater/bin/clearwater-logging-update 20 | 21 | # dh_installdeb will replace this with shell code automatically 22 | # generated by other debhelper scripts. 23 | 24 | #DEBHELPER# 25 | 26 | exit 0 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | #### Symptoms 10 | 11 | 12 | 13 | #### Impact 14 | 15 | 16 | 17 | #### Release and environment 18 | 19 | 20 | 21 | #### Steps to reproduce 22 | 23 | -------------------------------------------------------------------------------- /src/sessioncase.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sessioncase.cpp The session case data type. 3 | * 4 | * Copyright (C) Metaswitch Networks 2015 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | 13 | #include 14 | 15 | #include "sessioncase.h" 16 | 17 | SessionCase::SessionCase(std::string name) : 18 | _name(name) 19 | { 20 | } 21 | 22 | std::string SessionCase::to_string() const 23 | { 24 | return _name; 25 | } 26 | 27 | const SessionCase SessionCase::Originating("orig"); 28 | const SessionCase SessionCase::Terminating("term"); 29 | const SessionCase SessionCase::OriginatingCdiv("orig-cdiv"); 30 | 31 | -------------------------------------------------------------------------------- /src/ut/mock_ralf_processor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_ralf_processor.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MOCK_RALF_PROCESSOR_H_ 13 | #define MOCK_RALF_PROCESSOR_H_ 14 | 15 | #include "gmock/gmock.h" 16 | #include "ralf_processor.h" 17 | 18 | class MockRalfProcessor : public RalfProcessor 19 | { 20 | public: 21 | MockRalfProcessor() : 22 | RalfProcessor(NULL, NULL, 2){}; 23 | 24 | virtual ~MockRalfProcessor(){}; 25 | 26 | MOCK_METHOD1(send_request_to_ralf, void(RalfProcessor::RalfRequest* rr)); 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /mk/libevhtp.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the libevhtp module 2 | 3 | LIBEVHTP_DIR := ${MODULE_DIR}/libevhtp 4 | LIBEVHTP_BUILD_DIR := ${ROOT}/build/libevhtp 5 | LIBEVHTP_MAKEFILE := ${LIBEVHTP_BUILD_DIR}/build/Makefile 6 | 7 | ${LIBEVHTP_BUILD_DIR}: 8 | mkdir -p ${LIBEVHTP_BUILD_DIR} 9 | 10 | ${LIBEVHTP_MAKEFILE}: ${LIBEVHTP_BUILD_DIR} 11 | cd ${LIBEVHTP_BUILD_DIR} && cmake ${LIBEVHTP_DIR} -DEVHTP_DISABLE_SSL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DEVHTP_DISABLE_REGEX=ON -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} 12 | 13 | libevhtp: ${LIBEVHTP_MAKEFILE} 14 | ${MAKE} -j1 -C ${LIBEVHTP_BUILD_DIR} 15 | ${MAKE} -j1 -C ${LIBEVHTP_BUILD_DIR} install 16 | 17 | libevhtp_test: ${LIBEVHTP_MAKEFILE} 18 | ${MAKE} -j1 -C ${LIBEVHTP_BUILD_DIR} test 19 | 20 | libevhtp_clean: ${LIBEVHTP_MAKEFILE} 21 | ${MAKE} -j1 -C ${LIBEVHTP_BUILD_DIR} clean 22 | 23 | libevhtp_distclean: 24 | rm -rf ${LIBEVHTP_BUILD_DIR} 25 | 26 | .PHONY: libevhtp libevhtp_test libevhtp_clean libevhtp_distclean 27 | -------------------------------------------------------------------------------- /src/ut/basetest.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file basetest.cpp Base class for UTs. 3 | * 4 | * Copyright (C) Metaswitch Networks 2016 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | /// 13 | ///---------------------------------------------------------------------------- 14 | 15 | #include "gmock/gmock.h" 16 | #include "gtest/gtest.h" 17 | 18 | #include "statistic.h" 19 | #include "stack.h" 20 | 21 | #include "basetest.hpp" 22 | #include "test_interposer.hpp" 23 | 24 | using namespace std; 25 | 26 | BaseTest::~BaseTest() 27 | { 28 | // This ensures the UTs don't carry over any time they've advanced. 29 | cwtest_reset_time(); 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /src/ut/mock_xdm_connection.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_xdm_connection.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2018 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MOCK_XDM_CONNECTION_H__ 13 | #define MOCK_XDM_CONNECTION_H__ 14 | 15 | #include "gmock/gmock.h" 16 | #include "xdmconnection.h" 17 | 18 | using ::testing::_; 19 | 20 | class MockXDMConnection : public XDMConnection 21 | { 22 | public: 23 | MockXDMConnection(); 24 | ~MockXDMConnection(); 25 | 26 | MOCK_METHOD4(get_simservs, bool(const std::string& user, std::string& xml_data, const std::string& password, SAS::TrailId trail)); 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/ut/acr_scscfnotify.json: -------------------------------------------------------------------------------- 1 | { 2 | "peers":{}, 3 | "event":{ 4 | "Accounting-Record-Type":1, 5 | "Event-Timestamp":1, 6 | "Service-Information":{ 7 | "IMS-Information":{ 8 | "Event-Type":{ 9 | "SIP-Method":"NOTIFY", 10 | "Event":"telephone-event;duration=300" 11 | }, 12 | "Role-Of-Node":0, 13 | "Node-Functionality":0, 14 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 15 | "Requested-Party-Address":"sip:homedomain", 16 | "Time-Stamps":{ 17 | "SIP-Request-Timestamp":1, 18 | "SIP-Request-Timestamp-Fraction":0 19 | }, 20 | "IMS-Charging-Identifier":"", 21 | "From-Address":"\"6505550000\" ", 22 | "Route-Header-Received":"", 23 | "Instance-Id":"" 24 | } 25 | } 26 | } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/ut/mock_rph_service.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_rph_service.h 3 | * Mocks out parsing RPH configuration. 4 | * 5 | * Copyright (C) Metaswitch Networks 2017 6 | * If license terms are provided to you in a COPYING file in the root directory 7 | * of the source code repository by which you are accessing this code, then 8 | * the license outlined in that COPYING file applies to your use. 9 | * Otherwise no rights are granted except for those provided to you by 10 | * Metaswitch Networks in a separate written agreement. 11 | */ 12 | 13 | #ifndef MOCK_RPH_SERVICE_H_ 14 | #define MOCK_RPH_SERVICE_H_ 15 | 16 | #include "gmock/gmock.h" 17 | #include "rphservice.h" 18 | 19 | class MockRPHService: public RPHService 20 | { 21 | public: 22 | MockRPHService(); 23 | virtual ~MockRPHService(); 24 | 25 | MOCK_METHOD2(lookup_priority, SIPEventPriorityLevel(std::string rph_value, 26 | SAS::TrailId trail)); 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /scripts/pbx/README.md: -------------------------------------------------------------------------------- 1 | This folder contains a SIPp script for testing calls to and from an unregistered PBX. 2 | 3 | To test a call from the PBX: 4 | 5 | * create a subscriber to represent a PBX, and a subscriber to represent a callee 6 | * edit input.csv to contain the PBX URI, the PBX's authentication credentails, and the callee's URI 7 | * configure Bono to treat this box's IP address as an unregisterred PBX, and configure the PBX's service routes 8 | * Run the following command: 9 | 10 | sipp -sf pbx-uac.xml [[pcscf]] -m 1 -t t1 -inf input.csv 11 | 12 | To test a call to the PBX: 13 | 14 | * create a subscriber to represent a PBX, and a subscriber to represent a caller 15 | * configure your P-CSCF to allow it to route requests to the IP address of the box representing the PBX 16 | * on the box you are using to represent the PBX, edit `pbx-uas.xml` to specify it's public IP address, then run: 17 | 18 | sipp -sf pbx-uas.xml [[pcscf]] -t t1 19 | 20 | * make a call to the PBX. Hang up when you are done. 21 | -------------------------------------------------------------------------------- /src/ut/ifc_parsing_utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file ifc_parsing_utils.h 3 | * 4 | * Copyright (C) Metaswitch Networks 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include "ifc.h" 17 | 18 | inline std::string get_server_name(Ifc ifc) 19 | { 20 | return std::string(ifc._ifc->first_node("ApplicationServer")-> 21 | first_node("ServerName")->value()); 22 | } 23 | 24 | inline int32_t get_priority(Ifc ifc) 25 | { 26 | if (ifc._ifc->first_node("Priority")) 27 | { 28 | return std::atoi(ifc._ifc->first_node("Priority")->value()); 29 | } 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /debian/sprout-base.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-base.postrm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # Call into clearwater-logging-update to update logging now that we've removed 18 | # removing configuration files. 19 | [ ! -x /usr/share/clearwater/bin/clearwater-logging-update ] || /usr/share/clearwater/bin/clearwater-logging-update 20 | 21 | # Remove the sprout service (this can't be done in debhelper because the 22 | # service name is not the same the package name). 23 | if [ "$1" = "purge" ] ; then 24 | update-rc.d sprout remove >/dev/null 25 | fi 26 | 27 | exit 0 28 | -------------------------------------------------------------------------------- /include/chronoshandlers.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file chronoshandlers.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef CHRONOSHANDLERS_H__ 13 | #define CHRONOSHANDLERS_H__ 14 | 15 | #include "handlers.h" 16 | 17 | class ChronosAuthTimeoutTask : public AuthTimeoutTask 18 | { 19 | public: 20 | ChronosAuthTimeoutTask(HttpStack::Request& req, 21 | const Config* cfg, 22 | SAS::TrailId trail) : 23 | AuthTimeoutTask::AuthTimeoutTask(req, cfg, trail) 24 | {}; 25 | 26 | void run(); 27 | 28 | protected: 29 | HTTPCode handle_response(std::string body); 30 | }; 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/ut/mock_impi_store.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_impi_store.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2016 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MOCK_IMPI_STORE_H__ 13 | #define MOCK_IMPI_STORE_H__ 14 | 15 | #include "impistore.h" 16 | 17 | class MockImpiStore : public ImpiStore 18 | { 19 | public: 20 | MockImpiStore() : ImpiStore() {} 21 | virtual ~MockImpiStore() {} 22 | 23 | MOCK_METHOD2(set_impi, Store::Status(Impi* impi, SAS::TrailId trail)); 24 | MOCK_METHOD3(get_impi, Impi*(const std::string& impi, SAS::TrailId trail, bool include_expired)); 25 | MOCK_METHOD2(delete_impi, Store::Status(Impi* impi, SAS::TrailId trail)); 26 | }; 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /src/ut/mock_as_communication_tracker.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_as_communication_tracker.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2016 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MOCK_AS_COMMUNICATION_TRACKER_H__ 13 | #define MOCK_AS_COMMUNICATION_TRACKER_H__ 14 | 15 | #include "gmock/gmock.h" 16 | 17 | class MockAsCommunicationTracker : public AsCommunicationTracker 18 | { 19 | public: 20 | MockAsCommunicationTracker() : AsCommunicationTracker(NULL, NULL, NULL) {}; 21 | ~MockAsCommunicationTracker() {} 22 | 23 | MOCK_METHOD1(on_success, void(const std::string&)); 24 | MOCK_METHOD2(on_failure, void(const std::string&, const std::string&)); 25 | }; 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /include/fork_error_state.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file fork_error_state.h Fork error state enum definition 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef FORK_ERROR_STATE_H__ 13 | #define FORK_ERROR_STATE_H__ 14 | 15 | // If this enum is changed the corresponding "FORK_ERROR_TYPES" enum 16 | // in the SAS resource bundle has to be updated too. 17 | typedef enum {NONE, TIMEOUT, TRANSPORT_ERROR, NO_ADDRESSES} ForkErrorState; 18 | const char* const FORK_ERROR_STATE_VALUES[] = { 19 | "NONE", "TIMER", "TRANSPORT_ERROR", "NO_ADDRESSES"}; 20 | inline const char* fork_error_to_str(const ForkErrorState fork_error) 21 | { return FORK_ERROR_STATE_VALUES[fork_error]; }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/ut/acr_asregister.json: -------------------------------------------------------------------------------- 1 | { 2 | "peers":{}, 3 | "event":{ 4 | "Accounting-Record-Type":1, 5 | "Event-Timestamp":1, 6 | "Service-Information":{ 7 | "IMS-Information":{ 8 | "Event-Type":{ 9 | "SIP-Method":"REGISTER", 10 | "Expires":0 11 | }, 12 | "Role-Of-Node":0, 13 | "Node-Functionality":6, 14 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 15 | "Called-Party-Address":"sip:6505550000@homedomain", 16 | "Time-Stamps":{ 17 | "SIP-Request-Timestamp":1, 18 | "SIP-Request-Timestamp-Fraction":0, 19 | "SIP-Response-Timestamp":1, 20 | "SIP-Response-Timestamp-Fraction":25 21 | }, 22 | "IMS-Charging-Identifier":"", 23 | "Cause-Code":-3, 24 | "From-Address":"\"6505550000\" ", 25 | "Route-Header-Received":"", 26 | "Instance-Id":"" 27 | } 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /mk/libmemcached.mk: -------------------------------------------------------------------------------- 1 | # included mk file for the libmemcached module 2 | 3 | LIBMEM_DIR := ${MODULE_DIR}/libmemcached 4 | LIBMEM_CONFIGURE := ${LIBMEM_DIR}/configure 5 | LIBMEM_MAKEFILE := ${LIBMEM_DIR}/Makefile 6 | 7 | ${LIBMEM_CONFIGURE}: 8 | cd ${LIBMEM_DIR} && ./config/autorun.sh 9 | 10 | ${LIBMEM_MAKEFILE}: ${LIBMEM_CONFIGURE} 11 | cd ${LIBMEM_DIR} && ./configure --prefix=${INSTALL_DIR} \ 12 | --with-lib-prefix=${INSTALL_DIR} \ 13 | CFLAGS="-I${INSTALL_DIR}/include" \ 14 | LDFLAGS="-L${INSTALL_DIR}/lib" 15 | 16 | libmemcached: libevhtp ${LIBMEM_MAKEFILE} 17 | ${MAKE} -j1 -C ${LIBMEM_DIR} 18 | ${MAKE} -j1 -C ${LIBMEM_DIR} install 19 | 20 | libmemcached_test: libevhtp ${LIBMEM_MAKEFILE} 21 | ${MAKE} -j1 -C ${LIBMEM_DIR} test 22 | 23 | libmemcached_clean: ${LIBMEM_MAKEFILE} 24 | ${MAKE} -j1 -C ${LIBMEM_DIR} clean 25 | rm ${LIBMEM_CONFIGURE} 26 | 27 | libmemcached_distclean: ${LIBMEM_MAKEFILE} 28 | ${MAKE} -j1 -C ${LIBMEM_DIR} distclean 29 | rm ${LIBMEM_CONFIGURE} 30 | 31 | .PHONY: libmemcached libmemcached_test libmemcached_clean libmemcached_distclean 32 | -------------------------------------------------------------------------------- /src/ut/test_enum_bad_regex.json: -------------------------------------------------------------------------------- 1 | { 2 | "number_blocks" : [ 3 | { "name" : "Working - all following entries are (broken) variations on this", 4 | "prefix" : "+15108580271", 5 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 6 | }, 7 | { "name" : "Two few separators (missing final !) - strictly, this is invalid, but it works so let it through", 8 | "prefix" : "+15108580272", 9 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com" 10 | }, 11 | { "name" : "Two few separators (missing middle !)", 12 | "prefix" : "+15108580273", 13 | "regex" : "!(^.*$)sip:\\1@ut.cw-ngv.com!" 14 | }, 15 | { "name" : "Two many separators", 16 | "prefix" : "+15108580274", 17 | "regex" : "!(^.*$)!sip:\\1@!ut.cw-ngv.com!" 18 | }, 19 | { "name" : "Regular expression isn't parseable (unmatched [)", 20 | "prefix" : "+15108580275", 21 | "regex" : "!(^[a-z*$)!sip:\\1@ut.cw-ngv.com!" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /debian/sprout-base.install: -------------------------------------------------------------------------------- 1 | build/bin/sprout usr/share/clearwater/bin 2 | sprout-base.root/* / 3 | scripts/sprout-log-cleanup etc/cron.hourly 4 | 5 | # Install the etcd plugins 6 | modules/clearwater-etcd-plugins/sprout/sprout_json_plugin.py /usr/share/clearwater/clearwater-config-manager/plugins/ 7 | modules/clearwater-etcd-plugins/sprout/sprout_scscf_json_plugin.py /usr/share/clearwater/clearwater-config-manager/plugins/ 8 | modules/clearwater-etcd-plugins/sprout/sprout_enum_json_plugin.py /usr/share/clearwater/clearwater-config-manager/plugins/ 9 | modules/clearwater-etcd-plugins/sprout/sprout_rph_json_plugin.py /usr/share/clearwater/clearwater-config-manager/plugins/ 10 | 11 | modules/clearwater-etcd-plugins/clearwater_config_access/scscf_json_config_plugin.py /usr/share/clearwater/clearwater-config-access/plugins/ 12 | modules/clearwater-etcd-plugins/clearwater_config_access/enum_json_config_plugin.py /usr/share/clearwater/clearwater-config-access/plugins/ 13 | modules/clearwater-etcd-plugins/clearwater_config_access/rph_json_config_plugin.py /usr/share/clearwater/clearwater-config-access/plugins/ 14 | -------------------------------------------------------------------------------- /sprout-bgcf.root/usr/share/clearwater/clearwater-config-manager/scripts/upload_bgcf_json: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (C) Metaswitch Networks 2017 4 | # If license terms are provided to you in a COPYING file in the root directory 5 | # of the source code repository by which you are accessing this code, then 6 | # the license outlined in that COPYING file applies to your use. 7 | # Otherwise no rights are granted except for those provided to you by 8 | # Metaswitch Networks in a separate written agreement. 9 | 10 | FILENAME=bgcf.json 11 | KEY=bgcf_json 12 | SCHEMA=/usr/share/clearwater/clearwater-config-manager/scripts/config_validation/bgcf_schema.json 13 | 14 | . /usr/share/clearwater/utils/check-root-permissions 1 15 | 16 | # Pass optional argument directly to upload_json, which checks for --allow-large 17 | # option that allows file upload larger than advisable 18 | /usr/share/clearwater/clearwater-config-manager/scripts/upload_generic_json $FILENAME $KEY $SCHEMA $@ 19 | 20 | rc=$? 21 | if [[ $rc == 0 ]]; then 22 | echo "Successfully uploaded the new BGCF configuration" 23 | fi 24 | 25 | exit $rc 26 | -------------------------------------------------------------------------------- /include/common_sip_processing.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file common_sip_processing.h 3 | * 4 | * Processing that needs to be done 5 | * early on every SIP message. 6 | * 7 | * Copyright (C) Metaswitch Networks 2016 8 | * If license terms are provided to you in a COPYING file in the root directory 9 | * of the source code repository by which you are accessing this code, then 10 | * the license outlined in that COPYING file applies to your use. 11 | * Otherwise no rights are granted except for those provided to you by 12 | * Metaswitch Networks in a separate written agreement. 13 | */ 14 | 15 | 16 | #ifndef COMMON_SIP_PROCESSING_H 17 | #define COMMON_SIP_PROCESSING_H 18 | 19 | extern "C" { 20 | #include 21 | } 22 | 23 | #include "load_monitor.h" 24 | #include "snmp_counter_table.h" 25 | #include "snmp_counter_by_scope_table.h" 26 | #include "health_checker.h" 27 | 28 | pj_status_t 29 | init_common_sip_processing(SNMP::CounterByScopeTable* requests_counter_arg, 30 | HealthChecker* health_checker_arg); 31 | 32 | void unregister_common_processing_module(void); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/clearwater-config-manager/scripts/config_validation/rph_schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "definitions": { 3 | "Namespace.Priority-Value": { 4 | "type": "string", 5 | "pattern": ".+\\..+" 6 | } 7 | }, 8 | 9 | "properties": { 10 | "priority_blocks": { 11 | "type": "array", 12 | "items": { 13 | "type": "object", 14 | "properties": { 15 | "priority": { 16 | "type": "integer", 17 | "minimum": 1, 18 | "maximum": 15 19 | }, 20 | "rph_values": { 21 | "type": "array", 22 | "items": { 23 | "$ref": "#/definitions/Namespace.Priority-Value" 24 | }, 25 | "additionalItems": false 26 | } 27 | }, 28 | "required": ["priority"], 29 | "additionalProperties": false 30 | }, 31 | "additionalItems": false, 32 | "maxItems": 15, 33 | "uniqueItems": true 34 | } 35 | }, 36 | "maxProperties": 1, 37 | "required": ["priority_blocks"], 38 | "additionalProperties": false 39 | } 40 | -------------------------------------------------------------------------------- /include/vped_sprout_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file vped_sprout_types.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2013 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | // Typedefs for events & markers for VPED that we use in sprout 13 | 14 | // Dummy event, used purely to have something show up in SAS. Expect to remove this 15 | typedef struct dummy_event 16 | { 17 | VPED_EVENT_HDR hdr; 18 | VPED_VAR_LEN_DATA ip_addr; 19 | 20 | } DUMMY_EVENT; 21 | 22 | // Struct for marker without any attached data. Used for start/end timestamp markers 23 | typedef struct no_data_marker 24 | { 25 | VPED_EVENT_HDR hdr; 26 | } NO_DATA_MARKER; 27 | 28 | // Struct used for calling/called DN markers 29 | typedef struct dn_marker 30 | { 31 | VPED_EVENT_HDR hdr; 32 | VPED_VAR_LEN_DATA dn; 33 | } CALLING_DN_MARKER; 34 | -------------------------------------------------------------------------------- /include/servercaps.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file servercaps.h Server Capabilities as returned by HSS. 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef __SERVERCAPS_H__ 13 | #define __SERVERCAPS_H__ 14 | 15 | #include 16 | #include 17 | 18 | /// Structure storing server capabilities as returned by the HSS 19 | struct ServerCapabilities 20 | { 21 | /// The S-CSCF returned by the HSS. 22 | std::string scscf; 23 | 24 | /// The list of mandatory capabilities returned by the HSS. 25 | std::vector mandatory_caps; 26 | 27 | /// The list of optional capabilities returned by the HSS. 28 | std::vector optional_caps; 29 | 30 | /// The wildcarded identity returned by the HSS. 31 | std::string wildcard; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/mangelwurzel/mangelwurzelsasevent.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mangelwurzelsasevent.h Mangelwurzel-specific SAS event IDs 3 | * 4 | * Copyright (C) Metaswitch Networks 2014 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MANGELWURZELSASEVENT_H__ 13 | #define MANGELWURZELSASEVENT_H__ 14 | 15 | #include "sasevent.h" 16 | 17 | namespace SASEvent 18 | { 19 | //---------------------------------------------------------------------------- 20 | // Mangelwurzel events. 21 | //---------------------------------------------------------------------------- 22 | const int INVALID_MANGALGORITHM = MANGELWURZEL_BASE + 0x000000; 23 | const int MANGELWURZEL_INITIAL_REQ = MANGELWURZEL_BASE + 0x000001; 24 | const int MANGELWURZEL_IN_DIALOG_REQ = MANGELWURZEL_BASE + 0x000002; 25 | } //namespace SASEvent 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/bin/poll_sprout_http.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file poll_sprout_http.sh 4 | # 5 | # Copyright (C) Metaswitch Networks 2016 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | scscf=5054 13 | . /etc/clearwater/config 14 | rc=0 15 | 16 | # If we have S-CSCF configured, check it. 17 | if [ "$scscf" != "0" ] ; then 18 | http_ip=$(/usr/share/clearwater/bin/bracket-ipv6-address $local_ip) 19 | /usr/share/clearwater/bin/poll-http $http_ip:9888 20 | rc=$? 21 | fi 22 | 23 | # If the sprout process is not stable, we ignore a non-zero return code and 24 | # return zero. 25 | if [ $rc != 0 ]; then 26 | /usr/share/clearwater/infrastructure/monit_stability/sprout-stability check 27 | if [ $? != 0 ]; then 28 | echo "return code $rc ignored" >&2 29 | rc=0 30 | fi 31 | fi 32 | 33 | exit $rc 34 | -------------------------------------------------------------------------------- /src/ut/test_fifc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | 6 | 0 7 | 8 | 0 9 | 0 10 | INVITE 11 | 12 | 13 | 14 | 15 | example.com 16 | 0 17 | 18 | 19 | 20 | 2 21 | 22 | 0 23 | 24 | 0 25 | 0 26 | INVITE 27 | 28 | 29 | 30 | 31 | example_two.com 32 | 0 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/ut/test_fifc_changed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | 6 | 0 7 | 8 | 0 9 | 0 10 | INVITE 11 | 12 | 13 | 14 | 15 | example_two.com 16 | 0 17 | 18 | 19 | 20 | 2 21 | 22 | 0 23 | 24 | 0 25 | 0 26 | INVITE 27 | 28 | 29 | 30 | 31 | example_one.com 32 | 0 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/ut/test_fifc_one_invalid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | one 5 | 6 | 0 7 | 8 | 0 9 | 0 10 | INVITE 11 | 12 | 13 | 14 | 15 | example.com 16 | 0 17 | 18 | 19 | 20 | 2 21 | 22 | 0 23 | 24 | 0 25 | 0 26 | INVITE 27 | 28 | 29 | 30 | 31 | example_two.com 32 | 0 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/ut/mock_notify_sender.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_notify_sender.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2018 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MOCK_NOTIFY_SENDER_H_ 13 | #define MOCK_NOTIFY_SENDER_H_ 14 | 15 | #include "gmock/gmock.h" 16 | #include "notify_sender.h" 17 | 18 | class MockNotifySender : public NotifySender 19 | { 20 | public: 21 | MockNotifySender(); 22 | virtual ~MockNotifySender(); 23 | 24 | MOCK_METHOD6(send_notifys, void(const std::string& aor_id, 25 | const AoR& orig_aor, 26 | const AoR& updated_aor, 27 | SubscriberDataUtils::EventTrigger event_trigger, 28 | int now, 29 | SAS::TrailId trail)); 30 | 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/ut/mock_sifc_parser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_sifc_parser.h 3 | * Mocks out parsing shared iFC set id into list of iFCs. 4 | * 5 | * Copyright (C) Metaswitch Networks 6 | * If license terms are provided to you in a COPYING file in the root directory 7 | * of the source code repository by which you are accessing this code, then 8 | * the license outlined in that COPYING file applies to your use. 9 | * Otherwise no rights are granted except for those provided to you by 10 | * Metaswitch Networks in a separate written agreement. 11 | */ 12 | 13 | #ifndef MOCK_SIFC_PARSER_H__ 14 | #define MOCK_SIFC_PARSER_H__ 15 | 16 | #include 17 | 18 | #include "gmock/gmock.h" 19 | #include "sifcservice.h" 20 | 21 | class MockSIFCService : public SIFCService 22 | { 23 | public: 24 | MockSIFCService(); 25 | virtual ~MockSIFCService(); 26 | 27 | MOCK_CONST_METHOD4(get_ifcs_from_id, void(std::multimap&, 28 | const std::set&, 29 | std::shared_ptr > ifc_doc, 30 | SAS::TrailId)); 31 | 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/ut/test_bgcf.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes" : [ 3 | { "name" : "Alameda PBX", 4 | "domain" : "198.147.226.2", 5 | "route" : ["ec2-54-243-253-10.compute-1.amazonaws.com"] 6 | }, 7 | { "name" : "Oakland PBX", 8 | "domain" : "foreign-domain.example.com", 9 | "route" : ["sip.example.com"] 10 | }, 11 | { "name" : "San Leandro PBX", 12 | "domain" : "198.147.226.99", 13 | "route" : ["fd3.amazonaws.com"] 14 | }, 15 | { "name" : "Multiple nodes", 16 | "domain" : "multiple-nodes.example.com", 17 | "route" : ["sip2.example.com","sip3.example.com"] 18 | }, 19 | { "name" : "Routing number", 20 | "number" : "+123-123", 21 | "route" : ["sip.example.com"] 22 | }, 23 | { "name" : "Routing number (check prefix matching)", 24 | "number" : "+123-124", 25 | "route" : ["sip2.example.com"] 26 | }, 27 | { "name" : "Routing number (no separators)", 28 | "number" : "+654321", 29 | "route" : ["sip3.example.com"] 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /src/ut/test_stateful_proxy_bgcf.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes" : [ 3 | { "name" : "Valid SIP URI with port and transport", 4 | "domain" : "domainvalid", 5 | "route" : ["sip:10.0.0.1:5060;transport=TCP"] 6 | }, 7 | { "name" : "Valid SIP URI with <>", 8 | "domain" : "domainanglebracket", 9 | "route" : [""] 10 | }, 11 | { "name" : "Route includes an invalid SIP URI", 12 | "domain" : "domainnotasipuri", 13 | "route" : ["sip:10.0.0.1:5060","10.0.0.1:5060"] 14 | }, 15 | { "name" : "Route includes an invalid SIP URI in angle brackets", 16 | "domain" : "domainnotasipurianglebracket", 17 | "route" : ["<10.0.0.1:5060>"] 18 | }, 19 | { "name" : "Route includes an invalid SIP URI angle bracket mix", 20 | "domain" : "domainnotasipurianglebracketmix", 21 | "route" : ["<10.0.0.1:5060>;lr"] 22 | }, 23 | { "name" : "Routing number", 24 | "number" : "+1", 25 | "route" : [""] 26 | } 27 | 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /src/ut/acr_scscfsubscribe.json: -------------------------------------------------------------------------------- 1 | { 2 | "peers":{}, 3 | "event":{ 4 | "Accounting-Record-Type":1, 5 | "Event-Timestamp":1, 6 | "Service-Information":{ 7 | "IMS-Information":{ 8 | "Event-Type":{ 9 | "SIP-Method":"SUBSCRIBE", 10 | "Event":"telephone-event;duration=300Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO", 11 | "Expires":300 12 | }, 13 | "Role-Of-Node":0, 14 | "Node-Functionality":0, 15 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 16 | "Requested-Party-Address":"sip:homedomain", 17 | "Time-Stamps":{ 18 | "SIP-Request-Timestamp":1, 19 | "SIP-Request-Timestamp-Fraction":0, 20 | "SIP-Response-Timestamp":1, 21 | "SIP-Response-Timestamp-Fraction":5 22 | }, 23 | "IMS-Charging-Identifier":"", 24 | "Cause-Code":-1, 25 | "From-Address":"\"6505550000\" ", 26 | "Route-Header-Received":"", 27 | "Instance-Id":"" 28 | } 29 | } 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/ut/test_scscf.json: -------------------------------------------------------------------------------- 1 | { 2 | "s-cscfs" : [ 3 | { "server" : "cw-scscf1.cw-ngv.com", 4 | "priority" : 0, 5 | "weight" : 100, 6 | "capabilities" : [123, 432, 345] 7 | }, 8 | { "server" : "cw-scscf2.cw-ngv.com", 9 | "priority" : 0, 10 | "weight" : 100, 11 | "capabilities" : [123, 432, 654] 12 | }, 13 | { "server" : "cw-scscf3.cw-ngv.com", 14 | "priority" : 1, 15 | "weight" : 100, 16 | "capabilities" : [654, 567, 789] 17 | }, 18 | { "server" : "cw-scscf4.cw-ngv.com", 19 | "priority" : 0, 20 | "weight" : 100, 21 | "capabilities" : [654, 567] 22 | }, 23 | { "server" : "cw-scscf5.cw-ngv.com", 24 | "priority" : 1, 25 | "weight" : 0, 26 | "capabilities" : [654, 567, 876] 27 | }, 28 | { "server" : "cw-scscf6.cw-ngv.com", 29 | "priority" : 1, 30 | "weight" : 10, 31 | "capabilities" : [654, 567, 876] 32 | }, 33 | { "server" : "cw-scscf6.cw-ngv.com", 34 | "priority" : 1, 35 | "weight" : 100, 36 | "capabilities" : [654, 567, 876] 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /src/ut/test_scscf_missing_parts.json: -------------------------------------------------------------------------------- 1 | { 2 | "s-cscfs" : [ 3 | { "server" : "cw-scscf1.cw-ngv.com", 4 | "priority" : 10, 5 | "weight" : 100, 6 | "capabilities" : [123, 432] 7 | }, 8 | { "server" : "cw-scscf2.cw-ngv.com", 9 | "weight" : 100, 10 | "capabilities" : [123, 432] 11 | }, 12 | { "server" : "cw-scscf3.cw-ngv.com", 13 | "priority" : 0, 14 | "capabilities" : [123, 432] 15 | }, 16 | { "server" : "cw-scscf4.cw-ngv.com", 17 | "priority" : 0, 18 | "weight" : 100 19 | }, 20 | { "priority" : 0, 21 | "weight" : 100, 22 | "capabilities" : [123, 432] 23 | }, 24 | { "server" : "cw-scscf5.cw-ngv.com", 25 | "priority" : "0", 26 | "weight" : 100, 27 | "capabilities" : [123, 432] 28 | }, 29 | { "server" : "cw-scscf6.cw-ngv.com", 30 | "priority" : 0, 31 | "weight" : 100, 32 | "capabilities" : 123 33 | }, 34 | { "server" : "cw-scscf7.cw-ngv.com", 35 | "priority" : 0, 36 | "weight" : [100], 37 | "capabilities" : [123, 432] 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /include/sm_sip_mapping.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sm_sip_mapping.h Map SM responses to SIP responses 3 | * 4 | * Copyright (C) Metaswitch Networks 2016 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef SM_SIP_MAPPING_H__ 13 | #define SM_SIP_MAPPING_H__ 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | #include "httpconnection.h" 20 | 21 | /// Work out what SIP response code to use following an SM operation. 22 | /// 23 | /// @param http_code[in] - The HTTP response code from SM. 24 | /// @param reg_state[in] - The state of the subscriber's registration in the 25 | /// HSS. 26 | /// @param sip_msg_type[in] - The SIP Method being processed. 27 | /// 28 | /// @return - The chosen SIP status code. 29 | pjsip_status_code determine_sm_sip_response(HTTPCode http_code, 30 | std::string& reg_state, 31 | const char* sip_msg_type); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/ut/test_sifc_missing_set_id.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 0 7 | 8 | 0 9 | 0 10 | INVITE 11 | 12 | 13 | 14 | 15 | invite.example.com 16 | 0 17 | 18 | 19 | 20 | 21 | 22 | 2 23 | 24 | 25 | 26 | 0 27 | 28 | 0 29 | 0 30 | REGISTER 31 | 32 | 33 | 34 | 35 | register.example.com 36 | 0 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/ut/mock_hss_connection.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_hss_connection.h Mock HSS connection class 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MOCK_HSS_CONNECTION_H_ 13 | #define MOCK_HSS_CONNECTION_H_ 14 | 15 | #include "gmock/gmock.h" 16 | 17 | #include "hssconnection.h" 18 | #include "fakesnmp.hpp" 19 | 20 | class MockHSSConnection : public HSSConnection 21 | { 22 | public: 23 | MockHSSConnection(); 24 | virtual ~MockHSSConnection(); 25 | 26 | MOCK_METHOD3(update_registration_state, 27 | HTTPCode(const HSSConnection::irs_query& irs_query, 28 | HSSConnection::irs_info& irs_info, 29 | SAS::TrailId trail)); 30 | 31 | MOCK_METHOD3(get_registration_data, 32 | HTTPCode(const std::string& public_id, 33 | HSSConnection::irs_info& irs_info, 34 | SAS::TrailId trail)); 35 | 36 | }; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /debian/gemini-as.prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file gemini-as.prerm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `remove' 19 | # * `upgrade' 20 | # * `failed-upgrade' 21 | # * `remove' `in-favour' 22 | # * `deconfigure' `in-favour' 23 | # `removing' 24 | # 25 | # for details, see http://www.debian.org/doc/debian-policy/ or 26 | # the debian-policy package 27 | 28 | case "$1" in 29 | remove|upgrade|deconfigure) 30 | ;; 31 | 32 | failed-upgrade) 33 | ;; 34 | 35 | *) 36 | echo "prerm called with unknown argument \`$1'" >&2 37 | exit 1 38 | ;; 39 | esac 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /src/ut/test_bgcf_sproutlet_bgcf.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes" : [ 3 | { "name" : "Valid SIP URI with port and transport", 4 | "domain" : "domainvalid", 5 | "route" : ["sip:10.0.0.1:5060;transport=TCP"] 6 | }, 7 | { "name" : "Valid SIP URI with <>", 8 | "domain" : "domainanglebracket", 9 | "route" : [""] 10 | }, 11 | { "name" : "Route includes an invalid SIP URI", 12 | "domain" : "domainnotasipuri", 13 | "route" : ["sip:10.0.0.1:5060","10.0.0.1:5060"] 14 | }, 15 | { "name" : "Route includes an invalid SIP URI in angle brackets", 16 | "domain" : "domainnotasipurianglebracket", 17 | "route" : ["<10.0.0.1:5060>"] 18 | }, 19 | { "name" : "Route includes an invalid SIP URI angle bracket mix", 20 | "domain" : "domainnotasipurianglebracketmix", 21 | "route" : ["<10.0.0.1:5060>;lr"] 22 | }, 23 | { "name" : "Routing number", 24 | "number" : "+1", 25 | "route" : [""] 26 | }, 27 | { "name" : "Wildcard", 28 | "domain" : "*", 29 | "route" : [""] 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /debian/sprout-bgcf.prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-bgcf.prerm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `remove' 19 | # * `upgrade' 20 | # * `failed-upgrade' 21 | # * `remove' `in-favour' 22 | # * `deconfigure' `in-favour' 23 | # `removing' 24 | # 25 | # for details, see http://www.debian.org/doc/debian-policy/ or 26 | # the debian-policy package 27 | 28 | case "$1" in 29 | remove|upgrade|deconfigure) 30 | ;; 31 | 32 | failed-upgrade) 33 | ;; 34 | 35 | *) 36 | echo "prerm called with unknown argument \`$1'" >&2 37 | exit 1 38 | ;; 39 | esac 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /debian/sprout-icscf.prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-icscf.prerm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `remove' 19 | # * `upgrade' 20 | # * `failed-upgrade' 21 | # * `remove' `in-favour' 22 | # * `deconfigure' `in-favour' 23 | # `removing' 24 | # 25 | # for details, see http://www.debian.org/doc/debian-policy/ or 26 | # the debian-policy package 27 | 28 | case "$1" in 29 | remove|upgrade|deconfigure) 30 | ;; 31 | 32 | failed-upgrade) 33 | ;; 34 | 35 | *) 36 | echo "prerm called with unknown argument \`$1'" >&2 37 | exit 1 38 | ;; 39 | esac 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /debian/sprout-scscf.prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-scscf.prerm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `remove' 19 | # * `upgrade' 20 | # * `failed-upgrade' 21 | # * `remove' `in-favour' 22 | # * `deconfigure' `in-favour' 23 | # `removing' 24 | # 25 | # for details, see http://www.debian.org/doc/debian-policy/ or 26 | # the debian-policy package 27 | 28 | case "$1" in 29 | remove|upgrade|deconfigure) 30 | ;; 31 | 32 | failed-upgrade) 33 | ;; 34 | 35 | *) 36 | echo "prerm called with unknown argument \`$1'" >&2 37 | exit 1 38 | ;; 39 | esac 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /debian/mangelwurzel-as.prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file mangelwurzel-as.prerm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `remove' 19 | # * `upgrade' 20 | # * `failed-upgrade' 21 | # * `remove' `in-favour' 22 | # * `deconfigure' `in-favour' 23 | # `removing' 24 | # 25 | # for details, see http://www.debian.org/doc/debian-policy/ or 26 | # the debian-policy package 27 | 28 | case "$1" in 29 | remove|upgrade|deconfigure) 30 | ;; 31 | 32 | failed-upgrade) 33 | ;; 34 | 35 | *) 36 | echo "prerm called with unknown argument \`$1'" >&2 37 | exit 1 38 | ;; 39 | esac 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /debian/sprout-mmtel-as.prerm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-mmtel-as.prerm 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `remove' 19 | # * `upgrade' 20 | # * `failed-upgrade' 21 | # * `remove' `in-favour' 22 | # * `deconfigure' `in-favour' 23 | # `removing' 24 | # 25 | # for details, see http://www.debian.org/doc/debian-policy/ or 26 | # the debian-policy package 27 | 28 | case "$1" in 29 | remove|upgrade|deconfigure) 30 | ;; 31 | 32 | failed-upgrade) 33 | ;; 34 | 35 | *) 36 | echo "prerm called with unknown argument \`$1'" >&2 37 | exit 1 38 | ;; 39 | esac 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /include/scscf_utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file scscf_utils.h Helper functions for S-CSCF sproutlets. 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef SCSCFUTILS_H__ 13 | #define SCSCFUTILS_H__ 14 | 15 | #include 16 | #include 17 | 18 | namespace SCSCFUtils { 19 | 20 | /// Creates an S-CSCF URI for the request provided. 21 | /// 22 | /// @param pool - The pool to allocate the S-CSCF URI in. 23 | /// @param received_local_hostname 24 | /// - The local hostname part of the received request. 25 | /// @param scscf_local_hostname 26 | /// - The local hostname part of the configured S-CSCF URI. 27 | /// @param scscf_uri - Return parameter containing the S-CSCF URI. 28 | void get_scscf_uri(pj_pool_t* pool, 29 | std::string received_local_hostname, 30 | std::string scscf_local_hostname, 31 | pjsip_sip_uri* scscf_uri); 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /sprout-bgcf.root/usr/share/clearwater/clearwater-config-manager/scripts/config_validation/bgcf_schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "All BGCF routes", 3 | "type": "object", 4 | "properties": { 5 | "routes": { 6 | "type": "array", 7 | "items": { 8 | "title": "Each BGCF route", 9 | "type": "object", 10 | "properties": { 11 | "name": { 12 | "type": "string" 13 | }, 14 | "domain": { 15 | "type": "string", 16 | "description": "SIP trunk IP address or domain name", 17 | "maxLength": 253 18 | }, 19 | "number": { 20 | "type": "string", 21 | "description": "Telephone number", 22 | "pattern": "^\\+{0,1}[0-9]*$" 23 | }, 24 | "route": { 25 | "type": "array", 26 | "items": { 27 | "type": "string", 28 | "pattern": "^sip:", 29 | "minItems": 1 30 | } 31 | } 32 | }, 33 | "required": [ 34 | "name", 35 | "route" 36 | ], 37 | "oneOf": [ 38 | { "required": [ "domain" ] }, 39 | { "required": [ "number" ] } 40 | ], 41 | "additionalProperties": false 42 | } 43 | } 44 | }, 45 | "additionalProperties": false 46 | } 47 | -------------------------------------------------------------------------------- /src/ut/test_rph.json: -------------------------------------------------------------------------------- 1 | { 2 | "priority_blocks" : [ 3 | { "priority" : 1, 4 | "rph_values" : ["WPS.4", "eTs.4"] 5 | }, 6 | { 7 | "priority" : 2, 8 | "rph_values" : [] 9 | }, 10 | { 11 | "priority" : 3, 12 | "rph_values" : ["wPS.3", "ETs.3"] 13 | }, 14 | { 15 | "priority" : 4, 16 | "rph_values" : ["foo"] 17 | }, 18 | { 19 | "priority" : 5, 20 | "rph_values" : ["wps.2", "ETS.2"] 21 | }, 22 | { 23 | "priority" : 6, 24 | "rph_values" : [] 25 | }, 26 | { 27 | "priority" : 7, 28 | "rph_values" : ["Wps.1", "ets.1"] 29 | }, 30 | { 31 | "priority" : 8, 32 | "rph_values" : [] 33 | }, 34 | { 35 | "priority" : 9, 36 | "rph_values" : ["WPs.0", "etS.0"] 37 | }, 38 | { 39 | "priority" : 10, 40 | "rph_values" : ["dSn.flAsh-oveRRIDE"] 41 | }, 42 | { 43 | "priority" : 11, 44 | "rph_values" : [] 45 | }, 46 | { 47 | "priority" : 12, 48 | "rph_values" : [] 49 | }, 50 | { 51 | "priority" : 13, 52 | "rph_values" : ["drsn.FLAsh-override"] 53 | }, 54 | { 55 | "priority" : 14, 56 | "rph_values" : [] 57 | }, 58 | { 59 | "priority" : 15, 60 | "rph_values" : ["drsn.flash-OVERRIDE-OVERRIDE"] 61 | } 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /src/ut/test_sifc_invalid_set_id.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NaN 6 | 7 | 8 | 9 | 0 10 | 11 | 0 12 | 0 13 | INVITE 14 | 15 | 16 | 17 | 18 | invite.example.com 19 | 0 20 | 21 | 22 | 23 | 24 | 25 | 2 26 | 27 | 28 | 29 | 0 30 | 31 | 0 32 | 0 33 | REGISTER 34 | 35 | 36 | 37 | 38 | register.example.com 39 | 0 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/clearwater-config-manager/scripts/config_validation/scscf_schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "All S-CSCF servers", 3 | "type": "object", 4 | "properties": { 5 | "s-cscfs": { 6 | "type": "array", 7 | "items": { 8 | "title": "Each S-CSCF server", 9 | "type": "object", 10 | "properties": { 11 | "server": { 12 | "type": "string", 13 | "format": "uri", 14 | "pattern": "^sip:" 15 | }, 16 | "priority": { 17 | "type": "integer", 18 | "maximum": 100, 19 | "minimum": 0 20 | }, 21 | "weight": { 22 | "type": "integer", 23 | "maximum": 100, 24 | "minimum": 0 25 | }, 26 | "capabilities": { 27 | "description": "Each number represents a capability, as defined by the operator", 28 | "type": "array", 29 | "items": { 30 | "type": "integer", 31 | "maximum": 4294967295, 32 | "minimum": 0 33 | } 34 | } 35 | }, 36 | "required": [ 37 | "server", 38 | "priority", 39 | "weight", 40 | "capabilities" 41 | ], 42 | "additionalProperties": false 43 | } 44 | } 45 | }, 46 | "additionalProperties": false 47 | } 48 | -------------------------------------------------------------------------------- /src/ut/acr_bgcforigcall_start.json: -------------------------------------------------------------------------------- 1 | { 2 | "peers":{ 3 | "ccf":["192.1.1.1","192.1.1.2"], 4 | "ecf":["192.1.1.3","192.1.1.4"] 5 | }, 6 | "event":{ 7 | "Accounting-Record-Type":1, 8 | "Acct-Interim-Interval":600, 9 | "Event-Timestamp":1, 10 | "Service-Information":{ 11 | "IMS-Information":{ 12 | "Event-Type":{ 13 | "SIP-Method":"INVITE" 14 | }, 15 | "Role-Of-Node":0, 16 | "Node-Functionality":5, 17 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 18 | "Calling-Party-Address":[ 19 | "sip:6505550000@homedomain", 20 | "tel:6505550000" 21 | ], 22 | "Time-Stamps":{ 23 | "SIP-Request-Timestamp":1, 24 | "SIP-Request-Timestamp-Fraction":0, 25 | "SIP-Response-Timestamp":1, 26 | "SIP-Response-Timestamp-Fraction":30 27 | }, 28 | "Inter-Operator-Identifier":[{ 29 | "Originating-IOI":"homedomain", 30 | "Terminating-IOI":"homedomain" 31 | }], 32 | "IMS-Charging-Identifier":"1234bc9876e", 33 | "Cause-Code":-1, 34 | "From-Address":"\"6505550000\" ;tag=12345678", 35 | "Route-Header-Received":"", 36 | "Instance-Id":"" 37 | } 38 | } 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/ut/acr_scscfpublish.json: -------------------------------------------------------------------------------- 1 | { 2 | "peers":{ 3 | "ccf":["192.1.1.1","192.1.1.2"], 4 | "ecf":["192.1.1.3","192.1.1.4"] 5 | }, 6 | "event":{ 7 | "Accounting-Record-Type":1, 8 | "Event-Timestamp":1, 9 | "Service-Information":{ 10 | "IMS-Information":{ 11 | "Event-Type":{ 12 | "SIP-Method":"PUBLISH" 13 | }, 14 | "Role-Of-Node":0, 15 | "Node-Functionality":0, 16 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 17 | "Requested-Party-Address":"sip:homedomain", 18 | "Time-Stamps":{ 19 | "SIP-Request-Timestamp":1, 20 | "SIP-Request-Timestamp-Fraction":0, 21 | "SIP-Response-Timestamp":1, 22 | "SIP-Response-Timestamp-Fraction":25 23 | }, 24 | "Inter-Operator-Identifier":[{ 25 | "Originating-IOI":"homedomain" 26 | }], 27 | "IMS-Charging-Identifier":"1234bc9876e", 28 | "Message-Body":[{ 29 | "Content-Type":"text/plain", 30 | "Content-Length":12, 31 | "Content-Disposition":"render", 32 | "Originator":0 33 | }], 34 | "Cause-Code":-1, 35 | "From-Address":"\"6505550000\" ", 36 | "Route-Header-Received":"", 37 | "Instance-Id":"" 38 | } 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /include/uri_classifier.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) Metaswitch Networks 2017 3 | * If license terms are provided to you in a COPYING file in the root directory 4 | * of the source code repository by which you are accessing this code, then 5 | * the license outlined in that COPYING file applies to your use. 6 | * Otherwise no rights are granted except for those provided to you by 7 | * Metaswitch Networks in a separate written agreement. 8 | */ 9 | 10 | #ifndef URI_CLASSIFIER_H 11 | #define URI_CLASSIFIER_H 12 | 13 | #include 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | #include 19 | } 20 | 21 | // Forward declaration of PJUtils functions. 22 | namespace PJUtils { 23 | 24 | std::string pj_str_to_string(const pj_str_t* pjstr); 25 | std::string uri_to_string(pjsip_uri_context_e context, const pjsip_uri* uri); 26 | 27 | } 28 | 29 | enum URIClass 30 | { 31 | UNKNOWN = 0, 32 | LOCAL_PHONE_NUMBER, 33 | GLOBAL_PHONE_NUMBER, 34 | NODE_LOCAL_SIP_URI, 35 | HOME_DOMAIN_SIP_URI, 36 | OFFNET_SIP_URI, 37 | NP_DATA, 38 | FINAL_NP_DATA 39 | }; 40 | 41 | namespace URIClassifier 42 | { 43 | URIClass classify_uri(const pjsip_uri* uri, bool prefer_sip = true, bool check_np = false); 44 | 45 | bool is_user_numeric(pj_str_t user); 46 | 47 | extern bool enforce_user_phone; 48 | extern bool enforce_global; 49 | extern std::vector home_domains; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/ut/sessioncase_test.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sessioncase_test.cpp UT for Sprout SessionCase module 3 | * 4 | * Copyright (C) Metaswitch Networks 2015 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | /// 13 | ///---------------------------------------------------------------------------- 14 | 15 | #include 16 | #include "gtest/gtest.h" 17 | 18 | #include "utils.h" 19 | #include "siptest.hpp" 20 | 21 | #include "sessioncase.h" 22 | 23 | using namespace std; 24 | 25 | /// Fixture 26 | class SessionCaseTest : public SipTest 27 | { 28 | public: 29 | static void SetUpTestCase() 30 | { 31 | SipTest::SetUpTestCase(); 32 | } 33 | 34 | static void TearDownTestCase() 35 | { 36 | SipTest::TearDownTestCase(); 37 | } 38 | 39 | SessionCaseTest() : SipTest(NULL) 40 | { 41 | } 42 | 43 | ~SessionCaseTest() 44 | { 45 | } 46 | }; 47 | 48 | TEST_F(SessionCaseTest, Names) 49 | { 50 | EXPECT_EQ("orig", SessionCase::Originating.to_string()); 51 | EXPECT_EQ("orig-cdiv", SessionCase::OriginatingCdiv.to_string()); 52 | EXPECT_EQ("term", SessionCase::Terminating.to_string()); 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/ut/acr_pcscfregister.json: -------------------------------------------------------------------------------- 1 | { 2 | "peers": { 3 | "ccf": ["192.1.1.1","192.1.1.2"], 4 | "ecf":["192.1.1.3","192.1.1.4"] 5 | }, 6 | "event": { 7 | "Accounting-Record-Type":1, 8 | "User-Name":"Alice", 9 | "Event-Timestamp":1, 10 | "Service-Information": { 11 | "Subscription-Id":[{ 12 | "Subscription-Id-Type":2, 13 | "Subscription-Id-Data":"sip:6505550000@homedomain" 14 | }], 15 | "IMS-Information": { 16 | "Event-Type": { 17 | "SIP-Method":"REGISTER" 18 | }, 19 | "Role-Of-Node":0, 20 | "Node-Functionality":1, 21 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 22 | "Called-Party-Address":"sip:6505550000@homedomain", 23 | "Associated-URI": ["sip:6505550000@homedomain","tel:6505550000"], 24 | "Time-Stamps": { 25 | "SIP-Request-Timestamp":1, 26 | "SIP-Request-Timestamp-Fraction":0, 27 | "SIP-Response-Timestamp":1, 28 | "SIP-Response-Timestamp-Fraction":25 29 | }, 30 | "Inter-Operator-Identifier": [{ 31 | "Originating-IOI":"homedomain" 32 | }], 33 | "Transit-IOI-List":["transitdomain"], 34 | "IMS-Charging-Identifier":"1234bc9876e", 35 | "Cause-Code":0, 36 | "From-Address":"\"6505550000\" ", 37 | "Route-Header-Received":"" 38 | } 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /clearwater-sip-perf.root/usr/share/clearwater/bin/sip-perf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # sip-perf 3 | # Runs SIP performance tests against a bono node. 4 | 5 | # Increase our connection limit. 6 | ulimit -Hn 100000 7 | ulimit -Sn 100000 8 | 9 | # Read in config. 10 | . /etc/clearwater/config 11 | 12 | stress_target=$home_domain:5060 13 | 14 | if [ -n "$1" ] 15 | then 16 | stress_target=$1 17 | fi 18 | 19 | # Calculate the number of users. 20 | num_users=$(($(wc -l < /usr/share/clearwater/sip-perf/users.csv) - 1)) 21 | 22 | # Copy the script file, then move it - moves within a partition are atomic. 23 | cp /usr/share/clearwater/sip-perf/sip-perf.xml /var/log/clearwater-sipp/sip-perf.xml.1 24 | mv /var/log/clearwater-sipp/sip-perf.xml.1 /var/log/clearwater-sipp/sip-perf.xml 25 | 26 | # sipp wants a terminal. Give it a dumb one (we're going to send it to file anyway). 27 | export TERM=dumb 28 | 29 | # Actually run sipp. 30 | logger -p daemon.error -t sip-perf Starting SIP performance test 31 | nice -n-20 /usr/share/clearwater/bin/sipp -i $local_ip -sf /var/log/clearwater-sipp/sip-perf.xml $stress_target -t tn -s $home_domain -inf /usr/share/clearwater/sip-perf/users.csv -users $num_users -m $num_users -default_behaviors all,-bye -max_socket 65000 -trace_stat -trace_rtt -trace_counts -trace_err -max_reconnect -1 -reconnect_sleep 0 -reconnect_close 0 -send_timeout 4000 -recv_timeout 12000 -nostdin >> /var/log/clearwater-sipp/sip-perf.out 2>&1 32 | logger -p daemon.error -t sip-perf Completed SIP performance test 33 | -------------------------------------------------------------------------------- /include/aor_utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file aor_utils.h Utility functions that sprout can call on an AoR. These are 3 | * not defined on the AoR itself, as they require access to PJSIP which is only 4 | * present in sprout. 5 | * 6 | * Copyright (C) Metaswitch Networks 2018 7 | * If license terms are provided to you in a COPYING file in the root directory 8 | * of the source code repository by which you are accessing this code, then 9 | * the license outlined in that COPYING file applies to your use. 10 | * Otherwise no rights are granted except for those provided to you by 11 | * Metaswitch Networks in a separate written agreement. 12 | */ 13 | 14 | #ifndef AOR_UTILS_H__ 15 | #define AOR_UTILS_H__ 16 | 17 | extern "C" { 18 | #include 19 | #include 20 | #include 21 | } 22 | 23 | #include "aor.h" 24 | 25 | namespace AoRUtils { 26 | 27 | // Generates the public GRUU for this binding from the address of record and 28 | // instance-id. Returns NULL if this binding has no valid GRUU. 29 | pjsip_sip_uri* pub_gruu(const Binding* binding, pj_pool_t* pool); 30 | 31 | // Utility method to return the public GRUU as a string. Returns "" if this 32 | // binding has no GRUU. 33 | std::string pub_gruu_str(const Binding* binding, pj_pool_t* pool); 34 | 35 | // Utility method to return the public GRUU surrounded by quotes. Returns "" if 36 | // this binding has no GRUU. 37 | std::string pub_gruu_quoted_string(const Binding* binding, pj_pool_t* pool); 38 | 39 | }; 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /include/xdmconnection.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file xdmconnection.h External interface file for the XDMS client class 3 | * 4 | * Copyright (C) Metaswitch Networks 2015 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef XDMCONNECTION_H__ 13 | #define XDMCONNECTION_H__ 14 | 15 | #include 16 | #include 17 | #include "httpconnection.h" 18 | #include "sas.h" 19 | #include "load_monitor.h" 20 | #include "snmp_ip_count_table.h" 21 | #include "snmp_event_accumulator_table.h" 22 | 23 | class XDMConnection 24 | { 25 | public: 26 | XDMConnection(const std::string& server, 27 | HttpResolver* resolver, 28 | LoadMonitor *load_monitor, 29 | SNMP::IPCountTable* xdm_cxn_count, 30 | SNMP::EventAccumulatorTable* xdm_latency); 31 | XDMConnection(HttpConnection* http, SNMP::EventAccumulatorTable* xdm_latency); 32 | virtual ~XDMConnection(); 33 | 34 | virtual bool get_simservs(const std::string& user, std::string& xml_data, const std::string& password, SAS::TrailId trail); 35 | 36 | private: 37 | HttpClient* _client; 38 | HttpConnection* _http; 39 | SNMP::EventAccumulatorTable* _latency_tbl; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/compositesproutlet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file compositesproutlet.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef COMPOSITESPROUTLET_H__ 13 | #define COMPOSITESPROUTLET_H__ 14 | 15 | #include "sproutlet.h" 16 | 17 | /// 18 | /// A Sproutlet TSX that is part of a more complicated Network Function. When 19 | /// it sends outbound standalone or dialog-creating requests, they are routed 20 | /// to the next Sproutlet in the Network Function. In-dialog requests are 21 | /// routed using standard SIP routing (Record-Route headers). 22 | /// 23 | 24 | class CompositeSproutletTsx : public SproutletTsx 25 | { 26 | public: 27 | CompositeSproutletTsx(Sproutlet* sproutlet, 28 | const std::string& next_hop_service); 29 | virtual ~CompositeSproutletTsx() {} 30 | 31 | void on_rx_initial_request(pjsip_msg* req) override { send_request(req); } 32 | void on_rx_in_dialog_request(pjsip_msg* req) override { send_request(req); } 33 | 34 | protected: 35 | int send_request(pjsip_msg*& req, 36 | int allowed_host_state=BaseResolver::ALL_LISTS) override; 37 | 38 | const std::string _next_hop_service; 39 | }; 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /src/ut/acr_icscfregister_caps.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": { 3 | "Accounting-Record-Type": 1, 4 | "User-Name":"Alice", 5 | "Event-Timestamp": 1, 6 | "Service-Information": { 7 | "IMS-Information": { 8 | "Called-Party-Address" : "sip:6505550000@homedomain", 9 | "Event-Type": { 10 | "Expires" : 300, 11 | "SIP-Method": "REGISTER" 12 | }, 13 | "From-Address": "\"6505550000\" ", 14 | "IMS-Charging-Identifier": "1234bc9876e", 15 | "Instance-Id" : "", 16 | "Inter-Operator-Identifier": [ 17 | { 18 | "Originating-IOI": "homedomain" 19 | } 20 | ], 21 | "Transit-IOI-List":["transitdomain"], 22 | "Node-Functionality": 2, 23 | "Role-Of-Node": 0, 24 | "Route-Header-Received": "", 25 | "Server-Capabilities": { 26 | "Mandatory-Capability": [ 10, 20 ], 27 | "Optional-Capability": [ 30 ], 28 | "Server-Name": [ "sip:scscf1.homedomain" ] 29 | }, 30 | "Time-Stamps": { 31 | "SIP-Request-Timestamp": 1, 32 | "SIP-Request-Timestamp-Fraction": 0 33 | }, 34 | "User-Session-Id": "0123456789abcdef-10.83.18.38" 35 | } 36 | } 37 | }, 38 | "peers": { 39 | "ccf": [ 40 | "192.1.1.1", 41 | "192.1.1.2" 42 | ], 43 | "ecf": [ 44 | "192.1.1.3", 45 | "192.1.1.4" 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /restund.root/usr/share/clearwater/bin/poll_restund.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file poll_restund.sh 4 | # 5 | # Copyright (C) Metaswitch Networks 2015 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # This script uses a STUN message to poll restund and check whether it is 13 | # healthy. 14 | 15 | # Read the config, defaulting appropriately. 16 | . /etc/clearwater/config 17 | 18 | # Send the STUN message. The nc line also includes checking the first line of the response starts 19 | # "\x01\x01" - a positive response. 20 | # The -q option forces netcat to quit after 1 second. This works 21 | # around a netcat bug where it tight-loops forever if the UDP port 22 | # it's trying to contact is closed. 23 | printf '\x00\x01\x00\x00\x21\x12\xa4\x42MonitPollXid' | 24 | nc -v -C -u -w 2 -q 1 $local_ip 3478 2> /tmp/poll_restund.sh.nc.stderr.$$ | tee /tmp/poll_restund.sh.nc.stdout.$$ | head -1 | grep -U -P -q '^\x01\x01' 25 | rc=$? 26 | 27 | # Check the return code and log if appropriate 28 | if [ $rc != 0 ] ; then 29 | echo STUN poll failed to $local_ip >&2 30 | cat /tmp/poll_restund.sh.nc.stderr.$$ >&2 31 | cat /tmp/poll_restund.sh.nc.stdout.$$ >&2 32 | fi 33 | rm -f /tmp/poll_restund.sh.nc.stderr.$$ /tmp/poll_restund.sh.nc.stdout.$$ 34 | 35 | exit $rc 36 | -------------------------------------------------------------------------------- /src/ut/acr_ibcftermcall_start.json: -------------------------------------------------------------------------------- 1 | { 2 | "peers":{ 3 | "ccf":["192.1.1.1","192.1.1.2"], 4 | "ecf":["192.1.1.3","192.1.1.4"] 5 | }, 6 | "event":{ 7 | "Accounting-Record-Type":1, 8 | "Acct-Interim-Interval":600, 9 | "Event-Timestamp":1, 10 | "Service-Information":{ 11 | "Subscription-Id":[{ 12 | "Subscription-Id-Type":2, 13 | "Subscription-Id-Data":"sip:6505550000@homedomain" 14 | }, 15 | { 16 | "Subscription-Id-Type":0, 17 | "Subscription-Id-Data":"6505550000" 18 | }], 19 | "IMS-Information":{ 20 | "Event-Type":{ 21 | "SIP-Method":"INVITE" 22 | }, 23 | "Role-Of-Node":0, 24 | "Node-Functionality":7, 25 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 26 | "Calling-Party-Address":["sip:6505550000@homedomain","tel:6505550000"], 27 | "Time-Stamps":{ 28 | "SIP-Request-Timestamp":1, 29 | "SIP-Request-Timestamp-Fraction":0, 30 | "SIP-Response-Timestamp":1, 31 | "SIP-Response-Timestamp-Fraction":30 32 | }, 33 | "Inter-Operator-Identifier":[{ 34 | "Originating-IOI":"homedomain" 35 | }], 36 | "IMS-Charging-Identifier":"1234bc9876e", 37 | "Cause-Code":-1, 38 | "From-Address":"\"6505550000\" ;tag=12345678", 39 | "Route-Header-Received":"", 40 | "Instance-Id":"" 41 | } 42 | } 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /include/dialog_tracker.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (C) Metaswitch Networks 2013 3 | * If license terms are provided to you in a COPYING file in the root directory 4 | * of the source code repository by which you are accessing this code, then 5 | * the license outlined in that COPYING file applies to your use. 6 | * Otherwise no rights are granted except for those provided to you by 7 | * Metaswitch Networks in a separate written agreement. 8 | */ 9 | extern "C" { 10 | #include 11 | #include 12 | #include 13 | #include 14 | } 15 | #include "flowtable.h" 16 | 17 | class DialogTracker { 18 | FlowTable* _ft; 19 | public: 20 | DialogTracker(FlowTable* ft): _ft(ft) {}; 21 | void on_uas_tsx_complete(const pjsip_tx_data* original_request, 22 | const pjsip_transaction* tsx, 23 | const pjsip_event* event, 24 | bool is_client); 25 | private: 26 | void on_dialog_start(const pjsip_tx_data* original_request, 27 | const pjsip_transaction* tsx, 28 | const pjsip_event* event, 29 | bool is_client); 30 | 31 | void on_dialog_end(const pjsip_tx_data* original_request, 32 | const pjsip_transaction* tsx, 33 | const pjsip_event* event, 34 | bool is_client); 35 | 36 | Flow* get_client_flow(const pjsip_tx_data* original_request, 37 | const pjsip_transaction* tsx, 38 | const pjsip_event* event, 39 | bool is_client); 40 | }; 41 | -------------------------------------------------------------------------------- /clearwater-sip-stress.root/usr/share/clearwater/infrastructure/scripts/sip-stress: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set up defaults, then dot in base configuration. 4 | # - base - base directory number 5 | # - count - number of directory numbers per instance (must be even) 6 | # - node_idx - index of this node (--index parameter to chef) 7 | # - sipp_count - number of sipp instances per node 8 | # - password - SIP password to use for all DNs (insecure but OK for stress) 9 | base=2010000000 10 | count=30000 11 | node_idx=1 12 | sipp_count=1 13 | password=7kkzTyGW 14 | . /etc/clearwater/config 15 | 16 | # Clear out old configuration files. 17 | rm -f /usr/share/clearwater/sip-stress/users.csv.* 18 | 19 | # Figure out how many targets we have. Due to TCP port limitations, we can't 20 | # run more than one sipp instance per target. 21 | if [ -f /etc/clearwater/cluster_settings ] ; then 22 | . /etc/clearwater/cluster_settings 23 | num_targets=$(echo $bono_servers | sed -e 's/,/\n/g' | wc -l) 24 | if [ $num_targets -lt $sipp_count ] ; then 25 | sipp_count=$num_targets 26 | fi 27 | else 28 | sipp_count=1 29 | fi 30 | 31 | # Create configuration files for each sipp instance. 32 | for index in $(seq $(((node_idx - 1) * sipp_count + 1)) $((node_idx * sipp_count))) ; do 33 | { echo USER 34 | for dn in $(eval echo {$((base + (count * (index - 1))))..$((base + (count * index)- 1))..2}) 35 | do 36 | echo "$dn;[authentication username=$dn@$home_domain password=$password];$((dn + 1));[authentication username=$((dn + 1))@$home_domain password=$password]" 37 | done 38 | } > /usr/share/clearwater/sip-stress/users.csv.$index 39 | done 40 | -------------------------------------------------------------------------------- /src/ut/test_registrar_fifc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1 5 | 6 | 0 7 | 8 | 0 9 | 0 10 | REGISTER 11 | 12 | 13 | 14 | 0 15 | 0 16 | 17 |
To
18 | .*6505551000.* 19 |
20 |
21 |
22 | 23 | sip:9.8.7.6:54321;transport=TCP 24 | 1 25 | 26 |
27 | 28 | 1 29 | 30 | 0 31 | 32 | 0 33 | 0 34 | REGISTER 35 | 36 | 37 | 38 | 0 39 | 0 40 | 41 |
To
42 | .*6505551234.* 43 |
44 |
45 |
46 | 47 | dummy-as 48 | 0 49 | 50 |
51 |
52 | -------------------------------------------------------------------------------- /include/mmtelsasevent.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mmtelsasevent.h Memento-specific SAS event IDs 3 | * 4 | * Copyright (C) Metaswitch Networks 2014 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MMTELSASEVENT_H__ 13 | #define MMTELSASEVENT_H__ 14 | 15 | #include "sasevent.h" 16 | 17 | namespace SASEvent 18 | { 19 | //---------------------------------------------------------------------------- 20 | // MMTEL events. 21 | //---------------------------------------------------------------------------- 22 | const int RETRIEVING_SIMSERVS = MMTEL_BASE + 0x000000; 23 | const int FAILED_RETRIEVE_SIMSERVS = MMTEL_BASE + 0x000001; 24 | const int ORIGINATING_SERVICES_ENABLED = MMTEL_BASE + 0x000002; 25 | const int ORIGINATING_SERVICES_DISABLED = MMTEL_BASE + 0x000003; 26 | const int TERMINATING_SERVICES_ENABLED = MMTEL_BASE + 0x000004; 27 | const int TERMINATING_SERVICES_DISABLED = MMTEL_BASE + 0x000005; 28 | 29 | const int CALL_DIVERSION_INVOKED = MMTEL_BASE + 0x000010; 30 | const int NO_TARGET_PARAM = MMTEL_BASE + 0x000011; 31 | const int UNRECOGNIZED_CONDITION = MMTEL_BASE + 0x000012; 32 | const int UNPARSEABLE_NO_REPLY_TIMER = MMTEL_BASE + 0x000013; 33 | const int CALL_DIVERSION_ENABLED = MMTEL_BASE + 0x000014; 34 | 35 | const int DIVERTING_CALL = MMTEL_BASE + 0x000020; 36 | 37 | } //namespace SASEvent 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/compositesproutlet.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file compositesproutlet.cpp 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #include "compositesproutlet.h" 13 | #include "pjutils.h" 14 | #include "baseresolver.h" 15 | 16 | CompositeSproutletTsx::CompositeSproutletTsx( 17 | Sproutlet* sproutlet, 18 | const std::string& next_hop_service) : 19 | SproutletTsx(sproutlet), 20 | _next_hop_service(next_hop_service) 21 | {} 22 | 23 | int CompositeSproutletTsx::send_request(pjsip_msg*& req, 24 | int allowed_host_state) 25 | { 26 | pjsip_to_hdr* to_hdr = PJSIP_MSG_TO_HDR(req); 27 | bool in_dialog = ((to_hdr != NULL) && (to_hdr->tag.slen != 0)); 28 | 29 | if (!in_dialog && !_next_hop_service.empty()) 30 | { 31 | // This is a standalone or dialog-creating request, and we have a next hop 32 | // configured - use it. 33 | pjsip_sip_uri* base_uri = get_routing_uri(req); 34 | pjsip_sip_uri* uri = next_hop_uri(_next_hop_service, 35 | base_uri, 36 | get_pool(req)); 37 | PJUtils::add_top_route_header(req, uri, get_pool(req)); 38 | } 39 | 40 | return _helper->send_request(req, allowed_host_state); 41 | } 42 | -------------------------------------------------------------------------------- /src/ut/acr_scscfcancel.json: -------------------------------------------------------------------------------- 1 | { 2 | "peers":{ 3 | "ccf":["192.1.1.1","192.1.1.2"], 4 | "ecf":["192.1.1.3","192.1.1.4"] 5 | }, 6 | "event":{ 7 | "Accounting-Record-Type":1, 8 | "Acct-Interim-Interval":600, 9 | "Event-Timestamp":1, 10 | "Service-Information":{ 11 | "Subscription-Id":[{ 12 | "Subscription-Id-Type":2, 13 | "Subscription-Id-Data":"sip:6505550000@homedomain" 14 | }, 15 | { 16 | "Subscription-Id-Type":0, 17 | "Subscription-Id-Data":"6505550000" 18 | } 19 | ], 20 | "IMS-Information":{ 21 | "Event-Type":{ 22 | "SIP-Method":"INVITE" 23 | }, 24 | "Role-Of-Node":0, 25 | "Node-Functionality":0, 26 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 27 | "Calling-Party-Address":["sip:6505550000@homedomain","tel:6505550000"], 28 | "Requested-Party-Address":"sip:6505550001@homedomain", 29 | "Time-Stamps":{ 30 | "SIP-Request-Timestamp":1, 31 | "SIP-Request-Timestamp-Fraction":0, 32 | "SIP-Response-Timestamp":1, 33 | "SIP-Response-Timestamp-Fraction":20 34 | }, 35 | "Inter-Operator-Identifier":[{ 36 | "Originating-IOI":"homedomain" 37 | }], 38 | "IMS-Charging-Identifier":"1234bc9876e", 39 | "Cause-Code":487, 40 | "From-Address":"\"6505550000\" ;tag=12345678", 41 | "Route-Header-Received":"", 42 | "Instance-Id":"" 43 | } 44 | } 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /include/pluginloader.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file pluginloader.h Sproutlet plug-in loader. 3 | * 4 | * Copyright (C) Metaswitch Networks 2015 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef PLUGINLOADER_H__ 13 | #define PLUGINLOADER_H__ 14 | 15 | #include "cfgoptions.h" 16 | #include "sproutlet.h" 17 | #include "sproutletplugin.h" 18 | 19 | class PluginLoader 20 | { 21 | public: 22 | PluginLoader(const std::string& path, struct options& opt); 23 | ~PluginLoader(); 24 | 25 | /// Loads the plug-ins and populates the resulting list of Sproutlets 26 | /// Returns whether we hit issues loading the plugins and should 27 | /// therefore exit 28 | bool load(std::list& sproutlets); 29 | 30 | /// Unloads all plug-ins that have been successfully loaded. 31 | void unload(); 32 | 33 | private: 34 | /// Checks whether the API version is supported by this system. 35 | bool api_supported(int version); 36 | 37 | /// Path to load plug-ins from. 38 | std::string _path; 39 | 40 | /// Command line options. 41 | struct options& _opt; 42 | 43 | /// Structure maintained for each plugin that is successfully loaded. 44 | typedef struct 45 | { 46 | std::string name; 47 | void* handle; 48 | SproutletPlugin* plugin; 49 | } Plugin; 50 | 51 | /// List of successfully loaded plugins. 52 | std::list _loaded; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/scscfselector.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file scscfselector.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2016 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef SCSCFSELECTOR_H__ 13 | #define SCSCFSELECTOR_H__ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "updater.h" 21 | #include "sas.h" 22 | 23 | class SCSCFSelector 24 | { 25 | public: 26 | SCSCFSelector(const std::string& fallback_scscf_uri, 27 | std::string configuration = "./s-cscf.json"); 28 | ~SCSCFSelector(); 29 | 30 | // Updates the scscf configuration 31 | void update_scscf(); 32 | 33 | // returns name of s-cscf with matching capabilities 34 | std::string get_scscf(const std::vector &mandatory, 35 | const std::vector &optional, 36 | const std::vector &rejects, 37 | SAS::TrailId trail); 38 | private: 39 | typedef struct scscf 40 | { 41 | std::string server; 42 | int priority; 43 | int weight; 44 | std::vector capabilities; 45 | } scscf_t; 46 | 47 | std::string _fallback_scscf_uri; 48 | std::string _configuration; 49 | std::vector _scscfs; 50 | Updater* _updater; 51 | boost::shared_mutex _scscfs_rw_lock; 52 | }; 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /debian/clearwater-sip-stress.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file clearwater-sip-stress.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2015 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | NAME=clearwater-sip-stress 30 | 31 | case "$1" in 32 | configure) 33 | /usr/share/clearwater/infrastructure/scripts/sip-stress 34 | service clearwater-sip-stress start 35 | ;; 36 | 37 | abort-upgrade|abort-remove|abort-deconfigure) 38 | ;; 39 | 40 | *) 41 | echo "postinst called with unknown argument \`$1'" >&2 42 | exit 1 43 | ;; 44 | esac 45 | 46 | # dh_installdeb will replace this with shell code automatically 47 | # generated by other debhelper scripts. 48 | 49 | #DEBHELPER# 50 | 51 | exit 0 52 | -------------------------------------------------------------------------------- /include/sessioncase.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sessioncase.h The session case data type. 3 | * 4 | * Copyright (C) Metaswitch Networks 2014 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | /// 13 | /// 14 | 15 | #ifndef SESSIONCASE_H__ 16 | #define SESSIONCASE_H__ 17 | 18 | #include 19 | 20 | /// The session case (sescase; see RFC5502 and 3GPP TS 29.228). This 21 | /// is a closed class, so pointer equality may be used between its 22 | /// instances. 23 | class SessionCase 24 | { 25 | public: 26 | std::string to_string() const; 27 | 28 | const static SessionCase Originating; 29 | const static SessionCase Terminating; 30 | const static SessionCase OriginatingCdiv; 31 | 32 | inline bool is_originating() const 33 | { 34 | return ((this == &Originating) || (this == &OriginatingCdiv)); 35 | } 36 | 37 | inline bool is_terminating() const 38 | { 39 | return (this == &Terminating); 40 | } 41 | 42 | inline bool operator==(const SessionCase& that) const 43 | { 44 | return (this == &that); 45 | } 46 | 47 | inline bool operator!=(const SessionCase& that) const 48 | { 49 | return (this != &that); 50 | } 51 | 52 | protected: 53 | SessionCase(std::string name); 54 | 55 | std::string _name; 56 | 57 | private: 58 | // Prevent copying. 59 | SessionCase(const SessionCase&); 60 | const SessionCase& operator=(const SessionCase&); 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /bono.root/usr/share/clearwater/infrastructure/scripts/bono.monit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file bono.monit 4 | # 5 | # Copyright (C) Metaswitch Networks 2015 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # Set up the monit configuration for bono with the right IP addresses and ports 13 | cat > /etc/monit/conf.d/bono.monit < 80% then exec "/etc/init.d/bono abort" 27 | 28 | # Check the SIP interface. This depends on the Bono process (and so won't run 29 | # unless the Bono process is running) 30 | check program poll_bono with path "/usr/share/clearwater/bin/poll_bono.sh" 31 | group bono 32 | depends on bono_process 33 | 34 | # Aborting generates a core file and triggers diagnostic collection. 35 | if status != 0 for 2 cycles then exec "/etc/init.d/bono abort" 36 | EOF 37 | chmod 0644 /etc/monit/conf.d/bono.monit 38 | 39 | # Force monit to reload its configuration 40 | reload clearwater-monit || true 41 | 42 | -------------------------------------------------------------------------------- /debian/clearwater-sip-perf.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file clearwater-sip-perf.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2015 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | NAME=clearwater-sip-perf 30 | 31 | case "$1" in 32 | configure) 33 | /usr/share/clearwater/infrastructure/scripts/sip-perf 34 | # Don't start the service - we do this on demand 35 | ;; 36 | 37 | abort-upgrade|abort-remove|abort-deconfigure) 38 | ;; 39 | 40 | *) 41 | echo "postinst called with unknown argument \`$1'" >&2 42 | exit 1 43 | ;; 44 | esac 45 | 46 | # dh_installdeb will replace this with shell code automatically 47 | # generated by other debhelper scripts. 48 | 49 | #DEBHELPER# 50 | 51 | exit 0 52 | -------------------------------------------------------------------------------- /debian/gemini-as.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file gemini-as.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | case "$1" in 30 | configure) 31 | # Restart sprout to force reload of new plug-in. Always do this by 32 | # terminating sprout so monit will restart it more-or-less immediately. 33 | # (monit restart seems to have significant lag.) 34 | # Don't fail if it's already stopped. 35 | service sprout stop || /bin/true 36 | ;; 37 | 38 | abort-upgrade|abort-remove|abort-deconfigure) 39 | ;; 40 | 41 | *) 42 | echo "postinst called with unknown argument \`$1'" >&2 43 | exit 1 44 | ;; 45 | esac 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /debian/sprout-bgcf.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-bgcf.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | case "$1" in 30 | configure) 31 | # Restart sprout to force reload of new plug-in. Always do this by 32 | # terminating sprout so monit will restart it more-or-less immediately. 33 | # (monit restart seems to have significant lag.) 34 | # Don't fail if it's already stopped. 35 | service sprout stop || /bin/true 36 | ;; 37 | 38 | abort-upgrade|abort-remove|abort-deconfigure) 39 | ;; 40 | 41 | *) 42 | echo "postinst called with unknown argument \`$1'" >&2 43 | exit 1 44 | ;; 45 | esac 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /debian/sprout-icscf.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-icscf.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | case "$1" in 30 | configure) 31 | # Restart sprout to force reload of new plug-in. Always do this by 32 | # terminating sprout so monit will restart it more-or-less immediately. 33 | # (monit restart seems to have significant lag.) 34 | # Don't fail if it's already stopped. 35 | service sprout stop || /bin/true 36 | ;; 37 | 38 | abort-upgrade|abort-remove|abort-deconfigure) 39 | ;; 40 | 41 | *) 42 | echo "postinst called with unknown argument \`$1'" >&2 43 | exit 1 44 | ;; 45 | esac 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /debian/sprout-scscf.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-scscf.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | case "$1" in 30 | configure) 31 | # Restart sprout to force reload of new plug-in. Always do this by 32 | # terminating sprout so monit will restart it more-or-less immediately. 33 | # (monit restart seems to have significant lag.) 34 | # Don't fail if it's already stopped. 35 | service sprout stop || /bin/true 36 | ;; 37 | 38 | abort-upgrade|abort-remove|abort-deconfigure) 39 | ;; 40 | 41 | *) 42 | echo "postinst called with unknown argument \`$1'" >&2 43 | exit 1 44 | ;; 45 | esac 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /debian/clearwater-sip-stress-stats.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file clearwater-sip-stress-stats.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2013 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | case "$1" in 30 | configure) 31 | gem install /usr/share/clearwater/gems/clearwater-sipp-stats-1.0.0.gem --no-ri --no-rdoc 32 | service clearwater-sip-stress-stats start 33 | ;; 34 | 35 | abort-upgrade|abort-remove|abort-deconfigure) 36 | ;; 37 | 38 | *) 39 | echo "postinst called with unknown argument \`$1'" >&2 40 | exit 1 41 | ;; 42 | esac 43 | 44 | # dh_installdeb will replace this with shell code automatically 45 | # generated by other debhelper scripts. 46 | 47 | #DEBHELPER# 48 | 49 | exit 0 50 | -------------------------------------------------------------------------------- /debian/mangelwurzel-as.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file mangelwurzel-as.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | case "$1" in 30 | configure) 31 | # Restart sprout to force reload of new plug-in. Always do this by 32 | # terminating sprout so monit will restart it more-or-less immediately. 33 | # (monit restart seems to have significant lag.) 34 | # Don't fail if it's already stopped. 35 | service sprout stop || /bin/true 36 | ;; 37 | 38 | abort-upgrade|abort-remove|abort-deconfigure) 39 | ;; 40 | 41 | *) 42 | echo "postinst called with unknown argument \`$1'" >&2 43 | exit 1 44 | ;; 45 | esac 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /debian/sprout-mmtel-as.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file sprout-mmtel-as.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | case "$1" in 30 | configure) 31 | # Restart sprout to force reload of new plug-in. Always do this by 32 | # terminating sprout so monit will restart it more-or-less immediately. 33 | # (monit restart seems to have significant lag.) 34 | # Don't fail if it's already stopped. 35 | service sprout stop || /bin/true 36 | ;; 37 | 38 | abort-upgrade|abort-remove|abort-deconfigure) 39 | ;; 40 | 41 | *) 42 | echo "postinst called with unknown argument \`$1'" >&2 43 | exit 1 44 | ;; 45 | esac 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /debian/call-diversion-as.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @file call-diversion-as.postinst 4 | # 5 | # Copyright (C) Metaswitch Networks 2014 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # 13 | # see: dh_installdeb(1) 14 | 15 | set -e 16 | 17 | # summary of how this script can be called: 18 | # * `configure' 19 | # * `abort-upgrade' 20 | # * `abort-remove' `in-favour' 21 | # 22 | # * `abort-remove' 23 | # * `abort-deconfigure' `in-favour' 24 | # `removing' 25 | # 26 | # for details, see http://www.debian.org/doc/debian-policy/ or 27 | # the debian-policy package 28 | 29 | case "$1" in 30 | configure) 31 | # Restart sprout to force reload of new plug-in. Always do this by 32 | # terminating sprout so monit will restart it more-or-less immediately. 33 | # (monit restart seems to have significant lag.) 34 | # Don't fail if it's already stopped. 35 | service sprout stop || /bin/true 36 | ;; 37 | 38 | abort-upgrade|abort-remove|abort-deconfigure) 39 | ;; 40 | 41 | *) 42 | echo "postinst called with unknown argument \`$1'" >&2 43 | exit 1 44 | ;; 45 | esac 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /sprout-base.root/usr/share/clearwater/bin/poll_sprout_sip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # @file poll_sprout_sip.sh 4 | # 5 | # Copyright (C) Metaswitch Networks 2015 6 | # If license terms are provided to you in a COPYING file in the root directory 7 | # of the source code repository by which you are accessing this code, then 8 | # the license outlined in that COPYING file applies to your use. 9 | # Otherwise no rights are granted except for those provided to you by 10 | # Metaswitch Networks in a separate written agreement. 11 | 12 | # This script uses a SIP message to poll a process and check whether it is 13 | # healthy. 14 | 15 | # Read the config, defaulting appropriately. 16 | scscf=5054 17 | icscf=0 18 | bgcf=5053 19 | . /etc/clearwater/config 20 | [ -z $signaling_namespace ] || namespace_prefix="ip netns exec $signaling_namespace" 21 | 22 | # If we have S-CSCF configured, check it. 23 | rc=0 24 | if [ "$scscf" != "0" ] ; then 25 | $namespace_prefix /usr/share/clearwater/bin/poll-sip $scscf 26 | rc=$? 27 | fi 28 | 29 | # If that succeeded and we have I-CSCF configured, check it. 30 | if [ $rc = 0 ] && [ "$icscf" != "0" ] ; then 31 | $namespace_prefix /usr/share/clearwater/bin/poll-sip $icscf 32 | rc=$? 33 | fi 34 | 35 | # If that succeeded and we have BGCF configured, check it. 36 | if [ $rc = 0 ] && [ "$bgcf" != "0" ]; then 37 | $namespace_prefix /usr/share/clearwater/bin/poll-sip $bgcf 38 | rc=$? 39 | fi 40 | 41 | # If the sprout process is not stable, we ignore a non-zero return code and 42 | # return zero. 43 | if [ $rc != 0 ]; then 44 | /usr/share/clearwater/infrastructure/monit_stability/sprout-stability check 45 | if [ $? != 0 ]; then 46 | echo "return code $rc ignored" >&2 47 | rc=0 48 | fi 49 | fi 50 | 51 | exit $rc 52 | -------------------------------------------------------------------------------- /src/ut/mock_sproutlet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_sproutlet.h Mock Sproutlet 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MOCKSPROUTLET_H__ 13 | #define MOCKSPROUTLET_H__ 14 | 15 | #include "gmock/gmock.h" 16 | #include "sproutlet.h" 17 | 18 | /// Mock class for Sproutlet. 19 | class MockSproutlet : public Sproutlet 20 | { 21 | public: 22 | MockSproutlet( 23 | const std::string& service_name, 24 | int port, 25 | const std::string& service_host); 26 | ~MockSproutlet(); 27 | 28 | MOCK_METHOD6( 29 | get_tsx, 30 | SproutletTsx*(SproutletProxy*, const std::string&, pjsip_msg*, pjsip_sip_uri*&, pj_pool_t*, SAS::TrailId)); 31 | }; 32 | 33 | 34 | /// Mock class for SproutletTsx. 35 | class MockSproutletTsx : public SproutletTsx 36 | { 37 | public: 38 | MockSproutletTsx(); 39 | ~MockSproutletTsx(); 40 | 41 | void set_helper(SproutletTsxHelper* helper) 42 | { 43 | _helper = helper; 44 | } 45 | 46 | MOCK_METHOD1(on_rx_initial_request, void(pjsip_msg*)); 47 | MOCK_METHOD1(on_rx_in_dialog_request, void(pjsip_msg*)); 48 | MOCK_METHOD2(on_tx_request, void(pjsip_msg*, int)); 49 | MOCK_METHOD2(on_rx_response, void(pjsip_msg*, int)); 50 | MOCK_METHOD1(on_tx_response, void(pjsip_msg*)); 51 | MOCK_METHOD2(on_rx_cancel, void(int, pjsip_msg*)); 52 | MOCK_METHOD1(on_timer_expiry, void(void*)); 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /debian/sprout-scscf.install: -------------------------------------------------------------------------------- 1 | build/bin/sprout_scscf.so usr/share/clearwater/sprout/plugins 2 | 3 | # Install the IFCs plugins and scripts 4 | modules/clearwater-etcd-plugins/clearwater_config_manager/shared_ifcs_xml_plugin.py /usr/share/clearwater/clearwater-config-manager/plugins/ 5 | modules/clearwater-etcd-plugins/clearwater_config_manager/fallback_ifcs_xml_plugin.py /usr/share/clearwater/clearwater-config-manager/plugins/ 6 | modules/clearwater-etcd-plugins/clearwater_config_manager/scripts/remove_shared_ifcs_xml /usr/share/clearwater/clearwater-config-manager/scripts 7 | modules/clearwater-etcd-plugins/clearwater_config_manager/scripts/remove_fallback_ifcs_xml /usr/share/clearwater/clearwater-config-manager/scripts 8 | modules/clearwater-etcd-plugins/clearwater_config_manager/scripts/validate_shared_ifcs_xml /usr/share/clearwater/clearwater-config-manager/scripts 9 | modules/clearwater-etcd-plugins/clearwater_config_manager/scripts/validate_fallback_ifcs_xml /usr/share/clearwater/clearwater-config-manager/scripts 10 | modules/clearwater-etcd-plugins/clearwater_config_manager/scripts/display_shared_ifcs /usr/share/clearwater/clearwater-config-manager/scripts 11 | modules/clearwater-etcd-plugins/clearwater_config_manager/scripts/display_fallback_ifcs /usr/share/clearwater/clearwater-config-manager/scripts 12 | modules/clearwater-etcd-plugins/clearwater_config_manager/scripts/config_validation/* /usr/share/clearwater/clearwater-config-manager/scripts/config_validation 13 | 14 | modules/clearwater-etcd-plugins/clearwater_config_access/shared_ifcs_config_plugin.py /usr/share/clearwater/clearwater-config-access/plugins/ 15 | modules/clearwater-etcd-plugins/clearwater_config_access/fallback_ifcs_config_plugin.py /usr/share/clearwater/clearwater-config-access/plugins/ 16 | -------------------------------------------------------------------------------- /docs/Mangelwurzel.md: -------------------------------------------------------------------------------- 1 | # Mangelwurzel 2 | 3 | Mangelwurzel is a Sproutlet that is built with sprout and is invoked and configured as an application server. Its function is to mangle various fields on SIP requests and unmangle them on responses, and then forward the messages on. It doesn't affect call service. It is used for testing purposes. 4 | 5 | ## Installation 6 | 7 | Mangelwurzel is installed on top of sprout-base. It can be installed through the mangelwurzel-as package. 8 | 9 | ## Invocation and configuration 10 | 11 | Mangelwurzel is invoked and configured through iFCs. The URI must contain mangelwurzel (and must obviously be routable to the mangelwurzel node). Typically it would be either sip:mangelwurzel.homedomain or sip:mangelwurzel@\. There are also a number of optional parameters encoded on the URI which define mangelwurzel's configuration. They are as follows: 12 | 13 | * dialog – Present if the dialog identifiers (From tag, To tag and call ID) should be changed. 14 | * req-uri – Present if the Request URI (and Contact URI) of this request should be changed. 15 | * to – Present if the To header of this request should be changed. 16 | * routes – Present if the route set of this request should be changed. 17 | * mangalgorithm – Specifies the algorithm to use for URI manipulation. Takes values of rot13 or reverse. 18 | * change-domain – Present if the algorithm should mangle the Request URI, To URI and Contact URI domains too. We may wish to only mangle the user part of URIs for ease of use. 19 | * orig – Present if requests leaving mangelwurzel should be originating. 20 | * ootb – Present if requests leaving mangelwurzel should be out of the blue. 21 | 22 | Via headers are always stripped off requests and added back on responses. 23 | -------------------------------------------------------------------------------- /include/fifcservice.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file fifcservice.h Support for fallback iFCs. 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #include 13 | #include 14 | #include "rapidxml/rapidxml.hpp" 15 | 16 | #include "updater.h" 17 | #include "ifc.h" 18 | #include "alarm.h" 19 | 20 | #ifndef FIFCSERVICE_H__ 21 | #define FIFCSERVICE_H__ 22 | 23 | class FIFCService 24 | { 25 | public: 26 | FIFCService(Alarm* alarm, 27 | std::string configuration = "/etc/clearwater/fallback_ifcs.xml"); 28 | ~FIFCService(); 29 | 30 | // Node names within the fallback iFC configuration file. 31 | const char* const FALLBACK_IFCS_SET = "FallbackIFCsSet"; 32 | 33 | /// Updates the fallback iFCs. 34 | void update_fifcs(); 35 | 36 | /// Get the fallback iFCs 37 | std::vector get_fallback_ifcs(rapidxml::xml_document<>* ifc_doc) const; 38 | 39 | private: 40 | Alarm* _alarm; 41 | std::vector _fallback_ifcs; 42 | std::string _configuration; 43 | Updater* _updater; 44 | 45 | // Mark as mutable to flag that this can be modified without affecting the 46 | // external behaviour of the calss, allowing for locking in 'const' methods. 47 | mutable boost::shared_mutex _sets_rw_lock; 48 | 49 | // Helper functions to set/clear the alarm. 50 | void set_alarm(); 51 | void clear_alarm(); 52 | }; 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /src/ut/mock_registration_sender.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_registration_sender.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2018 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef MOCK_REGISTRATION_SENDER_H_ 13 | #define MOCK_REGISTRATION_SENDER_H_ 14 | 15 | #include "gmock/gmock.h" 16 | #include "registration_sender.h" 17 | 18 | class MockRegistrationSender : public RegistrationSender 19 | { 20 | public: 21 | MockRegistrationSender(); 22 | 23 | virtual ~MockRegistrationSender(); 24 | 25 | MOCK_METHOD8(register_with_application_servers, void(pjsip_msg* received_register_message, 26 | pjsip_msg* ok_response_msg, 27 | const std::string& served_user, 28 | const Ifcs& ifcs, 29 | int expires, 30 | bool is_initial_registration, 31 | bool& deregister_subscriber, 32 | SAS::TrailId trail)); 33 | 34 | MOCK_METHOD3(deregister_with_application_servers, void(const std::string& served_user, 35 | const Ifcs& ifcs, 36 | SAS::TrailId trail)); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /docs/IOTraps.md: -------------------------------------------------------------------------------- 1 | # Trapping disallowed IO patterns 2 | 3 | Sprout's overload controls use message latency to spot when sprout is under too much load. However these controls exclude the latency of any IO that sprout does when processing a message, so as to accurately measure the load on the sprout node and not other devices in the network. For this to work correctly, it is important that any IO done on a sprout worker thread is wrapped in calls to `CW_IO_STARTS` and `CW_IO_COMPLETES`, as this ensures that any latency incurred from the IO is deducted from the overall latency of the message. 4 | 5 | In order to spot if sprout does any IO with making the above calls, sprout comes with an "IO trap". This is a shared object that can be installed into sprout using the `LD_PRELOAD` environment variable. With the trap installed, ff sprout's worker threads do any IO without making these calls, the process will abort and produce a stack trace and a core file. 6 | 7 | To run sprout with the IO trap, do the following. 8 | 9 | 1. Find the command line you are using to run sprout (`ps -eaf | grep sprout`) 10 | 1. Make sure you have the appropriate debug packages installed (`sudo apt-get install sprout-node-dbg`) 11 | 1. Disable monitoring of sprout (`sudo monit unmonitor -g sprout`) 12 | 1. Stop sprout (`sudo service sprout stop`) 13 | 1. Set user limits and become the sprout user (`sudo -i; ulimit -Hn 1000000; ulimit -Sn 1000000; ulimit -r 1; ulimit -c unlimited; sudo -s -u sprout bash`) 14 | 1. Change to the `/etc/clearwater` directory 15 | 1. Run the following command, replacing args with the arguments sprout was run with in step 1. 16 | 17 | ``` 18 | LD_PRELOAD=/usr/share/clearwater/sprout/lib/sprout_io_trap.so LD_LIBRARY_PATH=/usr/share/clearwater/sprout/lib /usr/share/clearwater/bin/sprout 19 | ``` 20 | -------------------------------------------------------------------------------- /include/bgcfservice.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file bgcfservice.h class definition for an BGCF service provider 3 | * 4 | * Copyright (C) Metaswitch Networks 2015 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | /// 13 | /// 14 | 15 | #ifndef BGCFSERVICE_H__ 16 | #define BGCFSERVICE_H__ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include "updater.h" 25 | #include "sas.h" 26 | 27 | class BgcfService 28 | { 29 | public: 30 | BgcfService(std::string configuration = "./bgcf.json"); 31 | ~BgcfService(); 32 | 33 | /// Updates the bgcf routes 34 | void update_routes(); 35 | 36 | std::vector get_route_from_domain(const std::string &domain, 37 | SAS::TrailId trail) const; 38 | std::vector get_route_from_number(const std::string &number, 39 | SAS::TrailId trail) const; 40 | 41 | private: 42 | std::map> _domain_routes; 43 | std::map> _number_routes; 44 | std::string _configuration; 45 | Updater* _updater; 46 | 47 | // Mark as mutable to flag that this can be modified without affecting the 48 | // external behaviour of the class, allowing for locking in 'const' methods. 49 | mutable boost::shared_mutex _routes_rw_lock; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/ut/mock_pjsip_module.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file mock_pjsip_module.h Mock PJSip module. 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | 13 | #ifndef MOCK_PJSIP_MODULE_H__ 14 | #define MOCK_PJSIP_MODULE_H__ 15 | 16 | extern "C" { 17 | #include 18 | #include 19 | #include 20 | } 21 | 22 | #include "gmock/gmock.h" 23 | #include "pjmodule.h" 24 | 25 | 26 | class MockPJSipModule 27 | { 28 | public: 29 | MockPJSipModule(pjsip_endpoint* endpt, 30 | std::string name, 31 | int priority) : 32 | _mod_mock(this, endpt, name, priority, PJMODULE_ALL) 33 | { 34 | } 35 | 36 | MOCK_METHOD1(on_rx_request, pj_bool_t(pjsip_rx_data *rdata)); 37 | MOCK_METHOD1(on_rx_response, pj_bool_t(pjsip_rx_data *rdata)); 38 | MOCK_METHOD1(on_tx_request, pj_status_t(pjsip_tx_data *tdata)); 39 | MOCK_METHOD1(on_tx_response, pj_status_t(pjsip_tx_data *tdata)); 40 | MOCK_METHOD2(on_tsx_state, void(pjsip_transaction *tsx, pjsip_event *event)); 41 | 42 | protected: 43 | static const int PJMODULE_ALL = PJCallback::ON_RX_REQUEST| 44 | PJCallback::ON_RX_RESPONSE| 45 | PJCallback::ON_TX_REQUEST| 46 | PJCallback::ON_TX_RESPONSE| 47 | PJCallback::ON_TSX_STATE; 48 | 49 | PJModule _mod_mock; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/ut/handlers_test.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file handlers_test.h 3 | * 4 | * Copyright (C) Metaswitch Networks 2017 5 | * If license terms are provided to you in a COPYING file in the root directory 6 | * of the source code repository by which you are accessing this code, then 7 | * the license outlined in that COPYING file applies to your use. 8 | * Otherwise no rights are granted except for those provided to you by 9 | * Metaswitch Networks in a separate written agreement. 10 | */ 11 | 12 | #ifndef HANDLERSTEST_H__ 13 | #define HANDLERSTEST_H__ 14 | 15 | #include "test_utils.hpp" 16 | #include 17 | 18 | #include "mockhttpstack.hpp" 19 | #include "handlers.h" 20 | #include "basetest.hpp" 21 | #include "siptest.hpp" 22 | #include "fakehssconnection.hpp" 23 | #include "mock_subscriber_manager.h" 24 | #include "mock_impi_store.h" 25 | #include "mock_hss_connection.h" 26 | #include "aor_test_utils.h" 27 | #include "gtest/gtest.h" 28 | 29 | 30 | // Base class used for testing handlers with Mock Subscriber Manager. 31 | class TestWithMockSM : public BaseTest 32 | { 33 | MockSubscriberManager* sm; 34 | MockHttpStack* stack; 35 | 36 | virtual void SetUp() 37 | { 38 | sm = new MockSubscriberManager(); 39 | stack = new MockHttpStack(); 40 | } 41 | 42 | virtual void TearDown() 43 | { 44 | delete stack; stack = NULL; 45 | delete sm; sm = NULL; 46 | } 47 | }; 48 | 49 | class AuthTimeoutTest : public SipTest 50 | { 51 | MockImpiStore* store; 52 | FakeHSSConnection* fake_hss; 53 | MockHttpStack stack; 54 | 55 | void SetUp() 56 | { 57 | store = new MockImpiStore(); 58 | fake_hss = new FakeHSSConnection(); 59 | } 60 | 61 | void TearDown() 62 | { 63 | delete fake_hss; fake_hss = NULL; 64 | delete store; store = NULL; 65 | } 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/ut/acr_scscftermcall_interim.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": { 3 | "Accounting-Record-Type": 3, 4 | "Event-Timestamp": 60, 5 | "Service-Information": { 6 | "IMS-Information": { 7 | "Called-Asserted-Identity": [ 8 | "sip:6505550001@homedomain", 9 | "tel:6505550001" 10 | ], 11 | "Called-Party-Address": "sip:6505559999@10.83.18.50:12345;transport=TCP", 12 | "Calling-Party-Address": [ 13 | "sip:6505550000@homedomain", 14 | "tel:6505550000" 15 | ], 16 | "Event-Type": { 17 | "SIP-Method": "INVITE" 18 | }, 19 | "From-Address": "\"6505550000\" ;tag=12345678", 20 | "IMS-Charging-Identifier": "1234bc9876e", 21 | "Inter-Operator-Identifier": [ 22 | { 23 | "Originating-IOI": "homedomain", 24 | "Terminating-IOI": "homedomain" 25 | } 26 | ], 27 | "Node-Functionality": 0, 28 | "Role-Of-Node": 1, 29 | "Route-Header-Received": "", 30 | "Route-Header-Transmitted": "", 31 | "Time-Stamps": { 32 | "SIP-Request-Timestamp": 60, 33 | "SIP-Request-Timestamp-Fraction": 0, 34 | "SIP-Response-Timestamp": 60, 35 | "SIP-Response-Timestamp-Fraction": 15 36 | }, 37 | "User-Session-Id": "0123456789abcdef-10.83.18.38" 38 | }, 39 | "Subscription-Id": [ 40 | { 41 | "Subscription-Id-Data": "sip:6505550001@homedomain", 42 | "Subscription-Id-Type": 2 43 | }, 44 | { 45 | "Subscription-Id-Data": "6505550001", 46 | "Subscription-Id-Type": 0 47 | } 48 | ] 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/ut/acr_scscforigcall_stop.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": { 3 | "Accounting-Record-Type":4, 4 | "Event-Timestamp":120, 5 | "Service-Information": { 6 | "Subscription-Id": [{ 7 | "Subscription-Id-Type":2, 8 | "Subscription-Id-Data":"sip:6505550000@homedomain" 9 | }, 10 | { 11 | "Subscription-Id-Type":0, 12 | "Subscription-Id-Data":"6505550000" 13 | }], 14 | "IMS-Information": { 15 | "Event-Type": { 16 | "SIP-Method":"BYE" 17 | }, 18 | "Role-Of-Node":0, 19 | "Node-Functionality":0, 20 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 21 | "Calling-Party-Address":["sip:6505550000@homedomain","tel:6505550000"], 22 | "Called-Party-Address":"sip:6505559999@10.83.18.50:12345;transport=TCP", 23 | "Called-Asserted-Identity":["sip:6505550001@homedomain","tel:6505550001"], 24 | "Time-Stamps": { 25 | "SIP-Request-Timestamp":120, 26 | "SIP-Request-Timestamp-Fraction":0, 27 | "SIP-Response-Timestamp":120, 28 | "SIP-Response-Timestamp-Fraction":20 29 | }, 30 | "Inter-Operator-Identifier": [{ 31 | "Originating-IOI":"homedomain", 32 | "Terminating-IOI":"homedomain" 33 | }], 34 | "IMS-Charging-Identifier":"1234bc9876e", 35 | "Cause-Code":0, 36 | "Reason-Header":["SIP;cause=200;text=\"Call completed elsewhere\""], 37 | "From-Address":"\"6505550000\" ;tag=12345678", 38 | "Route-Header-Received":"", 39 | "Route-Header-Transmitted":"", 40 | "Instance-Id":"" 41 | } 42 | } 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # 5 | # This file was originally written by Joey Hess and Craig Small. 6 | # As a special exception, when this file is copied by dh-make into a 7 | # dh-make output file, you may use that output file without restriction. 8 | # This special exception was added by Craig Small in version 0.37 of dh-make. 9 | # 10 | # Modified to make a template file for a multi-binary package with separated 11 | # build-arch and build-indep targets by Bill Allombert 2001 12 | 13 | # Uncomment this to turn on verbose mode. 14 | #export DH_VERBOSE=1 15 | 16 | # This has to be exported to make some magic below work. 17 | export DH_OPTIONS 18 | 19 | %: 20 | dh $@ 21 | 22 | # Don't clean, build, test or install 23 | override_dh_auto_clean: 24 | override_dh_auto_build: 25 | override_dh_auto_test: 26 | mkdir debian/tmp 27 | 28 | override_dh_auto_install: 29 | mkdir debian/tmp 30 | cp build/bin/sprout build/bin/bono 31 | 32 | # Don't start - monit does that for us. 33 | override_dh_installinit: 34 | dh_installinit --no-start -u"defaults 60 40" 35 | 36 | override_dh_shlibdeps: 37 | override_dh_strip: 38 | dh_strip -psprout-libs --dbg-package=sprout-libs-dbg 39 | dh_strip -psprout-base --dbg-package=sprout-base-dbg 40 | dh_strip -psprout-scscf --dbg-package=sprout-scscf-dbg 41 | dh_strip -psprout-icscf --dbg-package=sprout-icscf-dbg 42 | dh_strip -psprout-bgcf --dbg-package=sprout-bgcf-dbg 43 | dh_strip -psprout-mmtel-as --dbg-package=sprout-mmtel-as-dbg 44 | dh_strip -pgemini-as --dbg-package=gemini-as-dbg 45 | dh_strip -pcall-diversion-as --dbg-package=call-diversion-as-dbg 46 | dh_strip -pmangelwurzel-as --dbg-package=mangelwurzel-as-dbg 47 | dh_strip -pbono --dbg-package=bono-dbg 48 | dh_strip -pclearwater-sipp --dbg-package=clearwater-sipp-dbg 49 | -------------------------------------------------------------------------------- /src/ut/acr_scscfregister.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": { 3 | "Accounting-Record-Type": 1, 4 | "User-Name":"Alice", 5 | "Event-Timestamp": 1, 6 | "Service-Information": { 7 | "IMS-Information": { 8 | "Associated-URI": [ 9 | "sip:6505550000@homedomain", 10 | "tel:6505550000" 11 | ], 12 | "Called-Party-Address" : "sip:6505550000@homedomain", 13 | "Cause-Code" : -1, 14 | "Event-Type": { 15 | "Expires" : 300, 16 | "SIP-Method": "REGISTER" 17 | }, 18 | "From-Address": "\"6505550000\" ", 19 | "IMS-Charging-Identifier": "1234bc9876e", 20 | "Instance-Id" : "", 21 | "Inter-Operator-Identifier": [ 22 | { 23 | "Originating-IOI": "homedomain" 24 | } 25 | ], 26 | "Transit-IOI-List":["transitdomain"], 27 | "Node-Functionality": 0, 28 | "Requested-Party-Address" : "sip:homedomain", 29 | "Role-Of-Node": 0, 30 | "Route-Header-Received": "", 31 | "Time-Stamps": { 32 | "SIP-Request-Timestamp": 1, 33 | "SIP-Request-Timestamp-Fraction": 0, 34 | "SIP-Response-Timestamp": 1, 35 | "SIP-Response-Timestamp-Fraction": 25 36 | }, 37 | "User-Session-Id": "0123456789abcdef-10.83.18.38" 38 | }, 39 | "Subscription-Id": [ 40 | { 41 | "Subscription-Id-Data": "sip:6505550000@homedomain", 42 | "Subscription-Id-Type": 2 43 | } 44 | ] 45 | } 46 | }, 47 | "peers": { 48 | "ccf": [ 49 | "192.1.1.1", 50 | "192.1.1.2" 51 | ], 52 | "ecf": [ 53 | "192.1.1.3", 54 | "192.1.1.4" 55 | ] 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/ut/acr_scscftermcall_stop.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": { 3 | "Accounting-Record-Type": 4, 4 | "Event-Timestamp": 120, 5 | "Service-Information": { 6 | "IMS-Information": { 7 | "Called-Asserted-Identity": [ 8 | "sip:6505550001@homedomain", 9 | "tel:6505550001" 10 | ], 11 | "Called-Party-Address": "sip:6505559999@10.83.18.50:12345;transport=TCP", 12 | "Calling-Party-Address": [ 13 | "sip:6505550000@homedomain", 14 | "tel:6505550000" 15 | ], 16 | "Cause-Code" : 0, 17 | "Event-Type": { 18 | "SIP-Method": "BYE" 19 | }, 20 | "From-Address": "\"6505550000\" ;tag=12345678", 21 | "IMS-Charging-Identifier": "1234bc9876e", 22 | "Inter-Operator-Identifier": [ 23 | { 24 | "Originating-IOI": "homedomain", 25 | "Terminating-IOI": "homedomain" 26 | } 27 | ], 28 | "Node-Functionality": 0, 29 | "Role-Of-Node": 1, 30 | "Route-Header-Received": "", 31 | "Route-Header-Transmitted": "", 32 | "Time-Stamps": { 33 | "SIP-Request-Timestamp": 120, 34 | "SIP-Request-Timestamp-Fraction": 0, 35 | "SIP-Response-Timestamp": 120, 36 | "SIP-Response-Timestamp-Fraction": 20 37 | }, 38 | "User-Session-Id": "0123456789abcdef-10.83.18.38" 39 | }, 40 | "Subscription-Id": [ 41 | { 42 | "Subscription-Id-Data": "sip:6505550001@homedomain", 43 | "Subscription-Id-Type": 2 44 | }, 45 | { 46 | "Subscription-Id-Data": "6505550001", 47 | "Subscription-Id-Type": 0 48 | } 49 | ] 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/ut/acr_scscforigcall_interim.json: -------------------------------------------------------------------------------- 1 | { 2 | "event": { 3 | "Accounting-Record-Type":3, 4 | "Event-Timestamp":60, 5 | "Service-Information": { 6 | "Subscription-Id": [{ 7 | "Subscription-Id-Type":2, 8 | "Subscription-Id-Data":"sip:6505550000@homedomain" 9 | }, 10 | { 11 | "Subscription-Id-Type":0, 12 | "Subscription-Id-Data":"6505550000" 13 | }], 14 | "IMS-Information": { 15 | "Event-Type": { 16 | "SIP-Method":"INVITE" 17 | }, 18 | "Role-Of-Node":0, 19 | "Node-Functionality":0, 20 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 21 | "Calling-Party-Address":["sip:6505550000@homedomain","tel:6505550000"], 22 | "Called-Party-Address":"sip:6505559999@10.83.18.50:12345;transport=TCP", 23 | "Called-Asserted-Identity":["sip:6505550001@homedomain","tel:6505550001"], 24 | "Time-Stamps": { 25 | "SIP-Request-Timestamp":60, 26 | "SIP-Request-Timestamp-Fraction":0, 27 | "SIP-Response-Timestamp":60, 28 | "SIP-Response-Timestamp-Fraction":15 29 | }, 30 | "Inter-Operator-Identifier": [{ 31 | "Originating-IOI":"homedomain", 32 | "Terminating-IOI":"homedomain" 33 | }], 34 | "IMS-Charging-Identifier":"1234bc9876e", 35 | "Access-Network-Information":["access-tech=A"], 36 | "From-Address":"\"6505550000\" ;tag=12345678", 37 | "IMS-Visited-Network-Identifier":"other.net,\"Visited network number 1\"", 38 | "Route-Header-Received":"", 39 | "Route-Header-Transmitted":"", 40 | "Instance-Id":"" 41 | } 42 | } 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/ut/test_bgcf_sproutlet_enum.json: -------------------------------------------------------------------------------- 1 | { 2 | "number_blocks" : [ 3 | { "name" : "Clearwater external number +15108580271", 4 | "prefix" : "+15108580271", 5 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 6 | }, 7 | { "name" : "Clearwater external number +15108580272", 8 | "prefix" : "+15108580272", 9 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 10 | }, 11 | { "name" : "Clearwater external number +15108580273", 12 | "prefix" : "+15108580273", 13 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 14 | }, 15 | { "name" : "NP data - SIP - routing number +151085804", 16 | "prefix" : "+151085804", 17 | "regex" : "!(^.*$)!sip:\\1;npdi;rn=+151085804@homedomain;user=phone!" 18 | }, 19 | { "name" : "NP data - cic", 20 | "prefix" : "+151085805", 21 | "regex" : "!(^.*$)!sip:\\1;cic=12345@homedomain;user=phone!" 22 | }, 23 | { "name" : "Clearwater internal numbers", 24 | "prefix" : "650555", 25 | "regex" : "!(^.*$)!sip:\\1@homedomain!" 26 | }, 27 | { "name" : "Clearwater internal numbers - rewritten", 28 | "prefix" : "111555", 29 | "regex" : "!^111(.*)$!sip:650\\1@homedomain!" 30 | }, 31 | { "name" : "Clearwater Tel URI", 32 | "prefix" : "16505551234", 33 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 34 | }, 35 | { "name" : "Setup invalid ENUM rule", 36 | "prefix" : "16505551239", 37 | "regex" : "!(^.*$)!sip:1\\1@ut.cw-ngv.com!" 38 | }, 39 | { "name" : "Invalid ENUM rule", 40 | "prefix" : "116505551239", 41 | "regex" : "!\\+(^.*$)!sip:00\\1@ut.cw-ngv.com!" 42 | } 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /src/ut/test_stateful_proxy_enum.json: -------------------------------------------------------------------------------- 1 | { 2 | "number_blocks" : [ 3 | { "name" : "Clearwater external number +15108580271", 4 | "prefix" : "+15108580271", 5 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 6 | }, 7 | { "name" : "Clearwater external number +15108580272", 8 | "prefix" : "+15108580272", 9 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 10 | }, 11 | { "name" : "Clearwater external number +15108580273", 12 | "prefix" : "+15108580273", 13 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 14 | }, 15 | { "name" : "NP data - SIP - routing number +151085804", 16 | "prefix" : "+151085804", 17 | "regex" : "!(^.*$)!sip:\\1;npdi;rn=+151085804@homedomain;user=phone!" 18 | }, 19 | { "name" : "NP data - cic", 20 | "prefix" : "+151085805", 21 | "regex" : "!(^.*$)!sip:\\1;cic=12345@homedomain;user=phone!" 22 | }, 23 | { "name" : "Clearwater internal numbers", 24 | "prefix" : "650555", 25 | "regex" : "!(^.*$)!sip:\\1@homedomain!" 26 | }, 27 | { "name" : "Clearwater internal numbers - rewritten", 28 | "prefix" : "111555", 29 | "regex" : "!^111(.*)$!sip:650\\1@homedomain!" 30 | }, 31 | { "name" : "Clearwater Tel URI", 32 | "prefix" : "16505551234", 33 | "regex" : "!(^.*$)!sip:\\1@ut.cw-ngv.com!" 34 | }, 35 | { "name" : "Setup invalid ENUM rule", 36 | "prefix" : "16505551239", 37 | "regex" : "!(^.*$)!sip:1\\1@ut.cw-ngv.com!" 38 | }, 39 | { "name" : "Invalid ENUM rule", 40 | "prefix" : "116505551239", 41 | "regex" : "!\\+(^.*$)!sip:00\\1@ut.cw-ngv.com!" 42 | } 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /src/ut/acr_ibcforigcall_start.json: -------------------------------------------------------------------------------- 1 | { 2 | "peers": { 3 | "ccf":["192.1.1.1","192.1.1.2"], 4 | "ecf":["192.1.1.3","192.1.1.4"] 5 | }, 6 | "event": { 7 | "Accounting-Record-Type":1, 8 | "Acct-Interim-Interval":600, 9 | "Event-Timestamp":1, 10 | "Service-Information": { 11 | "Subscription-Id": [ 12 | { 13 | "Subscription-Id-Type":2, 14 | "Subscription-Id-Data":"sip:6505550000@homedomain" 15 | }, 16 | { 17 | "Subscription-Id-Type":0, 18 | "Subscription-Id-Data":"6505550000" 19 | } 20 | ], 21 | "IMS-Information": { 22 | "Event-Type": { 23 | "SIP-Method":"INVITE" 24 | }, 25 | "Role-Of-Node":0, 26 | "Node-Functionality":7, 27 | "User-Session-Id":"0123456789abcdef-10.83.18.38", 28 | "Calling-Party-Address": [ 29 | "sip:6505550000@homedomain","tel:6505550000" 30 | ], 31 | "Called-Party-Address":"sip:6505559999@homedomain", 32 | "Time-Stamps": { 33 | "SIP-Request-Timestamp":1, 34 | "SIP-Request-Timestamp-Fraction":0, 35 | "SIP-Response-Timestamp":1,"SIP-Response-Timestamp-Fraction":70 36 | }, 37 | "Inter-Operator-Identifier": [{ 38 | "Originating-IOI":"homedomain", 39 | "Terminating-IOI":"homedomain" 40 | }], 41 | "IMS-Charging-Identifier":"1234bc9876e", 42 | "Cause-Code":-1, 43 | "From-Address":"\"6505550000\" ;tag=12345678", 44 | "Route-Header-Received":"", 45 | "Route-Header-Transmitted":"", 46 | "Instance-Id":"" 47 | } 48 | } 49 | } 50 | } 51 | 52 | --------------------------------------------------------------------------------