Wednesday, 9 May 2018

Create a (local) repository and use yum to have it resolve the dependencies for you

Summarized and further minimized (not ideal, but quickest):
  1. Create a directory for you local repository, e.g. /home/user/repo.
  2. Move the RPMs into that directory.
  3. Fix some ownership and filesystem permissions:
    # chown -R root.root /home/user/repo
    
  4. Install the createrepo package if not installed yet, and run
    # createrepo /home/user/repo
    # chmod -R o-w+r /home/user/repo
    
  5. Create a repository configuration file, e.g. /etc/yum.repos.d/myrepo.repo containing
    [local]
    name=My Awesome Repo
    baseurl=file:///home/user/repo
    enabled=1
    gpgcheck=0
    
  6. Install your package using
    # yum install packagename
    

Tuesday, 9 May 2017

How to sort rows of HTML table that are called from MySQL

That's actually pretty easy, here's a possible approach:


<table>
    <tr>
        <th>
            <a href="?orderBy=type">Type:</a>
        </th>
        <th>
            <a href="?orderBy=description">Description:</a>
        </th>
        <th>
            <a href="?orderBy=recorded_date">Recorded Date:</a>
        </th>
        <th>
            <a href="?orderBy=added_date">Added Date:</a>
        </th>
    </tr>
</table>
<?php
$orderBy = array('type', 'description', 'recorded_date', 'added_date');

$order = 'type';
if (isset($_GET['orderBy']) && in_array($_GET['orderBy'], $orderBy)) {
    $order = $_GET['orderBy'];
}

$query = 'SELECT * FROM aTable ORDER BY '.$order;

// retrieve and show the data :)
?>

Wednesday, 8 June 2016

Asterisk g.729 and g.723 Codec Transcoding/Pass-Thru

Given below are the step by step instruction for making Asterisk work as a codec Transcoder

Step 1:
Download suitable codec binaries for your asterisk platform

Step 2:
Restart asterisk to make asterisk load newly installed codec modules
 e.g. amportal restart

Step 3:
log into asterisk console asterisk -rvvvv and type this command core show codec and check if you can see newly install codecs

elastix*CLI> core show codecs
Disclaimer: this command is for informational purposes only.
It does not indicate anything about your configuration.

INT    BINARY        HEX   TYPE       NAME   DESC
——————————————————————————–
1 (1 <<  0)      (0x1)  audio       g723   (G.723.1)
2 (1 <<  1)      (0x2)  audio        gsm   (GSM)
4 (1 <<  2)      (0x4)  audio       ulaw   (G.711 u-law)
8 (1 <<  3)      (0x8)  audio       alaw   (G.711 A-law)
16 (1 <<  4)     (0x10)  audio   g726aal2   (G.726 AAL2)
32 (1 <<  5)     (0x20)  audio      adpcm   (ADPCM)
64 (1 <<  6)     (0x40)  audio       slin   (16 bit Signed Linear PCM)
128 (1 <<  7)     (0x80)  audio      lpc10   (LPC10)
256 (1 <<  8)    (0x100)  audio       g729   (G.729A)
512 (1 <<  9)    (0x200)  audio      speex   (SpeeX)
1024 (1 << 10)    (0x400)  audio       ilbc   (iLBC)
2048 (1 << 11)    (0x800)  audio       g726   (G.726 RFC3551)
4096 (1 << 12)   (0x1000)  audio       g722   (G722)
65536 (1 << 16)  (0x10000)  image       jpeg   (JPEG image)
131072 (1 << 17)  (0x20000)  image        png   (PNG image)
262144 (1 << 18)  (0x40000)  video       h261   (H.261 Video)
524288 (1 << 19)  (0x80000)  video       h263   (H.263 Video)
1048576 (1 << 20) (0x100000)  video      h263p   (H.263+ Video)
2097152 (1 << 21) (0x200000)  video       h264   (H.264 Video)

Step 4:
Choose your fav. editor in linux , mine is Vi
vi /etc/asterisk/extensions.conf and add these lines under the [General]
[general]
#include sip_general_additional.conf
bindport =5060         ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)
disallow=all
allow=g723
allow=g729

And for your GW settings do the same
[EXGN]
type=peer
host=x.x.x.x
port=5060
disallow=all
allow=g729
;dtmfmode=inband
;dtmf=inband
nat=no
;insecure=very

Now set your Eyebeam to send calls using g.729 codec to asterisk it should work
To check if calls are going into g.729/723 codec run this command on the main console
sip show channels

I hope this should work