Netgate m1n1wall

Author Topic: FreeSWITCH package for pfSense 1.2.1 and 2.0 released. PBX or Proxy  (Read 118388 times)

0 Members and 1 Guest are viewing this topic.

Offline mcrane

  • Sr. Member
  • ****
  • Posts: 495
  • Karma: +0/-0
    • View Profile
I have just released a FreeSWITCH package for pfSense 1.2.1 also works on pfSense 2.0. It requires pfSense 1.2.1 or higher because it was compiled for FreeBSD 7.


What FreeSWITCH can do for you:

SIP Proxy
Soft-Switch
B2BUA
PBX with:
  IVR (auto attendant)
  Voice Mail
  DISA (Direct inware system access)
  Conference Server
  Text to Speech
  Speech Recognition
  Auto Dialer
  Audio can be 8khz standard, wideband 16khz, or ultrawideband 32 khz
  SRTP Support
  TLS support

And best of all its customizable


New Screen Shots are available:
http://portableusbapps.com/images/FreeSWITCH/




General Info on FreeSWITCH
http://www.freeswitch.org/
http://wiki.freeswitch.org/wiki/Main_Page


SIP Proxy

http://wiki.freeswitch.org/wiki/Proxy_Media


PBX

To get started setting this up as a PBX setup a few extensions the default config accepts extension numbers between 1000 and 1019. The extension numbers can be changed are noted in the package GUI on how to make the change. Once you have setup an extension you can call Music on Hold by dialing 9999.

5000 Sample IVR
9996 for an echo test
9995 for a 5 second delay echo


Setup another extension with a phone and you can then call the other extension by its number.

To call out to public telephone numbers you will need a FXO or a VOIP provider. To configure a VOIP provider use the Gateway tab. The field names have been matched up to the xml tag names. Under Gateways (aka Providers) the field names match exactly with the xml tag names shown at: http://wiki.freeswitch.org/wiki/SIP_Provider_Examples this helps keep the documentation and examples on the wiki relevant to the pfSense FreeSWITCH package. The GUI has been built to increase your knowledge of the underlying XML config files.

Then to use the Gateway for an outbound call you need to direct the outgoing call to the gateway through the 'Dialplan' tab.
Here is an example for a gateway named asterlink.com you will want to put it near the bottom below hold_music and just above the warning message. Also remember to change asterlink.com to the name of your gateway (provider). Also replace the area code from my area code of 208 to match yours that will enable 7 digit local North American dialing.

^(\d{7})$ is a regular expression representing any 7 digit number.

    <extension name="asterlink.com">
      <condition field="destination_number" expression="^(\d{7})$">
        <action application="export" data="nolocal:absolute_codec_string=PCMU"/>
        <action application="bridge" data="sofia/gateway/asterlink.com/1208$1"/>
      </condition>
    </extension>
 
    <extension name="asterlink.com">
      <condition field="destination_number" expression="^(\d{10})$">
        <action application="export" data="nolocal:absolute_codec_string=PCMU"/>
        <action application="bridge" data="sofia/gateway/asterlink.com/1$1"/>
      </condition>
    </extension>

    <extension name="asterlink.com">
      <condition field="destination_number" expression="^(\d{11})$">
        <action application="export" data="nolocal:absolute_codec_string=PCMU"/>
        <action application="bridge" data="sofia/gateway/asterlink.com/$1"/>
      </condition>
    </extension>

To receive inbound calls you need to direct inbound numbers to your gateway you can do this by editing the config from the 'Public' tab. The default example is fairly intuitive I will expand on it a little first a term DID (direct inward dial) this is essentially the phone number the provider has given you.

The ^(5551212)$ is a regular expression representing the inbound phone number often this is a 10 digit number.
<condition field="destination_number" expression="^(5551212)$">

The transfer application example below is set to transfer the incoming call to extension 1000. This could also be an extension of given to an IVR under the 'Dialplan' tab.
      <action application="transfer" data="1000 XML default"/>

Additional Info
http://wiki.freeswitch.org/wiki/Getting_Started_Guide

That should be enough to get started and the wiki can take you even farther.
http://wiki.freeswitch.org/

Enjoy!


« Last Edit: December 13, 2008, 02:16:44 am by mcrane »

