Category Archives: Howto’s

udpxy

So, i had the need to convert IPTV multicast effeciently to HTTP.

Luckily i found udpxy.
As on their home page:
“udpxy is a UDP-to-HTTP multicast traffic relay daemon: it forwards UDP traffic from a given multicast subscription to the requesting HTTP client”

Installation:

wget http://www.udpxy.com/download/1_23/udpxy.1.0.23-7-prod.tar.gz
tar -xvf udpxy.1.0.23-7-prod.tar.gz
cd udpxy-1.0.23-7/
make
make install
make -n install

Options provided by this version:

root@vidserv:~# udpxy
udpxy 1.0-23.7 (prod) standard [Linux 3.2.0-39-generic x86_64]
usage: udpxy [-vTS] [-a listenaddr] -p port [-m mcast_ifc_addr] [-c clients] [-l logfile] [-B sizeK] [-n nice_incr]
        -v : enable verbose output [default = disabled]
        -S : enable client statistics [default = disabled]
        -T : do NOT run as a daemon [default = daemon if root]
        -a : (IPv4) address/interface to listen on [default = 0.0.0.0]
        -p : port to listen on
        -m : (IPv4) address/interface of (multicast) source [default = 0.0.0.0]
        -c : max clients to serve [default = 3, max = 5000]
        -l : log output to file [default = stderr]
        -B : buffer size (65536, 32Kb, 1Mb) for inbound (multicast) data [default = 2048 bytes]
        -R : maximum messages to store in buffer (-1 = all) [default = 1]
        -H : maximum time (sec) to hold data in buffer (-1 = unlimited) [default = 1]
        -n : nice value increment [default = 0]
        -M : periodically renew multicast subscription (skip if 0 sec) [default = 0 sec]
Examples:
  udpxy -p 4022
        listen for HTTP requests on port 4022, all network interfaces
  udpxy -a lan0 -p 4022 -m lan1
        listen for HTTP requests on interface lan0, port 4022;
        subscribe to multicast groups on interface lan1


To execute:

udpxy -p 4022

This will show proxy status in your browser:
http://192.168.0.12:4022/status/

This will open a multicast stream meant for 239.1.1.39:1234 and make it available via http.
You can open this url with VLC and it should work.
http://192.168.0.12:4022/udp/239.1.1.39:1234

I think this is also really interesting:
http://xupnpd.org/t/#About_xupnpd

Asterisk integration with Huawei Soft-Switch

I needed to configure a SIP trunk with Asterisk to a provider using a Huawei soft switch.

It was not painless….

Firstly there was a well known error regarding silence suppression:

In the SIP INVITE asterisk sends: “a=silenceSupp:off – – – – –

It is too difficult for Huawei’s coders to accomodate this, so it sends back:

Got SIP response 500 “Server Internal Error” back from XXX.XXX.XXX.XXX

So the way this can be circumvented is by doing this:

So my example use asterisk 10.2.0

Go look at your asterisk source file in chan_sip.c around line 11814

 

Comment out this section:

/* ast_build_string(&a_audio_next, &a_audio_left, "a=silenceSupp:off - - - - -\r\n"); */


Recompile and install.
Now that has fixed the problem with the silence suppression.

Another error appeared that the Huawei soft switch is quite pedantic with session expiry.

Outgoing calls from asterisk to Huawei will work, but incoming calls will be dropped when answered.
this is due to this sip communication:

This is fixed by adding : session-timers=refuse” in my sip.conf

sip.conf file that works for me:

[myprovider]
type=peer
host=XX.XX.6.5
disallow=all
allow=g729
allow=alaw
insecure=port,invite
qualify=yes
nat=no</span>
context=from-myprovider
canreinvite=no
t38pt_udptl = yes
session-timers=refuse

Time will tel how stable this config is, but it looks promising.
Hope this helps somebody out there.

 

Xen based Windows 2003 Server VM

Recently i had to deploy a win2k3 server on  Xen.

I had a few problems along the way.
1. Had a dog-slow old Centos 5.4 based server with several vm’s running on it.
2. Had to relocate one image to a new faster server via disk backup because of various reasons.
3. Had to import an existing Xen production image to the new server.
4. The new faster Centos 5.6 based server was a standard install and not installed with Xen.

So here goes:

Shutdown host on existing server.
command: virsh shutdown mymachine (mymachine the host to be moved)

Backup to external drive witch is formatted with ntfs.
For this to work i needed fuse and fuse-ntfs.

Install rpmforge
rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
yum install fuse fuse-ntfs-3g dkms dkms-fuse

 

