configuring 2 digium card in single system? - asterisk

I have two digium cards ,models are TE420 4 port card,TE121 single port card.
After the configuration 4 port card
if i execute "dahdi show status" in asterisk prompt , I got following output
Description Alarms IRQ bpviol CRC4
T4XXP (PCI) Card 0 Span 1 OK 46 0 0
T4XXP (PCI) Card 0 Span 2 OK 46 0 0
T4XXP (PCI) Card 0 Span 3 OK 46 0 0
T4XXP (PCI) Card 0 Span 4 OK 46 0 0
Wildcard TE121 card 0 OK 32457 0 0
Why I am not getting the Span 5 for the single port card.

check by typing pri show spans in asterisk cli
and also in linux shell type dahdi_cfg -vvvv it will output all the channesl configured

The description you see there is the span description filled in by the DAHDI drivers for each span. When they fill in the description they do not yet know what global span number they were assigned. The 1-4 is just showing the spans that are exported by card 0. Since TE121 only export a single span, they only indicate their card number.
If you're using these cards with PRI, I agree that with striker that 'pri show spans' is a more useful command to see the status of the spans.
Running dahdi_maint from the console is also a good way to see the current status of any DAHDI spans you have configured in your system.

Related

Add a new line (\n) if a condition is met

I have made a web scraper by using rvest and created a data frame. One of the columns that I scraped has a lot of text in it and is hard to view.
The text in the column of my table looks like this,
Created 104 commits in 5 repositories raysan5/raylib 83 commits raysan5/raylib.com 17 commits raysan5/raygui 2 commits raysan5/rres 1 commit raysan5/raylib-games 1 commit , Reviewed 1 pull request in 1 repository raysan5/raylib 1 pull request Fixed #1455 Dec 13 , Started 1 discussion in 1 repository raysan5/raylib Welcome to raylib Discussions! Dec 8 , 2 contributions in private repositories Dec 18
Could someone help me find a way to add a \n after every comma (,) and perhaps remove the white space at the start of the next line? Also, it would be nice if a line can be skipped like shown in the desired layout. Moreover, if a bullet point can be added to each new paragraph that would be great too.
The text should be formated for example like this (desired layout),
Created 104 commits in 5 repositories raysan5/raylib 83 commits raysan5/raylib.com 17 commits raysan5/raygui 2 commits raysan5/rres 1 commit raysan5/raylib-games 1 commit
Reviewed 1 pull request in 1 repository raysan5/raylib 1 pull request Fixed #1455 Dec 13 , Started 1 discussion in 1 repository raysan5/raylib Welcome to raylib Discussions! Dec 8
2 contributions in private repositories Dec 18
I hope I'm not asking for too much.
gsub can do that using a regular expression:
gsub(' *, *', '\n', text)
*, * matches an arbitrary number of spaces, followed by a comma, followed by more spaces. And it replaces all that with the line break.

HTBasic for receiving data from a RS232 device

