Local Version Install Guide with Postgres DB

Discussions about using SIP Sorcery on your own computer/server
Post Reply
jainpj
Posts: 173
Joined: Tue Dec 30, 2008 10:13 am

Local Version Install Guide with Postgres DB

Post by jainpj » Sun Dec 20, 2009 5:50 pm

PART A - Installl Postgres DB

A1. Create a standard windows account
username:
postgres
Password
xxxxxx

A2. Hide it from the user interface
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList
Create a DWORD value with name postgres and value = 0

A3. Install Postgres
Download the postgres files from here.
This package alreday contains a blank SIPSorcery db for version 1.1
Extract the PostgresSQL folder to D:\Program Files\PostgresSQL
Grant read access to the user postgres to the windows folder "D:\Program Files\PostgreSQL"
Grant modify access to the user postgres to the windows folder "D:\Program Files\PostgreSQL\8.3\data"

A4. Install Postgres service
Run CommandPrompt as Administrator
CD /d "D:\Program Files\PostgreSQL\8.3\bin"
pg_ctl register -N "postgresql-8.3" -D "D:/Program Files/PostgreSQL/8.3/data" -U postgres -P xxxxxx
xxxxxx is the password chooseb in step A1

A5. Add "Log on as a service" to the postgres user
Note: This is tricky under Vista Home Premium, but the hack below works well under both XP and Vista Ultimate/Home Premium.
Run services
Change the postgresl-8.3 service to "run as local system" and apply the changes
Change the postgresl-8.3 service to "run as .\postgres user" and apply changes
A dialog box "Log on as a service for the user postgres enabled" is displayed.
Press OK

A6. Kill all postgres process
From task manager
Click "Shown processes from all users"
Kill all processes with Image name postgres.

A7. Start the postgres service
From the services MMC
Start the postgres service.

A8. Change Postgres default password
The postgres db is set to default password postgres. To change it to password of your choice
Run D:\Program Files\PostgreSQL\8.3\Shortcuts\SQL Shell (psql).lnk
Press enter on server to accept localhost
Press enter on database to accept sipsorcery
press enter on Port to accept 5432
Press enter on username to accept postgres
Type the following command by replacing postgres_password with a password of your choice
alter user postgres with password 'postgres_password';
Close plsql window

A9. Configure pgAdmin III
Run D:\Program Files\PostgreSQL\8.3\Shortcuts\pgAdmin III.lnk
Click File->AddServer and fill the following details
Name = local
Host = localhost
Port = 5432
SSL = <blank>
Maintenance DB = postgres
Username = postgres
Password = xxxxxxx (as changed in previous step, or default is postgres)
Store Password = yes
Retreive env = yes
DB Restriction = <blank>
Connect Now = yes
Press Ok

A10. Set SIP Domain
Run D:\Program Files\PostgreSQL\8.3\Shortcuts\pgAdmin III.lnk
Goto sipsorcery database and select sipdomain table.
Right click sipdomain table and select viewdata.
If you have a domain name replace mydomain.com with your domain name under domain and alias fields
If you have a static public ip address replace 82.82.82.82 in the alias field with your public ip address
Replace 192.168.0.2 in alias field with the private ip address
Add any more aliases as you see fit
Note: The domain and its aliases are quite important to get incoming/outgoing calls to work. To consider what a domain or its aliases could be, first the address (ip address or the web url) must resolve to your computer, secondly it must be added in exactly the same way either as the domain name or one of its aliases. e.g. if you have added 192.168.0.2 (the pivate ip) as an alias then the client from inside the LAN can use 192.168.0.2 but not 192.168.0.2:5060, although 192.168.0.2:5060 will also resolve to the same machine but the sipsorcery server will reject the SIP as 192.168.0.2:5060 is not one of the domain or its aliases

PART B - Install SIP Sorcery Server

B1. Prepare Machine
Install .NET 3.5 SP1
Install Silverlight
Instal IIS

B2. Install SipSorcery
Download the sipsorcery release v1.1 files from here
Additionally you can patch this with patch 4914 for Goggle Voice fixes from here
Extract the SIPSorcery folder to D:\Program Files\SipSorcery
Grant read access to the user "LOCAL SERVICE" to the windows folder "D:\Program Files\SipSorcery"
Grant read access to the user "IIS_IUSRS" to the windows folder "D:\Program Files\sipsorcery"
Grant modify access to the user "LOCAL SERVICE" to the windows folder "D:\Program Files\SipSorcery\logs"

