Tomcat -Virtual hosts and Access logging

In CategoryComputer Networks, Linux
Bysreekanth

Some times we may need to run multiple websites on single ip address with the same port number ,for example http( tcp-80 ) port .

If I have 2 websites called  www.example1.com and  www.example2.com pointing to same webserver 10.0.0.10,  then i will configure my tomcat webserver( 10.0.0.10 )following way .

 

Using vim editor i will  edit /tomcat_directory/conf/server.xml and add seperate  virtual host entries for each domain .

 

<Host name=”www.example1.com” debug=”0″ appBase=”example1″
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”.”/>
<Logger className=”org.apache.catalina.logger.FileLogger”
directory=”logs” prefix=”localhost_log.” suffix=”.txt”
timestamp=”true”/>
<Valve className=”org.apache.catalina.valves.AccessLogValve” directory=”logs”

prefix=”localhost_access_log.” suffix=”.txt” pattern=”common” resolveHosts=”false”/>

<Host name=”www.example2.com” debug=”0″ appBase=”example2″
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>
<Context path=”” docBase=”.”/>
<Logger className=”org.apache.catalina.logger.FileLogger”
directory=”logs” prefix=”localhost_log.” suffix=”.txt”
timestamp=”true”/>
<Valve className=”org.apache.catalina.valves.AccessLogValve” directory=”logs”

prefix=”localhost_access_log.” suffix=”.txt” pattern=”common” resolveHosts=”false”/>

</Host>

</Engine>

</Service>

</Server>

 

 

example1 and example2  are root directories  where we  can copy webpages .

<Valve className=”org.apache.catalina.valves.AccessLogValve” directory=”logs”

prefix=”localhost_access_log.” suffix=”.txt” pattern=”common” resolveHosts=”false”/>  ……. this entry will log  website access logs  in /tomcat_directory/logs .

 

 

A2billing and Astersik

In CategoryVoice Over IP
Bysreekanth

Finallly I got the Asterisk+freeswitch  in a single system up and running  with fusion pbx as front end for freeswitch  and A2billing for Astersik .

You may wonder why we needed this complicated  single box all-in one setup . I wanted to use this setup for our office internal PBX   as well as integrating DID number purchase panel and for international calls.

 

 

I have got few issues while configuring  this system .

Issue 1 :

 

After installing freepbx and asterisk on teh same system i wanted to change free switch sip port from 5060 to any other port  as asterisk is already using the port 5060 .

So i edited the file vars.xml

# vi /usr/local/freeswitch/conf/vars.xml

 

Issue2:

Just after installing a2billing , i renamed the default web directory  /var/www/html/a2billing  to something else  and  it caused the extensions/pins i created not registering and I could not reload asterisk from a2billing interface .

I realized that this is  because of missing short link for /var/lib/asterisk/agi-bin/lib -> /var/www/html/renamed/common/lib

# cd /var/lib/asterisk/agi-bin

#ln -s /var/www/html/a2billing/common/lib  lib

 

 Issue 3:

I wanted a2billing take care of asterisk configuration files and not to restart asterisk manually when there is a change ,

for this i turn of  “Asterisk real time” in system settings –>global list —>global

use_realtime=NO

 

Issue4:

Every-time I place a outbound call , a2billing plays the audio saying ” enter the number you wish to dial and press the pound key”. I dont want this but  place the calls directly .

under systemsettings–>Global list –> Agi-conf1  , I changed below values to ‘NO’

play_audio=no

say_timetocall =no
say_balance_after_auth=no
say_balance_after_call=no
say_rateinitial=no

 

Issue 5:

By enabling debug level =4  in agi-conf , I understood why my outbound calls are not connecting .

by disabling caller id authentication in agi-conf,  i made it work finally .

cid_enable = NO

below is the log from a2billing log files

 

#tail -f  /var/log/a2billing/a2billing_agi.log

[03/11/2012 18:25:33]:[file:Class.A2Billing.php – line:2807 – uniqueid:1351947326.58]:[CallerID:27071]:[CN:27071]:[[SET CHANNEL(language) en]]

[03/11/2012 18:25:33]:[file:Class.A2Billing.php – line:2811 – uniqueid:1351947326.58]:[CallerID:27071]:[CN:27071]:[[credit= :: tariff= :: status= :: isused= :: simultaccess= :: typepaid=0 :: creditlimit=0 :: language=en]]
[03/11/2012 18:25:33]:[file:Class.A2Billing.php – line:2850 – uniqueid:1351947326.58]:[CallerID:27071]:[CN:27071]:[[ERROR CHECK CARD : prepaid-auth-fail (cardnumber:27071)]]
[03/11/2012 18:25:33]:[file:a2billing.php – line:178 – uniqueid:1354547326.58]:[CallerID:27071]:[CN:27071]:[[TRY : callingcard_ivr_authenticate]]
[03/11/2012 18:25:33]:[file:a2billing.php – line:620 – uniqueid:1354547326.58]:[CallerID:27071]:[CN:27071]:[[AUTHENTICATION FAILED (cia_res:-2)]]
[03/11/2012 18:25:33]:[CallerID:27071]:[CN:27071]:[[exit]]