Offline jigpe

  • Sr. Member
  • ****
  • Posts: 371
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 released.
« Reply #1 on: October 07, 2008, 04:23:36 am »
Thanks master! Im exploring it now :)
You`re the man! :)

I`ll inform you the result of my explorations :)
Good luck!

jigpe




Offline greyman

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 released.
« Reply #2 on: October 09, 2008, 06:21:56 am »
I have installed freeswitch to look through its configuration on my pfsense installation (built on Wed Oct 8 17:46:25 EDT 2008 FreeBSD 7.0-RELEASE-p5). Once installed I noticed that it show up under services and can be controled but under packages is does not show up as installed or something to be installed.

Offline mcrane

  • Sr. Member
  • ****
  • Posts: 495
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 released.
« Reply #3 on: October 09, 2008, 12:35:22 pm »
You should see FreeSWITCH in the following locations:

//before installation
System -> Packages -> Available PFSense 1.2.1-RC1 packages

//after installation
System -> Packages -> Installed Packages
Services -> FreeSWITCH
Status -> Services

On my test systems it does show up under System -> Packages -> Installed Packages.

If for some reason you can't see it under: System -> Packages -> Installed Packages
You could try installing over top of it using:
http://x.x.x.x/pkg_mgr_install.php?id=FreeSWITCH
Change the x.x.x.x to the IP address of your pfSense firewall.
Make sure not to interrupt the package installation.
Then check again to see if is shows under 'Installed Packages'.








Offline tikid

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #4 on: October 28, 2008, 07:40:08 pm »
Great package so far...fighting with it a bit though.  Doesn't seem like it reloads the config when you save changes.  Is that desired behavior?

Offline mcrane

  • Sr. Member
  • ****
  • Posts: 495
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #5 on: October 28, 2008, 08:20:01 pm »
It runs FreeSWITCH's reloadxml on all changes which is good for re-reading the config. However for a new Gateway to be applied I have usually restarted FreeSWITCH. I've just asked on FreeSWITCH forum and they said a reloadxml then restart the sofia sip profile would work. I will get that changed soon.

Offline tikid

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #6 on: October 28, 2008, 08:34:06 pm »
Sounds good.  I confirmed that the reloadxml command is working, although it didn't work for me when adding extensions immediately after install, but that might just be FreeSwitch trying to be efficient and not having Sofia loaded (since I didn't have any sip devices listed prior to that), or who knows.  It's working now, so whatever.

Another question...you'll be getting several package bug reports from me (if there are any bugs and I'm not just being retarded. :) ), do you prefer I PM them to you?

#1: When changing the area code in the settings tab, 7 digit calls still get prepended with 918, due to the <X-PRE-PROCESS cmd="set" data="default_areacode=918"/> line in the VAR tab.  Should this be changed to the value from the Settings tab?  EDIT: I actually put $${default_areacode} in the area code field on the settings page...I figure that should pull it from the vars.xml file, where I have it set correctly.  Is this correct?  Also, what xml setting does the "area code" on the settings page change?

#2: In /usr/local/freeswitch/conf/dialplan/default/01_provider.com.xml, 10 digit calls just drop.  Adding the following section will fix that by prepending a 1, and sending the call out.
Code: [Select]
  <extension name="domestic.provider.com">
    <condition field="${toll_allow}" expression="domestic"/>
    <condition field="destination_number" expression="^(\d{10})$">
      <action application="set" data="effective_caller_id_number=$${outbound_caller_id_number}"/>
      <action application="set" data="effective_caller_id_name=$${outbound_caller_id_name}"/>
      <action application="bridge" data="sofia/gateway/${default_gateway}/1$1"/>
    </condition>
  </extension>

#3: I can't get the "say:" command in the IVR xml file to work.  I get the following error in the console:
Code: [Select]
2008-10-28 22:43:15 [ERR] mod_native_file.c:68 native_file_file_open() Error opening /usr/local/freeswitch/sounds/en/us/callie/say:Press 1 to join the conference, Press 2 to join the other conference.PCMU
#4: In /usr/local/freeswitch/conf/dialplan/default/01_provider.com.xml all the caller id setup is done with single dollar signs...IE, ${outbound_caller_id_number}.  I'm no FreeSwitch guru, so I can't explain why, but I can't pass callerid through Voicepulse to the PSTN until I change them all to double dollar signs, as I saw in the vars.xml file...note that I didn't add a dollar sign to ${default_gateway}, only the caller_id settings, and that's apparently working...I'm not sure what the difference is.

