diff --git a/.gitignore b/.gitignore index d833a11..2cec9aa 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,7 @@ gcp.json data_volume/ -tmpAudio/ \ No newline at end of file +tmpAudio/ + +.idea +*.iml \ No newline at end of file diff --git a/packer/jambonz-feature-server/files/mrf_sip_profile.xml b/packer/jambonz-feature-server/files/mrf_sip_profile.xml index ba7559c..03bc32a 100644 --- a/packer/jambonz-feature-server/files/mrf_sip_profile.xml +++ b/packer/jambonz-feature-server/files/mrf_sip_profile.xml @@ -9,7 +9,7 @@ - + @@ -18,7 +18,8 @@ - + + diff --git a/packer/jambonz-feature-server/scripts/install_datadog.sh b/packer/jambonz-feature-server/scripts/install_datadog.sh index a4a3ea2..ca2f5bb 100755 --- a/packer/jambonz-feature-server/scripts/install_datadog.sh +++ b/packer/jambonz-feature-server/scripts/install_datadog.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ "$1" == "yes" ]; then +if [ "$DD_INSTALL" == "yes" ] && [ "$DD_KEY" != "" ]; then echo installing datadog... - DD_INSTALL_ONLY=true DD_API_KEY=your-dd-key-here bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)" + DD_INSTALL_ONLY=true DD_API_KEY=${DD_KEY} bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)" fi \ No newline at end of file diff --git a/packer/jambonz-feature-server/scripts/install_freeswitch.sh b/packer/jambonz-feature-server/scripts/install_freeswitch.sh index cc830bc..6081fa7 100644 --- a/packer/jambonz-feature-server/scripts/install_freeswitch.sh +++ b/packer/jambonz-feature-server/scripts/install_freeswitch.sh @@ -130,8 +130,9 @@ sudo cp /usr/local/src/freeswitch/conf/vanilla/autoload_configs/modules.conf.xml sudo cp /tmp/freeswitch.service /etc/systemd/system sudo chown root:root -R /usr/local/freeswitch sudo chmod 644 /etc/systemd/system/freeswitch.service -sudo sed -i -e 's/global_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8/global_codec_prefs=PCMU,PCMA,OPUS,G722/g' /usr/local/freeswitch/conf/vars.xml -sudo sed -i -e 's/outbound_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8/outbound_codec_prefs=PCMU,PCMA,OPUS,G722/g' /usr/local/freeswitch/conf/vars.xml +sudo sed -i -e "s/global_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8/global_codec_prefs=${PREFERRED_CODEC_LIST}/g" /usr/local/freeswitch/conf/vars.xml +sudo sed -i -e "s/outbound_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8/outbound_codec_prefs=${PREFERRED_CODEC_LIST}/g" /usr/local/freeswitch/conf/vars.xml +sudo sed -i -e "s/outbound_codec_prefs=PCMU,PCMA,OPUS,G722/a " /usr/local/freeswitch/conf/vars.xml sudo systemctl enable freeswitch sudo cp /tmp/freeswitch_log_rotation /etc/cron.daily/freeswitch_log_rotation sudo chown root:root /etc/cron.daily/freeswitch_log_rotation diff --git a/packer/jambonz-feature-server/template.json b/packer/jambonz-feature-server/template.json index b67db8c..6e78a39 100644 --- a/packer/jambonz-feature-server/template.json +++ b/packer/jambonz-feature-server/template.json @@ -2,12 +2,15 @@ "variables": { "region": "us-east-1", "ssh_username": "admin", - "ami_description": "jambonz feature server", + "ami_description": "jambonz feature server", "instance_type": "t2.xlarge", "drachtio_version": "v0.8.13-rc1", "jambonz_version": "v0.6.7-rc8", "install_telegraf": "yes", - "install_datadog": "no" + "install_datadog": "no", + "datadog_key" : "", + "mediaserver_name" : "jambonz", + "preferred_codec_list" : "PCMU,PCMA,OPUS,G722" }, "builders": [{ "type": "amazon-ebs", @@ -63,8 +66,8 @@ "ssh-keyscan github.com >> ~/.ssh/known_hosts", "mkdir ~/apps", "cd ~/apps", - "git clone git@github.com:jambonz/jambonz-feature-server.git -b {{user `jambonz_version`}}", - "git clone git@github.com:jambonz/fsw-clear-old-calls.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/jambonz-feature-server.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/fsw-clear-old-calls.git -b {{user `jambonz_version`}}", "sudo find / -name authorized_keys | sudo xargs -0 -r rm -Rf" ] }, @@ -83,7 +86,11 @@ }, { "type": "shell", - "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_datadog`}}", + "environment_vars": [ + "DD_KEY={{user `datadog_key`}}", + "DD_INSTALL={{user `install_datadog`}}" + ], + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}'", "script": "scripts/install_datadog.sh" }, { @@ -93,6 +100,10 @@ }, { "type": "shell", + "environment_vars": [ + "MEDIA_SERVER_NAME={{user `mediaserver_name`}}", + "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}" + ], "script": "scripts/install_freeswitch.sh" }, { diff --git a/packer/jambonz-sbc-rtp/scripts/install_datadog.sh b/packer/jambonz-sbc-rtp/scripts/install_datadog.sh index a4a3ea2..ca2f5bb 100755 --- a/packer/jambonz-sbc-rtp/scripts/install_datadog.sh +++ b/packer/jambonz-sbc-rtp/scripts/install_datadog.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ "$1" == "yes" ]; then +if [ "$DD_INSTALL" == "yes" ] && [ "$DD_KEY" != "" ]; then echo installing datadog... - DD_INSTALL_ONLY=true DD_API_KEY=your-dd-key-here bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)" + DD_INSTALL_ONLY=true DD_API_KEY=${DD_KEY} bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)" fi \ No newline at end of file diff --git a/packer/jambonz-sbc-rtp/template.json b/packer/jambonz-sbc-rtp/template.json index cdebf49..675e1dc 100644 --- a/packer/jambonz-sbc-rtp/template.json +++ b/packer/jambonz-sbc-rtp/template.json @@ -10,6 +10,7 @@ "rtp_engine_min_port": "40000", "rtp_engine_max_port": "60000", "install_datadog": "no", + "datadog_key" : "", "install_telegraf": "yes" }, "builders": [{ @@ -81,7 +82,11 @@ }, { "type": "shell", - "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_datadog`}}", + "environment_vars": [ + "DD_KEY={{user `datadog_key`}}", + "DD_INSTALL={{user `install_datadog`}}" + ], + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}'", "script": "scripts/install_datadog.sh" }, { diff --git a/packer/jambonz-sbc-sip/scripts/install_datadog.sh b/packer/jambonz-sbc-sip/scripts/install_datadog.sh index ddca0d0..ca2f5bb 100755 --- a/packer/jambonz-sbc-sip/scripts/install_datadog.sh +++ b/packer/jambonz-sbc-sip/scripts/install_datadog.sh @@ -1,6 +1,6 @@ #!/bin/bash +if [ "$DD_INSTALL" == "yes" ] && [ "$DD_KEY" != "" ]; then + echo installing datadog... -if [ "$1" == "yes" ]; then - - DD_INSTALL_ONLY=true DD_API_KEY=your-dd-key-here bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)" -fi + DD_INSTALL_ONLY=true DD_API_KEY=${DD_KEY} bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)" +fi \ No newline at end of file diff --git a/packer/jambonz-sbc-sip/template.json b/packer/jambonz-sbc-sip/template.json index 0e5f3d2..38fb3c7 100644 --- a/packer/jambonz-sbc-sip/template.json +++ b/packer/jambonz-sbc-sip/template.json @@ -7,6 +7,7 @@ "drachtio_version": "v0.8.13-rc1", "jambonz_version": "v0.6.7-rc8", "install_datadog": "no", + "datadog_key" : "", "install_telegraf": "yes" }, "builders": [{ @@ -87,7 +88,11 @@ }, { "type": "shell", - "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_datadog`}}", + "environment_vars": [ + "DD_KEY={{user `datadog_key`}}", + "DD_INSTALL={{user `install_datadog`}}" + ], + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}'", "script": "scripts/install_datadog.sh" }, {