How to Empty Directory With Large Number of Files

The easiest and the fastest way to empty directories with a large number of files is with the following command. Add this command in my public technical diary for future reference. 

Go to the directory which contains a large number of files.  For example, files name are like sip_20201002145227__410060544193744.log .

find . -name "sip_2020*" -delete

Enjoy ;)

How to convert AMR-WB to mp3

I faced a lot of difficulty in converting amr-wb codec in mp3, so I am adding that short and the easiest way in my pubic technical diary so that others can also get benefit from this. 

Take network traces on your media gateway or and the node which proxy RTP packets through tcpdump or tshark. I prefer using tcpdump

tcpdump -i any -s 0 -w amr-wb.pcap

Open amr-wb.pcap file using Wireshark


Go to Telephony --> RTP --> RTP Streams. 
 

Choose the RTP stream which you want to convert into an mp3 file.


 and click Analyze. Save synchronized stream audio.



Name the file and save the AMR-WB stream in raw format. 



now find an amr.py script from here or download. Open the terminal and execute the following command. 

$ python amr.py -w -v amr-wb.raw 
AMR-WB, bandwidth efficient, 1 channel(s)
Files: amr-wb.raw -> amr-wb.amr
Done, 1607 samples converted

This command will convert raw data to AMR format. now convert amr format to mp3 using ffmpeg library.

$ ffmpeg -i amr-wb.amr amr-wb.mp3
[amr @ 0x7fde98812800] Estimating duration from bitrate, this may be inaccurate
Input #0, amr, from 'amr-wb.amr':
  Duration: 00:00:32.14, bitrate: 23 kb/s
    Stream #0:0: Audio: amr_wb (sawb / 0x62776173), 16000 Hz, mono, flt
Stream mapping:
  Stream #0:0 -> #0:0 (amr_wb (amrwb) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to 'amr-wb.mp3':
  Metadata:
    TSSE            : Lavf58.45.100
    Stream #0:0: Audio: mp3 (libmp3lame), 16000 Hz, mono, fltp
    Metadata:
      encoder         : Lavc58.91.100 libmp3lame
size=      95kB time=00:00:32.15 bitrate=  24.1kbits/s speed= 207x    
video:0kB audio:94kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.232775%

amr-wb.amr has been converted to amr-wb.mp3. You can listen to this file through any media player. 

Enjoy ;)

Resize a VNF deployed in Openstack

Please make sure that your VNF files system was created through LVM (Logical Volume Manager). to identify this you use the following command $ cat /etc/fstab
This is an exmaple of fixed FS, which you can not resize
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
UUID=9d956232-4e00-4976-a6c6-207a757342bf /               ext4    errors=remount-ro 0       1
While this is an example of FS initiated through LVM, which you can resize
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/MasterDebain-root/ /               ext4    errors=remount-ro 0       1
you can use fdisk a command to resize a machine.
$ df -h
image
$ fdisk -l
image
$ fdisk /dev/vda/
image
Command (m for help): n
Command action
   e   extended
   p   primary (1 primary, 1 extended, 2 free)
Select (default p): p
Partition Number (3-4, default 3): {enter}
First Sector (XXXXXX -XXXXXX, default XXXXX): {Enter}
Last Sector (XXXXXX -XXXXXX, default XXXXX): {Enter}

Created a new partition 3 of type 'Linux' and of and size of 72 GiB

Command (m for help): w
The partition table has been altered.
Syncing Disks.
$
fdisk -l
image
$ pvdisplay
image
$ pvcreate /dev/vd4
  Physical volume "/dev/vda4" successfully created
$ pvdisplay
image
$ vgdisplay
image
$ vgextend MasterDebain-vg /dev/vda4
  Volume group "MasterDebain-vg" successfully extended
$ vgdisplay
image
$ lvdisplay | grep Path
   LV Path    /dev/MasterDebain-vg/root
   LV Path    /dev/MasterDebain-vg/swap_1
   LV Path    /dev/MasterDebain-vg/home
now extend
$ lvextend -l +100%FREE /dev/MasterDebain-vg/root
  Extending logical volume MasterDebain-vg/root changed to 74.53 GiB
  Logical volume MasterDebain-vg/root successfully resized
We are almost done
$ resize2fs /dev/MasterDebain-vg/root
now again check the size of root directory
$ df -h
image
Enjoy ;)

Compile and Install Kamailio as IMS Node

Download latest release from Git
$ wget https://github.com/kamailio/kamailio/archive/5.3.1.tar.gz
Or clone it from git
$ git clone --depth 1 --no-single-branch --branch 5.3 https://github.com/kamailio/kamailio kamailio
Extract source
$ cd /usr/local/src/
$ tar -zxvf 5.3.1.tar.gz
$ cd kamailio-5.3.1/
Install dependencies
$ apt install flex bison gcc g++ libssl-dev libcurl4 libxml2 libpcre3 libxml2-dev libmnl-dev librabbitmq-dev libmediastreamer-dev libortp-dev libsctp-dev make libsystemd-dev libpcre3-dev libcurl3-gnutls-dev uuid-dev libsnmp-dev
Add IMS Modules and set installation directory to /opt/kamailio
$ make PREFIX="/opt/kamailio" include_modules="cdp cdp_avp db_mysql ims_auth ims_charging ims_dialog ims_diameter_server ims_icscf ims_ipsec_pcscf ims_isc ims_ocs ims_qos ims_registrar_pcscf ims_registrar_scscf ims_usrloc_pcscf ims_usrloc_scscf log_systemd rabbitmq regex rls sctp snmpstats utils uuid xmlrpc pua ims_ipsec_pcscf" cfg
Compile Kamailio
$ make Q=0 all
Install Kamailio
$ make install

if in case you need to re-compile a module use the following commands

$ make modules modules=modules/ims_qos
$ make install-modules modules=modules/ims_qos

For normal Kamailio installation, you can follow this link.


Enjoy ;)

Resize Virtual Box Machine


On host OS (Windows 10)

.\VBoxManage.exe modifyhd '..\..\..\Users\username\VirtualBox VMs\CSCF Node 2\CSCF Node 2.vdi' --resize 13000

On Guest OS (Debian)

$ fdisk -l
$ fdisk /dev/sda
$ fdisk -l
$ pvs
$ lvs
$ pvdisplay
$ fdisk -l
$ pvcreate /dev/sda4
$ pvdisplay
$ vgextend MasterDebain-vg /dev/sda4
$ pvdisplay
$ lvdisplay
$ lvextend -l +100%FREE /dev/MasterDebain-vg/root
$ resize2fs /dev/MasterDebain-vg/root

Please follow this link.


Hamid Raza Hashmi hamid.hashmi006@gmail.com +92 300 968 22 85

How to compile and run a next application ?

Install nodejs Use  this  link for further reading curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash nvm inst...