I am not coding neither understand much about it, although have to run an experiment in the laboratory, and have to use HTBasic to receive data from 2 GPIB devices (IEE 488) and one RS232 (this one is a high precision lab scale ).
I am changing/adding to an old script that someone else wrote. It was only to receive data from the 2 GPIB devices.
I must get data only every 15-30 minutes (the experiment will run for a month) and even though I successfully receive data from the lab scale (device interface select code = 12) they only arrive "synchronous" for a loop every e.g. 10ms (milliseconds). If I make it every 1 second the data are "old" e.g. I removed the item from the scale and instead of showing me ZERO "0" it still shows the weight. Imagine what if I ask for a loop every 15 minutes.
It seems that received data arrives in order one by one and displayed with that order. Probably there is an internal buffer or something that stores them. Does any one know how to OPEN and CLOSE the communication with a serial device on DEMAND? e.g. for GPIB devices I am sending a command like TALK (talk) and UNT (untalk) every time the loop takes place, but I can't find out how to do this with the serial device.
I tried the CONTROL 12,100;0 and CONTROL 12,100;1 (XOFF/XON) but it didn't work.
Here is one of the scripts I tried that gives me the correct weighting values, but for loops every 0.01 seconds.
LOOP
ENTER 12 USING "10D";W
PRINT TABXY(70,20),"wEIGHT IS:";W
WAIT 0.01
END LOOP
END
I would suggest trying using handshake control.
You can control the Serial Interface using the HTBASIC CONTROL statement.
For example, you can turn:
CONTROL 9,5;0 ! use DTR and RTS
CONTROL 9,12;0 ! read DSR, CD, and CTS
You should also use Interface handles as such:
ASSIGN #Serial TO 9 ! Opens the Serial Port, and clears buffer
ASSIGN #Serial TO * ! Closes the Serial Port
This should work for 15 Min Cycle (900 Sec):
ON CYCLE 900 GOSUB Get_Serial
LOOP
END LOOP
STOP
Get_serial:!
ASSIGN #Serial TO 12
ENTER #Serial USING "10D";W
RETURN
END
Hi guys and thanks for your answers (they came a bit late though).
Most probably both of your suggestions may work (havent try them ..maybe in the near future)
What I did those days to solve my problem , was basicly something like : LOOP continuusly and print on specific area of the screen (CRT) the serial device values (weight in gramms) , ONDELAY of specific time (eg every 15minutes) go to NEW LOOP (called it LOOOP in the code) which tells program to grab the value of RS232 labscale from the screen (not the device directly) and ofcourse the 2 GPIB devices, and after that repeat the continuus LOOP to show on CRT screen the real/continuus labscale values to prevent bufffer from being full ... and so everything worked smoothly..
I understand that this in not a GOOD way for coding, but as i said i am a rookie in this field ...BUT IT WORKED
So the code i wrote was something like:
[....]
33 ASSIGN #Scale TO 12
52 ENTER #Scale USING "10D";Weight
54 PRINT TABXY(70,20),"Captured LabScaLE Weight=";Weight;" g"
55 A=Weight
90 ON DELAY T GOTO Loooop
92 LOOP
93 ENTER #Scale USING "10D";A
94 A=A
95 PRINT TABXY(65,35);A;TABXY(65,35);
96 !
97 END LOOP
98 !
99 Loooop: GOTO 100 !GRAPSE THN GRAMMH PU AKOLOYTHEI PX 171
100 !
101 !
102 ENTER CRT;A
116 !==============================================START LISTENING FROM RS232 labscale (DISPAY ON CRT CONTINUUS DATA)======
117 !ENTER CRT;Weight
118 Weight=A
119 PRINT TABXY(70,20),"Captured LabScaLE Weight=";Weight;" g"
120 !
121 !==============================================START LISTENING FROM GDS CTRL=======
122 SEND 9;UNL UNT MLA TALK 14 DATA CHR$(255)
123 ENTER 9 USING "#,B,4D,6D";S,Pressurea,Volumea
124 SEND 9;UNT DATA CHR$(255)
128 !=============================================START LISTENING FROM GDS CTRL=======
129 !
130 SEND 8;UNL UNT MLA TALK 13 DATA CHR$(255)
131 ENTER 8 USING "#,B,4D,6D";S,Pressureb,Volumeb
132 SEND 8;UNT DATA CHR$(255)
[.....]
150 GOTO 92 !

Recover a overwritten encrypted luks device

