Skip to main content

FreeSwitch Tips

FreeSwitch
FreeSwitch GUI
  • FusionPBX - FusionPBX can be used as a highly available single or domain based multi-tenant PBX, carrier grade switch,...
  • OV500 - OV500 is Open Source VoIP Billing switching and routing Solution.
FusionPBX

FusionPBX

NAT Setting

Web Admin > Advanced > Variables > IP Addresses

  • external_rtp_ip: <server-public-ip>
  • external_sip_ip: <server-public-ip>

重啟 freeswitch

systemctl restart freeswitch

驗證

Web Admin > Status > SIP Status

  • sofia status profile internal: ext-rtp-ip, ext-sip-ip
  • sofia status profile external: ext-rtp-ip, ext-sip-ip
RTP Port

/etc/freeswitch/autoload_configs/switch.conf.xml:

<!-- RTP port range -->
<!-- If no definitation the port range would be 16384 - 32768 -->
<param name="rtp-start-port" value="16384"/>
<param name="rtp-end-port" value="17000"/>
Gateway to Asterisk

On FreePBX

  1. Added a custom context 'from-ext-sip-server' with the module Custom Contexts.
  2. FreePBX Admin > Connectivity > Custom Contexts > Add Context
    • Context: from-ext-sip-server
    • Description: Whatever
    • Outbound Routes: <allow-some-route>
  3. Add Trunk
    • Trunk Name: fusionpbx
    • PEER Details:
host=sip.osslab.tw
type=peer
context=from-ext-sip-server
nat=yes
insecure=port,invite

On FusionPBX

Web Admin > Accounts > Gateways > Add

  • Gateway: myasterisk
  • Proxy: <my-asterisk-sip>
  • Register: False
  • Profile: external
  • Enable: Checked

Web Admin > Dialplan > Outbound Routes > Add

  • Gateway: myasterisk
  • Dialplan Expression: 9 Digits
  • Prefix: <blank>
  • Enable: True
Voicemail to Email

Web Admin > Accounts > Extensions > Select extension and Edit

  • Voicemail Mail to: <your-email-addr>

Web Admin > Advanced > Default Settings > Email

  • address_type: add_address
  • method: smtp
  • smtp_auth: True
  • smtp_from: <sender-from-addr>
  • smtp_from_name: <sender-from-name>
  • smtp_host: smtp-relay.sendinblue.com
  • smtp_username: <smtp-user>
  • smtp_password: <smtp-pass>
  • smtp_port: 587
  • smtp_secure: tls
  • smtp_validate_certificate: True

Send Test Email

Web Admin > Status > Email Logs > TEST

Bug Fixed:

[ERR] switch_cpp.cpp:1465 [database] can not bind parameter: undefined parameter: email_from

Edit /usr/share/freeswitch/scripts/resources/functions/send_mail.lua

if (email_from == nil or email_from == "") then
        email_from = settings:get('email', 'smtp_from', 'text');
        from_name = settings:get('email', 'smtp_from_name', 'text');
end
-- added by Alang
-- fixed: [ERR] switch_cpp.cpp:1465 [database] can not bind parameter: undefined parameter: email_from
email_from = 'noreply@your.domain';

if (email_from == nil or email_from == "") then
        email_from = address;
elseif (from_name ~= nil and from_name ~= "") then
        email_from = from_name .. "<" .. email_from .. ">";
end

FreeSwitch CLI

fs_cli

fs_cli -x "sofia status"
> sofia status
> sofia status profile internal reg
> show registrations

> /quit
> version
> show calls
> show channels

> reloadxml
> sofia profile external restart
> sofia profile external killgw gwt
> sofia profile external rescan
> reload
> reloadxml
> reloadacl
> reload <mod_name>
> show modules

> status
> eval $${external_sip_ip}
> fsctl shutdown restart


> domain_exists sip.osslab.tw
> module_exists mod_event_socket

PostgreSQL

su - postgres
psql fusionpbx

fusionpbx=# \dt
fusionpbx=# \d v_gateways
fusionpbx=# select * from v_gateways;
fusionpbx=# select * from v_default_settings where default_setting_category='email';