#5: In /usr/local/freeswitch/conf/dialplan/default/01_provider.com.xml all the caller id variables reference $${outbound_caller_id_number} or =$${outbound_caller_id_name}.  In the vars.xml file, the only caller id variables are outbound_caller_id and outbound_caller_name.  Until I assign my caller id data to the first variables, outbound_caller_id_number and outbound_caller_id_name, I can't pass callerid through Voicepulse to the PSTN.
« Last Edit: October 29, 2008, 05:46:04 am by thekod »

Offline mcrane

  • Sr. Member
  • ****
  • Posts: 495
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #7 on: October 31, 2008, 12:54:07 pm »
I have completed a few more changes to the package.
 
1. When adding a Gateway the following command is now called automatically through a socket connection.
sofia profile external rescan reloadxml
This will pick up new gateways that have been added or deleted and handle them appropriately without restarting FreeSWITCH. There still may be times a few times that require a restart for a gateway. I could have been more aggressive and had it run: sofia profile external restart reloadxml but that would interrupt current incoming/outgoing calls so I chose not to go that way.

2. Added a few more input fields for Gateways such as 'Realm' and 2 others fields in many cases this is not needed but I wanted to make sure that there is flexibility in GUI for special situations. If a field is left blank then the corresponding xml parameter tag will not be used in the config. The fields under the 'Gateways' tab match up exactly with the SIP provider examples at:
http://wiki.freeswitch.org/wiki/SIP_Provider_Examples

3. The 'Modules' tab has been changed from the original text area to a list in the GUI that allows you to enable or disable different modules. Note: not all modules are available in this build... an example would be Cepstral text to speech which doesn't have a native FreeBSD build. Flite text to speech is available if its modules is enabled.


Now to answer your questions...

Sounds good.  I confirmed that the reloadxml command is working, although it didn't work for me when adding extensions immediately after install, but that might just be FreeSwitch trying to be efficient and not having Sofia loaded (since I didn't have any sip devices listed prior to that), or who knows.  It's working now, so whatever.

Sofia (SIP) is loaded by default. If you restart FreeSWITCH under Services then you should check the Status tab to make sure that the sofia internal profile is loaded if it does not load it will say 'Invalid Profile!' This is caused from a port not closing by the time you restart FreeSWITCH. It can be solved by shutting down the service longer sometimes up to 2-5 minutes then starting it again. Rebooting will also work to clear that up.


Another question...you'll be getting several package bug reports from me (if there are any bugs and I'm not just being retarded. :) ), do you prefer I PM them to you?

If the information can be valuable to others then the forum. Items that are not likely to be useful to others you can pm me.

#1: When changing the area code in the settings tab, 7 digit calls still get prepended with 918, due to the <X-PRE-PROCESS cmd="set" data="default_areacode=918"/> line in the VAR tab.  Should this be changed to the value from the Settings tab?  EDIT: I actually put $${default_areacode} in the area code field on the settings page...I figure that should pull it from the vars.xml file, where I have it set correctly.  Is this correct?  Also, what xml setting does the "area code" on the settings page change?

$${default_areacode} in the area code field on the settings page should work fine.
The settings page populates the area code in the following xml file /usr/local/freeswitch/conf/directory/default/default.xml


#2: In /usr/local/freeswitch/conf/dialplan/default/01_provider.com.xml, 10 digit calls just drop.  Adding the following section will fix that by prepending a 1, and sending the call out.
Code: [Select]
  <extension name="domestic.provider.com">
    <condition field="${toll_allow}" expression="domestic"/>
    <condition field="destination_number" expression="^(\d{10})$">
      <action application="set" data="effective_caller_id_number=$${outbound_caller_id_number}"/>
      <action application="set" data="effective_caller_id_name=$${outbound_caller_id_name}"/>
      <action application="bridge" data="sofia/gateway/${default_gateway}/1$1"/>
    </condition>
  </extension>

This can also be done from the dialplan tab as noted in the this first message in this thread. As you have shown the caller id can also be done for all calls going outbound to the gateway with the 10 digits shown above.  The other method for caller id is per extension which can be done by setting the effective caller id on the 'Extension' tab.

