Hi am trying to compile this but am getting segmentation error. The program consists of running multiple Voice and Video session..it would be a great if some one helps me Thanks


**************************************
#**********Voice + Video**************
#**************************************

set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;#radio propagation model
set val(netif) Phy/WirelessPhy ;#network interface type
set val(mac) Mac/802_11e
set val(ifq_) Queue/DTail/PriQ ;#MAC type
set val(ll) LL
set val(ant) Antenna/OmniAntenna
set val(X) 700
set val(Y) 700
set val(ifqlen) 50 ;#MAX packet in ifq
set val(seed) 0.0 ;#for random generator
set val(adhocRouting) DSDV ;#Routing Protocol
set val(nn) 4 ;#No.mobile nodes
set val(cp) "" ;
set val(stop) 300 ;
set val(ftp1-start) 160 ;#start
set val(ftp2-start) 170 ;#stop of ftp
set num_wired_nodes 4 ;#number of wired nodes
set num_base_nodes 1 ;#number of base nodes
set val(starttime) 0.2




#**********************New simulator*************
#************************************************
set ns [new Simulator]

#**********************************************





#********Set up Hierarcical routeup***********
$ns node-config -addressType hierarchical
AddrParams set domain_num_ 2 ;#No of Domains(1 wire/1 wl)
lappend cluster_num 1 1 ;#no of cluster in each domain
AddrParams set cluster_num $cluster_num
lappend nodes_num 4 4] ; #No of nodes in each cluster
AddrParams set nodes_num $nodes_num ;#for each domain


#**********Set up trace files***********************
set tracefd [open WL.tr w]
set namtrace [open WL.nam w]
$ns use-newtrace
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(X) $val(Y)




#**********create GOD instance************************
#************************************************* ****
create-god [expr $val(nn) + $num_base_nodes]




#*************create wired nodes****************************************

set bk_server [$ns node 0.0.0] ;#hierarchical addresses to b used
set router [$ns node 1.0.0]; #create Router

for {set i 0} {$i < [expr $num_wired_nodes]} {incr i} {
set WN($i) [$ns node 1.0.expr $i]
}


#*************Create Topology***********************

set topo [new Topography];#creat topology object
$topo load_flatgrid $val(X) $val(Y) ;#create topology





#************configure for base station*********************************
$ns node-config -adhocRouting $val(adhocRouting) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq_) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan) \
-topoInstance $topo \
-wiredRouting ON \
-agentTrace ON \
-routerTrace OFF \
-macTrace OFF \


set rng [new RNG]
$rng seed 0


#**************create base station************************************
set temp {1.0.1} ;#hier address to b used
set base_station [$ns node [lindex $temp 0]]
$base_station random-motion 0 ; #disable random motion
$base_station set X_ 1.0
$base_station set Y_ 2.0
$base_station set Z_ 0.0




#**************configure for mobilenodes******************************
$ns node-config -wiredRouting OFF



#***************Now create mobilenodes**************************************

for {set i 0} {$i < $val(nn)} {incr i} {

set WLN($i) [ $ns node 1.0.[expr $i] ]
$WLN($i) base-station [AddrParams addr2id [$base_station node-addr]]
$WLN($i) random-motion 0;
$WLN($i) set X_ [$rng integer 150] ;# Place in Random position along X axis
$WLN($i) set Y_ [expr 0 - [$rng integer 150]] ;# Place in Random position along Y axis
$WLN($i) set Z_ 0.0
$ns initial_node_pos $WLN($i) 0
}






#for {set j 0} {$j < [expr $val(nn)]} {incr j} {
#set node_($j) [$ns node [lindex $temp \ [expr $j+1] ] ]
#$node_($j) base-station [AddrParams addr2id \ [$base_station node-addr]] ; #Provides each nodes with hier add of base station
#}








#**************Connection between wired nodes and Base station ********

#***************Links between Router and Web_servers*******************