Yesterday I was very tired and I had a friend of
mine that was kind of annoying. I had to put an
Linux ISO on a usb drive.
I had stored all of my data temporarily on one
device, which is a 5 TB drive. This device was/is
encrypted using :
cryptsetup -luksFormat ...
I mounted this device to /a and did a dd of an
Linux ISO on the 5 TB drive. The second I hit
enter I realized this and then I did a control C
and removed the plug from my drive.
After this I had a complete mental breakdown and
i started hyperventilating.
Anyhow I have read that even if data is overwritten
there is till a chance of reading the data below the
overwritten part.
I assume this is far more complicated then simply
running testdisk ( maybe testdisk can do this, no clue ).
The entire process of yesterday can be seen below :
:/a/1master-targz/iso# ls
debian-8.1.0-amd64-xfce-CD-1.iso FreeBSD-11.0-RELEASE-amd64-disc1.iso
linuxmint-18.1-cinnamon-32bit.iso nonpaelubuntu.iso
:/a/1master-targz/iso# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 4.6T 0 disk
└─sda 254:0 0 4.6T 0 crypt /a
sdb 8:16 1 28.7G 0 disk
├─sdb1 8:17 1 648M 0 part
└─sdb2 8:18 1 416K 0 part
:/a/1master-targz/iso# dd if=linuxmint-18.1-
linuxmint-18.1-cinnamon-32bit.iso linuxmint-18.1-mate-32bit.iso
linuxmint-18.1-mate-64bit.iso
:/a/1master-targz/iso# dd if=linuxmint-18.1-cinnamon-32bit.iso 5~^C
:/a/1master-targz/iso# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 4.6T 0 disk
└─sda 254:0 0 4.6T 0 crypt /a
sdb 8:16 1 28.7G 0 disk
├─sdb1 8:17 1 648M 0 part
└─sdb2 8:18 1 416K 0 part
:/a/1master-targz/iso# dd if=linuxmint-18.1-cinnamon-32bit.iso of=/dev/sda bs=512k
10+1 records in
10+1 records out
5685920 bytes (5.7 MB, 5.4 MiB) copied, 0.81171 s, 7.0 MB/s
:/a/1master-targz/iso#
:/a/1master-targz/iso# ^C
:/a/1master-targz/iso# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 1 28.7G 0 disk
├─sdb1 8:17 1 648M 0 part
└─sdb2 8:18 1 416K 0 part
sdc 8:32 0 4.6T 0 disk
└─sdc1 8:33 0 1.6G 0 part
mmcblk0 179:0 0 29.8G 0 disk
├─mmcblk0p1 179:1 0 41.8M 0 part /boot
└─mmcblk0p2 179:2 0 29.8G 0 part /
:/a/1master-targz/iso#
#somewhere here I got a panic attack
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier#cgsecurity.org>
http://www.cgsecurity.org
Disk /dev/sdc - 5000 GB / 4657 GiB - CHS 4769307 64 32
Partition Start End Size in sectors
>P ext4 0 63 31 4769306 63 30 9767538688 [Ghost] # doubt this is right
fdisk -l /dev/sdb
Disk /dev/sdb: 4.6 TiB, 5000981077504 bytes, 9767541167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x69e72c6a
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 0 3289087 3289088 1.6G 17 Hidden HPFS/NTFS
# head /dev/mapper/sda
head: error reading '/dev/mapper/sda': Input/output error
Summary
What do I have :
1 : Overwritten part of an encrypted luks device.
2 : I still have the mapper of when cryptsetup opened the device ( I have not
touched my computer since then )
My hope:
-There may be a way of tricking my OS of seeing my encrypted drive as /dev/sda
and connect the /dev/mapper/sda to this device, and then remount the device ignoring the part of the drive being destroyed ? ( I really have no clue ..)
-I know which image I used to overwrite the data, maybe this helps in possibly reading the data it destroyed.
-Any other idea's are very helpful
Clean up the question and remove the story.
"I have read that even if data is overwritten there is till a chance of reading the data below the overwritten part."
You will not be able to recover the over written data with your computer and drive as-is. In order to attempt to recover overwritten data it is necessary to be able to see the drive read head actual voltage so that the remnant of the over written value can be seen as a slight difference in the voltage. That means opening the HD and using specialized equipment. IOW: no.
You have learned the hard way to have continual backups, it seems the "hard way" is the only way that works and often takes multiple lessons, make this one count.

How Do I Find Cpanel Memory RAM Problems