B4. Configure SIPSorcery
Replace <param name="File" value="C:\Temp\sipsorcery-v1.1\root.log" /> with <param name="File" value="D:\Program Files\sipsorcery\logs\root.log" />
Replace <param name="File" value="C:\Temp\sipsorcery-v1.1\error.log" /> with <param name="File" value="D:\Program Files\sipsorcery\logs\error.log" />
Replace the folllowing
<appSettings>
<add key="PersistenceStorageType" value="XML" />
<add key="PersistenceConnStr" value="C:\Temp\sipsorcery-v1.1\xmlconfig\" />
<!--<add key="PersistenceStorageType" value="DBLinqPostgresql" />
<add key="PersistenceConnStr" value="Database=sipsorcery;Host=localhost;User Id=postgres;Password=password" />-->
<!--<add key="PersistenceStorageType" value="DBLinqMySQL" />
<add key="PersistenceConnStr" value="Database=sipsorcery;Data Source=localhost;User Id=root;Password=tqbfjo55" />-->
<add key="UserDataDBType" value="MySQL" />
<add key="UserDataDBConnStr" value="Database=sipsorcery-userdata;Data Source=localhost;User Id=root;Password=tqbfjo55" />
<add key="HTTPServerBaseDirectory" value="C:\Temp\sipsorcery-v1.1\" />
</appSettings>

with (where xxxxx is the actual password of the DB user postgres as setup in step A8. Please note that the default password is postgres)
<appSettings>
<!--<add key="PersistenceStorageType" value="XML" />
<add key="PersistenceConnStr" value="D:\Program Files\sipsorcery\xmlconfig\" />-->
<add key="PersistenceStorageType" value="DBLinqPostgresql" />
<add key="PersistenceConnStr" value="Database=sipsorcery;Host=localhost;User Id=postgres;Password=xxxxxx" />
<!--<add key="PersistenceStorageType" value="DBLinqMySQL" />
<add key="PersistenceConnStr" value="Database=sipsorcery;Data Source=localhost;User Id=root;Password=password" />-->
<add key="UserDataDBType" value="Postgresql" />
<add key="UserDataDBConnStr" value="Database=sipsorcery;Host=localhost;User Id=postgres;Password=xxxxxxx" />
<add key="HTTPServerBaseDirectory" value="D:\Program Files\sipsorcery\" />
</appSettings>

Replace <ProxyScriptPath value="C:\Temp\sipsorcery-v1.1\proxyscript.py" /> with <ProxyScriptPath value="D:\Program Files\sipsorcery\proxyscript.py" />
If you have a static public IP replace <STUNServerHostname value="stun.xten.com" /> with <PublicIPAddress value="xxx.xxx.xxx.xxx" /> <!--STUNServerHostname value="stun.xten.com" /--> where xxx.xxx.xxx.xxx is the public IP address
Replace <SilverlightPolicyFilePath value="C:\Temp\sipsorcery-v1.1\silverlight-policy.xml" /> with <SilverlightPolicyFilePath value="D:\Program Files\sipsorcery\silverlight-policy.xml" />
Replace <TraceDirectory value="C:\Temp\sipsorcery-v1.1\traces\" /> with <TraceDirectory value="D:\Program Files\sipsorcery\traces\" />
Replace <RubyScriptCommonPath value="C:\Temp\sipsorcery-v1.1\dialplan-common.rby" /> with <RubyScriptCommonPath value="D:\Program Files\sipsorcery\dialplan-common.rby" />

B4. Install SIPSorcery service
Run CommandPrompt as Administrator
CD /d "D:\Program Files\SipSorcery"
For Vista: netsh http add urlacl url=http://+:8080/ user="NT Authority\Local Service"
Fox XP: httpcfg set urlacl /u http://+:8080/ /a D:(A;;GX;;;LS) (You may need to download httpcfg)
installutil sipsorcery-appsvr.exe

B5. Add "Log on as a service" to the Local Service user
Note: This is tricky under Vista Home Premium, but the hack below works well under both XP and Vista Ultimate/Home Premium.
Run services
Change the "SipSorcery App Server" service to "run as local system" and apply the changes
Change the "SipSorcery App Server" service to "run as "Local Service" (use blank password) and apply changes
A dialog box "Log on as a service for the user Local Service enabled" is displayed.
Press OK

B6. Configure IIS
Its nice to leave the default IIS website untouched, but configure it to some other port such as 8085 and create a new website for sipsorcery at port 80. Also note that the IIS allows opening the silver light web site on browser like chrome and firefox whereas the inbuilt web server does not work on Chrome.