for {set i 0} {$i <[expr $num_wired_nodes]} {incr i} {

$ns duplex-link $WN($i) $router 3Mb 20ms DropTail

$ns duplex-link-op $router $WN($i) orient down
}

puts "111111222211111..."



#***************Link between Router and Base station*******************

$ns duplex-link $router $base_station 10Mb 5ms DropTail
$ns duplex-link-op $base_station $router orient up


for {set i 0} {$i < [expr $num_wired_nodes-2]} {incr i} {
$ns duplex-link $WN($i) $base_station 3Mb 20ms DropTail
$ns duplex-link-op $WN($i) $base_station orient down
}

puts "111111222211111..."


#*********Set up TCP connection between server and Wirelessstation*******


for {set i 0} {$i <[expr $num_wired_nodes-2]} {incr i} {

puts "3331111222211111..."
set tcp($i) [new Agent/TCP]
$tcp($i) set class_ 1
######$tcp class_ 1
set sink($i) [new Agent/TCPSink]
$ns attach-agent $bk_server $tcp($i)
$ns attach-agent $WLN($i) $sink($i)
$ns connect $tcp($i) $sink($i)

set ftp($i) [new Application/FTP]
$ftp($i) attach-agent $tcp($i)
#$ns at 5.0 "$ftp start"

puts "111111111111111..."


set null($i) [new Agent/Null]
$ns attach-agent $WLN($i) $null($i)
$ns connect $tcp($i) $null($i)
set video($i) [new Application/Traffic/CBR]
$video($i) set packetSize_ 250
$video($i) set rate_ 64
$video($i) attach-agent $tcp($i)

puts "111111111111111..."

for {set j 0} {$j < 3} {incr j} {
$ns at $val(starttime).2 "$video($i) start"
}
for {set j 3} {$j < [expr $num_wired_nodes-2]} {incr j} {
$ns at $val(starttime).0 "$video1($i) start"
}
}



#***********set up UDP connections**************************************

for {set i 0} {$i < [expr $num_wired_nodes-2]} {incr i} {
set udp($i) [new Agent/UDP]
$udp($i) set prio_ 0
$udp($i) set class_ 1 # [expr $i + 1]
$ns attach-agent $WLN([expr $i+1]) $udp($i)

set null($i) [new Agent/Null]
$ns attach-agent $WN($i) $null($i)
$ns connect $udp($i) $null($i)
set voice($i) [new Application/Traffic/CBR]
$voice($i) set packetsize_ 160
$voice($i) set rate_ 64Kb
$voice($i) attach-agent $udp($i)

$ns at val(starttime).1 "voice2($i) start"
}


#**************************** NAME NODES *********************************

$ns at 0.0 "$bk_server label BK-Server"
$ns at 0.0 "$router label Router"

for {set i 0} {$i < [expr $num_wired_nodes-2] } {incr i} {
$ns at 0.0 "$WN($i) label WN_[expr $i + 1]"
}


$ns at 0.0 "$base_station label AP"
$ns at 0.0 "$WLN(0) label BK-Client"

for {set i 0} {$i < $val(nn) } {incr i} {
$ns at 0.0 "$WLN($i) label WLN_$i"
}


#***************** When the simulation ends ****************************

$ns at $val(stop).0 "$base_station reset";
$ns at $val(stop).0 "$router reset";
$ns at $val(stop).0 "$bk_server reset";

for {set i 0} {$i < $val(nn) } {incr i} {
$ns at $val(stop).0 "$WLN(0) reset";
}

for {set i 0} {$i < [expr $num_wired_nodes - 2] } {incr i} {
$ns at $val(stop).0 "$WN($i) reset"
}

$ns at $val(stop).0002 "stop"

$ns at $val(stop).0003 "puts \"NS EXITING...\" ; $ns halt"




proc stop {} {
global ns_ tracefd namtrace
close $tracefd
close $namtrace

}
#************************************************* *************************************



puts "Starting Simulation..."

$ns run