I'm having a severe problem find out where I'm running out of memory on my CentOS cPanel Server. I'll Try to provide all the details that I can. I previously had the same server without cPanel and had no issues, so I'm thinking it's a cPanel problem.
I am currently running a cPanel server with CentOS 6.6 Installed, with 8GB of RAM and 1.5TB of Storage (Keep in mind my previous server without cPanel only has 4GB of RAM too).
Here's all my memory statistics.
$ free -m
total used free shared buffers cached
Mem: 8192 3647 4544 2560 0 1164
-/+ buffers/cache: 2483 5708
Swap: 0 0 0 0 0 0
$ cat /proc/user_beancounters
uid resource held maxheld barrier limit failcnt
16167: kmemsize 642249817 642637824 9223372036854775807 9223372036854775807 0
lockedpages 4610 4610 2097152 2097152 0
privvmpages 1971819 1972978 2097152 2097152 11579
shmpages 655390 655390 9223372036854775807 9223372036854775807 0
numproc 493 504 32567 32567 0
physpages 932503 933409 2097152 2097152 0
vmguarpages 0 0 2097152 2097152 0
oomguarpages 478382 478413 2097152 2097152 0
$ smem -u -t -k
User Count Swap USS PSS RSS
mailnull 1 0 996.0K 1001.0K 1.5M
dovecot 2 0 1.0M 1.1M 3.2M
memcached 2 0 1.1M 1.3M 2.3M
varnish 1 0 1.2M 1.5M 2.7M
apache 5 0 716.0K 2.1M 27.5M
lighttpd 6 0 2.6M 4.0M 30.1M
dovenull 4 0 3.4M 4.1M 13.6M
newrelic 2 0 4.6M 4.9M 6.5M
media 7 0 4.6M 5.8M 18.3M
redis 5 0 5.7M 6.1M 10.5M
ldap 1 0 7.6M 7.7M 8.4M
user 9 0 10.3M 12.6M 24.1M
postgres 7 0 11.8M 14.0M 25.8M
named 1 0 27.1M 27.1M 27.9M
ntop 1 0 30.2M 31.8M 35.0M
mongod 1 0 46.8M 46.8M 47.7M
elasticsearch 1 0 201.7M 205.0M 212.7M
graylog2 1 0 262.1M 265.5M 273.4M
nobody 20 0 434.3M 488.6M 789.4M
mysql 1 0 489.6M 489.8M 492.1M
root 58 0 628.2M 695.7M 847.9M
---------------------------------------------------
136 0 2.1G 2.3G 2.8G
$ vzubc -c
----------------------------------------------------------------
CT 16167 | HELD Bar% Lim%| MAXH Bar% Lim%| BAR | LIM | FAIL
-------------+---------------+---------------+-----+-----+------
lockedpages| 18M 0.2% 0.2%| 18M 0.2% 0.2%| 8G| 8G| -
privvmpages|7.51G 93% 93%|7.52G 94% 94%| 8G| 8G| 11.3K
numproc| 495 2% 2%| 504 2% 2%|31.8K|31.8K| -
physpages|3.55G 44% 44%|3.56G 44% 44%| 8G| 8G| -
vmguarpages| - - - | - - - | 8G| 8G| -
oomguarpages|1.82G 22% 22%|1.82G 22% 22%| 8G| 8G| -
numpty| 4 2% 2%| 4 2% 2%| 255 | 255 | -
numsiginfo| - - - | 12 1% 1%| 1K| 1K| -
----------------------------------------------------------------
Also in the administrative side of my server I can see
CPU USAGE - 13.33%
DISK SPACE USAGE - 2.54% / 1536GB
RAM USAGE - 28.64% / 8GB
Continuous errors I'm getting on Command line are
Unable to Fork, Cannot allocate memory
Segmentation Fault
As well as continuous failure of Tailwatchd failing and a few other services failing here and there. I used the Tweak Setting to change memory from 512MB to 4096MB to Unlimited MB to see if it changed anything, with no change. I also changed the Conserve Memory option both to on and off to see if there were any changes, with none.
Also, I tried to check the vz container settings. I have 1 config for 0.conf but nothing for 16167.conf. I tried to adjust setting in 0.conf with no luck, then created 16167.conf and adjusted settings which continued not to show up after a server restart. I experimented with the differet ve templates from 1G all the way to 4G, and again no improvement.
Any help or point in the right direction would be greatly appreciated. I've tried to make any corrections I could and all the research I could before asking the community, but I think at this pint, I need some help with it. Thanks in advance.
I would suggest to tune your mysql for your system memory (half of it)
and then also tune the apache through cpanel... most times it is the sql part.
you do also have elastic search. and your root memory is too high.
But on the current system you do have 5,7GB free memory. Are you sure you are out of mem?
It seems your provider has oversold the memory (the only thought i have about the segfault you do have)
To resolve this issues, You will have to increase privvmpages value for your VM. You can increase it through your main node with the following command.
vzctl set ${cid} --privvmpages 1024M:2048M --save
With the above command you will get 1024MB Guaranteed, 2048MB Burstable memory. Change it with your requirement and check it again.