#3: I can't get the "say:" command in the IVR xml file to work.  I get the following error in the console:
Code: [Select]
2008-10-28 22:43:15 [ERR] mod_native_file.c:68 native_file_file_open() Error opening /usr/local/freeswitch/sounds/en/us/callie/say:Press 1 to join the conference, Press 2 to join the other conference.PCMU

I have not worked with the XML IVR because I prefer doing the IVR in javascript. For help with the XML IVR see the wiki at http://wiki.freeswitch.org/

To see an example IVR in javascript.
http://wiki.freeswitch.org/wiki/Javascript_Examples look for the example ivrmenuofficehours.js link.

The sounds under /usr/local/freeswitch/sounds/en/us/callie/ are pre-recorded messages using Cepstral's text to speech engine.
At this time Cepstral does not have a native FreeBSD build. Alternatives are to pre-record messages on a different computer, use Flight text to speech engine, or make your own voice recordings.

#4: In /usr/local/freeswitch/conf/dialplan/default/01_provider.com.xml all the caller id setup is done with single dollar signs...IE, ${outbound_caller_id_number}.  I'm no FreeSwitch guru, so I can't explain why, but I can't pass callerid through Voicepulse to the PSTN until I change them all to double dollar signs, as I saw in the vars.xml file...note that I didn't add a dollar sign to ${default_gateway}, only the caller_id settings, and that's apparently working...I'm not sure what the difference is.

Looks like you found a missing $ in the default config. Next time I compile I will check to see if that has been corrected if not I will report it if you don't beat me to it.

#5: In /usr/local/freeswitch/conf/dialplan/default/01_provider.com.xml all the caller id variables reference $${outbound_caller_id_number} or =$${outbound_caller_id_name}.  In the vars.xml file, the only caller id variables are outbound_caller_id and outbound_caller_name.  Until I assign my caller id data to the first variables, outbound_caller_id_number and outbound_caller_id_name, I can't pass callerid through Voicepulse to the PSTN.

Vars.xml maps to the 'Vars' tab in the GUI. It sets up variables that can be used anywhere in the config. There may be some cases where the vairables are not being used anywhere in the config. FreeSWITCH is a young open source project and the configs are evolving and being improved over time.

Offline mcrane

  • Sr. Member
  • ****
  • Posts: 495
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #8 on: November 01, 2008, 01:11:33 am »
Added an option to the package to disable gateways without deleting them.

Offline mcrane

  • Sr. Member
  • ****
  • Posts: 495
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #9 on: November 02, 2008, 05:28:02 am »
A tip for those using this package. You can pickup your voicemail by dialing the extension number you are calling from. So for example if your extension is 1001 and you want to get your voicemail then from extension 1001 call 1001 and it will send you to your voicemail.

Alternative method to access voicemail is to dial extension 4000 followed by your extension number and the password.

GUI enhancements that are coming soon ...

1. Management tool for adding and removing recordings
2. Management tool to setup and configure an IVR (Auto Attendant)

Offline mcrane

  • Sr. Member
  • ****
  • Posts: 495
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #10 on: November 04, 2008, 03:19:16 am »
Minor version update. Added commands to the 'Status' tab to start, stop, restart, rescan, reloaxml and flush inbound registrations. Also found and corrected 2 minor issues with syntax.

Offline tikid

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #11 on: November 27, 2008, 03:16:30 am »
Thanks mcrane...this package rocks.

Offline mcrane

  • Sr. Member
  • ****
  • Posts: 495
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #12 on: November 28, 2008, 04:39:49 pm »
Thanks for the encouragement.

New version is almost ready. I will try my best to get it out by sometime tomorrow (Saturday 29 Nov 2008).


Offline scsikid

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #13 on: December 01, 2008, 03:52:06 pm »
was this updated over the weekend? it looks like it wasnt based on my packages list.

is there another way to check other than the packages list page within my pfsense?

Offline mcrane

  • Sr. Member
  • ****
  • Posts: 495
  • Karma: +0/-0
    • View Profile
Re: FreeSWITCH package for pfSense 1.2.1 and 1.3 released. PBX or Proxy
« Reply #14 on: December 01, 2008, 04:33:56 pm »
Sorry I missed my goal for weekend release still working on it. Should be soon.