-----------
On Vista
-----------
Change default website to use port 8085
Create new website SIP Sorcery at port 80, physical path D:\Program Files\sipsorcery
On Sip Sorcery website, add sipsorcery.html as default document and set it to first default document.

--------
On XP
--------
Creating two web sites on XP is tricky, buiut the hack below can be used to achieve this.
CD /d C:\Inetpub\AdminScripts
cscript.exe adsutil.vbs create_vserv W3SVC/2
cscript.exe adsutil.vbs copy W3SVC/1 W3SVC/2
There will be two default web site on IIS
Choose the first website and change the default port to 8085
Choose the second website and change name to SIP Sorcery and physical path to physical path D:\Program Files\sipsorcery
On second website, add sipsorcery.html as default document and set it to first default document.

Note: This step allows the silver light website to be accessed just by your domain/public IP from outside LAN and your private IP from inside LAN. Also form the same machine the silver light can be accessed by typing localhost on the web browser.

B7. Configure Port Forwarding
Open UDP 5060 and 5061 ports (for SIP traffic)
Open TCP 80 port (for IIS)
Open TCP 8080 port (for provisioning service)
Try opening TCP 4502 for Monitoring Console, but if it does not work from outside the LAN (quick way to check is to look at the top left corner of the web console from internet and if the text reads "Ready (auto refresh enabled)", it is working, otherwise it is not). If this does not work then you may need to put your computer under DMZ and protect your computer by enabling windows firewall and add sipsorcery and IIS application in the exception list of windows firewall or open the above listed ports.
Last edited by jainpj on Sun Feb 07, 2010 5:32 pm, edited 3 times in total.

jaminmc
Posts: 22
Joined: Tue Oct 13, 2009 8:24 pm

Post by jaminmc » Thu Jan 07, 2010 9:25 pm

Mediafile is down right now, so I havent been able to install postgres yet. I was wondering if there was a way to migrate from XML to postgres?

Also what is the advantage to running postgres? Is is more stable than using XML for its database?

jainpj
Posts: 173
Joined: Tue Dec 30, 2008 10:13 am

Post by jainpj » Thu Jan 07, 2010 10:40 pm

uploaded the Postgres files in FileFactory here.

There is not much advantage if you have small numbers of users, but I moved from XML to Postgres beacuse in the old days call history was not available in xml and also the postgres admin UI is much easier to manage data compare to in xml files.

There is no migration tool from xml to postgres but you can take your xml file and convert the data into sql statements like insert into table_name values(); etc.

jaminmc
Posts: 22
Joined: Tue Oct 13, 2009 8:24 pm

Post by jaminmc » Fri Jan 08, 2010 3:30 am

Got it to work! Glory!
My D: drive is my cdrom, and I already had sipsorcery installed in the c:\temp\sipsorcery-v1.1 so I put it in c:\temp\PostgreSQL, then I changed all the shortcuts to point there instead. Even changed them in the data\global\config_exec_params file, because the first time I did it, it didn't have any of the domains in there when I started the server.

At first the Calls didn't show up, but after a hour or 2, it started working right :)

jaminmc
Posts: 22
Joined: Tue Oct 13, 2009 8:24 pm

Post by jaminmc » Wed Mar 10, 2010 8:21 pm

Hos do you update the database for 1.2?

jainpj
Posts: 173
Joined: Tue Dec 30, 2008 10:13 am

Post by jainpj » Wed Mar 10, 2010 10:44 pm

I haven't seen 1.2 yet, but I guess there shall be an upgrade script that you can run from plsql Admin window.

`ariel
Posts: 2
Joined: Sat Nov 13, 2010 4:09 am

Re: Local Version Install Guide with Postgres DB

Post by `ariel » Sat Nov 13, 2010 4:26 am

I'm planning to get a local version of SS running and the question is, can be done on Windows Server 2008 R2 ?
It's gonna be hosted on a DC as a VM on ESXi and WS2008R2 is the only .iso image over there available for install..
however.. I'm gonna try... :D

affinity
Posts: 27
Joined: Fri Dec 16, 2011 5:52 pm

Re: Local Version Install Guide with Postgres DB

Post by affinity » Sun Dec 18, 2011 4:59 am

Those look like great instructions. Is there any recipe for a Linux server, preferably Debian based or Debian stable itself?

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Local Version Install Guide with Postgres DB

Post by Aaron » Mon Dec 19, 2011 9:36 am

I personally haven't tested the sipsorcery application on a Linux server for a few years now. There is someone on the forum who posted they are doing so. Perhaps start a separate thread and ask if anyone can give some hints for getting up & running with sipsorcery on Linux.

Post Reply