Triggering udev rule for particular keyboard

I need to write a udev rule for a particular keyboard which does not seem to have any unique attribute against which to match.
The lines below are the output of udevadm monitor upon insertion of the device. Is there something here I could use to uniquely identify this keyboard?
KERNEL[58443.215701] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 (usb)
KERNEL[58443.218536] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)
KERNEL[58443.218662] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:04B3:3025.0005 (hid)
KERNEL[58443.221610] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input15 (input)
KERNEL[58443.221669] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input15/event4 (input)
KERNEL[58443.221868] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:04B3:3025.0005/hidraw/hidraw0
UDEV [58443.236718] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 (usb)
UDEV [58443.238026] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)
UDEV [58443.239532] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:04B3:3025.0005 (hid)
UDEV [58443.240670] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:04B3:3025.0005/hidraw/hidraw0
UDEV [58443.288767] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input15 (input)
UDEV [58443.319799] add /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input15/event4 (input)
Edit:
Below are the lines from plugging the keyboard into a different usb port. As far as I can tell, it seems that there is no information that remains constant.
KERNEL[59428.187673] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1 (usb)
KERNEL[59428.190323] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0 (usb)
KERNEL[59428.190494] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:04B3:3025.0006 (hid)
KERNEL[59428.193088] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input16 (input)
KERNEL[59428.193266] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input16/event4 (input)
KERNEL[59428.193426] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:04B3:3025.0006/hidraw/hidraw0
UDEV [59428.300690] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1 (usb)
UDEV [59428.301790] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0 (usb)
UDEV [59428.302553] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:04B3:3025.0006 (hid)
UDEV [59428.303130] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/0003:04B3:3025.0006/hidraw/hidraw0
UDEV [59428.319082] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input16 (input)
UDEV [59428.321444] add /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.0/input/input16/event4 (input)
Edit: Using lsusb -v, I was able to find the idVendor and idProduct.
Bus 002 Device 009: ID 04b3:3025 IBM Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x04b3 IBM Corp.
idProduct 0x3025
bcdDevice 1.09
iManufacturer 1 LITE-ON Technology
iProduct 2 USB NetVista Full Width Keyboard.
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 4 HID Keyboard
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 70mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 5 EP1 Interrupt
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 65
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 24
Device Status: 0x0000
(Bus Powered)
So I have created the following udev rule:
SUBSYSTEM=="usb", ATTR{idVendor}=="0x04b3", ATTRS{idProduct}=="0x3025", RUN+="/home/myuser/bin/udev_jap.sh"
However, nothing is triggered so far. And strangely, the idVendor and idProduct information doesn't show up on udevadm monitor. Does this mean udev can't match against these attributes?
This is an old question, anyway:
You have to remove 0x hexadecimal prefix.
Note that ATTR and ATTRS are different, but for your case both should work.
Your script udev_jap.sh should start with shebang #!/bin/sh or run shell itself:
RUN+="/bin/sh /home/myuser/bin/udev_jap.sh"
Try this:
SUBSYSTEM=="usb", ATTR{idVendor}=="04b3", ATTR{idProduct}=="3025", RUN+="/home/myuser/bin/udev_jap.sh"

Resources