Backup existing image
cp -v /var/lib/xen/images/mymachine.img /mnt/exthdd/
umount /mnt/exthdd

Change existing Centos install to Xen host.

yum update
reboot if newer kernel was installed

Install Xen
yum groupinstall virtualization
chkconfig xend on
chkconfig libvirtd on

After reboot, edit the grub configuration file to make sure the system boots with xen based kernel.
vi /boot/grub/grub.conf and set the xen based kernal as the default. In this case 1

##############################################################
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda3
#          initrd /initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-238.12.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-238.12.1.el5 ro root=LABEL=/
initrd /initrd-2.6.18-238.12.1.el5.img
title CentOS (2.6.18-238.12.1.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-238.12.1.el5
module /vmlinuz-2.6.18-238.12.1.el5xen ro root=LABEL=/
module /initrd-2.6.18-238.12.1.el5xen.img
title CentOS (2.6.18-238.9.1.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-238.9.1.el5
module /vmlinuz-2.6.18-238.9.1.el5xen ro root=LABEL=/
module /initrd-2.6.18-238.9.1.el5xen.img
title CentOS (2.6.18-238.9.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-238.9.1.el5 ro root=LABEL=/
initrd /initrd-2.6.18-238.9.1.el5.img
title CentOS (2.6.18-194.32.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.32.1.el5 ro root=LABEL=/
initrd /initrd-2.6.18-194.32.1.el5.img
##############################################################

Reboot

Check if you are running xen kernel.
Linux myserver 2.6.18-238.12.1.el5xen #1 SMP Tue May 31 14:02:29 EDT 2011 x86_64 x86_64 x86_64  GNU/Linux

Test host disk performance.

Test 1:
#hdparm -tT /dev/sda1

/dev/sda1:
Timing cached reads:   3696 MB in  2.00 seconds = 1847.92 MB/sec
Timing buffered disk reads:  100 MB in  1.19 seconds =  84.15 MB/sec

Pretty descent.

Test 2:
#dd if=/dev/zero of=./test1024M bs=1024k count=1024 conv=fsync
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 16.5377 seconds, 64.9 MB/s

Also pretty descent.

Restore image from backup on new server:

cp -v mymachine.img /var/lib/libvirt/images/

Import existing disk image with Virtual Machine Manager. I used VMM with Ubuntu Maverick Meerkat.

The Windows 2003 server was now up and running after assigning 1 CPU and 1024Mb of ram to the Virtual Machine with VM Manager.

Performance was however still sluggish with high (up to 60.5%wa) in top. Write speed was terrible to say the least.

Found a post on another forum telling me to disable ACPI.

“If your Windows installation is set to use ACPI (this is the default), kvm can be quite slow or not work at all. This is due to Windows heavily using a register that has a very large virtualization penalty.

Fortunately, there is a simple workaround available: disable ACPI support in Windows. The procedure for doing this is:

Select “My Computer” with the right mouse button.
Select “Properties”.
Choose the “Hardware” tab.
Click the “Device Manager” button.
Select the entry under “Computer” with the right mouse button. If it says “Standard PC”, then there’s no need to do anything.
Select “Properties”
Click the “Update Driver” button.
Choose “No, not this time” and click “Next”.
Choose “Install from a list” and click “Next”.
Choose “Don’t search” and click “Next”.
Click “Next”.
Choose “Standard PC” and click “Next”.
Continue clicking “Next” and reboot the virtual machine.
If you’re installing Windows XP/2000, you can get it to use the Standard PC HAL by pressing F7 when it asks for drivers (”Press F6 for…”), there is no visual indication. If you would rather select the right HAL from a list visually then press F5 instead.”

BTW: Thanx for the info testy http://www.peakscale.com/archives/gridvm/xen-vs-kvm/

Then, i installed the Xen drivers found at http://wiki.xensource.com/xenwiki/XenWindowsGplPv
This case i used: http://www.meadowcourt.org/downloads/gplpv_2003x32_0.11.0.238.msi as i was using a 32 bit version of Win2k3.

Results:
Local Backup on the Win2k3 VM using Uranium Backup free before migration:  “Time taken for last execution: 6 Hours, 39 Minutes, 35 Seconds”

Local Backup on the Win2k3 VM using Uranium Backup free after migration, disabling ACPI and installing Xen drivers:  “Time taken for last execution: 0 Hours, 4 Minutes, 53 Seconds”

Size ~ 4Gig

References:
http://southbrain.com/south/2009/08/xen-drivers-for-windows-2003-m.html
http://blog.surfulater.com/2007/01/10/xen-and-the-art-of-virtualization/