## Table of Contents

[[toc]]

## Instalar Asterisk

Descargar ASTERISK

- [Asterisk stable version](https://www.asterisk.org/downloads/asterisk/all-asterisk-versions)

Una vez que se completa la descarga, **extraemos el contenido del paquete descargado**

```bash
sudo tar zxf asterisk-XXX-current.tar.gz
cd asterisk-XXX
```

Usaremos el **`script install_prereq` para resolver todas las dependencias** en nuestro sistema

```bash
sudo contrib/scripts/install_prereq install
```

El anterior comando instalará todos los paquetes necesarios. Al finalizar con éxito, imprimirá el siguiente mensaje

```
#############################################
## install completed successfully
#############################################
```

Instalación del servicio de Asterisk

```bash
sudo ./configure
sudo make menuselect
```

Para colocar el **idioma** a español se debe seleccionar los siguientes módulos

```
Core Sound Packages
	[*] CORE-SOUNDS-ES-ULAW
	[*] CORE-SOUNDS-ES-ALAW
	[*] CORE-SOUNDS-ES-GSM
```

> **Nota** también seleccionar `CORE-SOUNDS-EN-XXX` **ulaw, alaw, gsm**

continuar con las **instalación**

```bash
sudo make
sudo make install
sudo make samples
sudo make config
```

```js
export default {
  data() {
    return {
      msg: 'Highlighted!',
    };
  },
};
```

## Crear certificado SSL

Para el funcionamiento del WebRTC se debe crear los certificados auto firmados

```bash
sudo mkdir /etc/asterisk/keys
sudo contrib/scripts/ast_tls_cert -C monitoreafacil.com -O "My Organization" -d /etc/asterisk/keys
```

Se debe colocar un contraseña este proceso se repetirá varias veces

> **Nota** para que el navegador reconozca el certificado se debe colocar la siguiente
>
> **URL**: `https://ip_server:8089/ws`

## Instalar Postgresql

Instalar dependencias de `Postgresql`

```bash
sudo apt-get install unixodbc unixodbc-dev odbc-postgresql
sudo apt-get install postgresql postgresql-client postgresql-contrib libpq-dev
```

Copiar los archivos del repositorio de **Git** `mod-db/etc` y `mod-db/etc-asterisk`

```bash
sudo cp odbcinst.ini /etc/
sudo cp odbc.ini /etc/
cd ..
cd etc-asterisk && cp * /etc/asterisk -rf
```

Crear `DB` para **Asterisk** y configurar un usuario con password

```bash
sudo su postgres
psql
CREATE ROLE asterisk WITH LOGIN PASSWORD 'asterisk';
CREATE DATABASE asterisk;
GRANT ALL PRIVILEGES ON DATABASE asterisk TO asterisk;
\quit
```

Ingresar a la consola de `Posgresql`

```bash
sudo -u postgres psql -U postgres asterisk
asterisk-# \dt #data table
```

Verificar conexión de la **DB** en **Asterisk**

```
*CLI> odbc show

ODBC DSN Settings
-----------------
  Name:   asterisk
  DSN:    asterisk
    Last connection attempt: 1969-12-31 20:00:00
    Number of active connections: 1 (out of 100)
    Logging: Enabled
    Number of prepares executed: 13
    Number of queries executed: 12
    ...
```

Verificar conexión con **Postgresql**

```bash
$ echo "select 1" | isql -v asterisk asterisk asterisk cdr show pgsql status
```

## Iniciar la base de datos con Node.js

En la carpeta `mod-db/` ejecutar

```bash
npm install
npm run setup
sudo echo "alias db='cd <ruta_git>/Sistema-Integrador-de-Llamadas-VoIP/mod-db/;npm run setup'" >> ~/.zshrc # opcional ~/.bash_aliases
```

## Crear alias para el Backend

Crear alias para **copiar** los archivos a la carpeta de **Git** desde `/etc/asterisk/*`

```bash
sudo echo "alias cpA='pushd <ruta_git>/Sistema-Integrador-de-Llamadas-VoIP/mod-db/etc/;sudo cp * /etc/ -rf;cd ..;cd etc-asterisk/;sudo cp * /etc/asterisk/ -rf;popd'" >> ~/.zshrc
```

Alias para **copiar las configuraciones** de la **DB** ubicada en `/etc/` a la carpeta de **Git**

```bash
sudo echo "alias cpL='pushd /etc/;sudo cp odbcinst.ini <ruta_git>/Sistema-Integrador-de-Llamadas-VoIP/mod-db/etc/ -rf;sudo cp odbc.ini <ruta_git>/Sistema-Integrador-de-Llamadas-VoIP/mod-db/etc/ -rf;cd asterisk/;sudo cp * <ruta_git>/Sistema-Integrador-de-Llamadas-VoIP/mod-db/etc-asterisk/ -rf;popd'" >> ~/.zshrc
```

> **NOTA**
>
> Para crear los alias pueden usar `>> ~/.bash_aliases` si usan la t**erminal por defecto** del sistema en caso que usen **Oh My ZSH** deben usar `>> ~/.zshrc`

## Docs

- [Refactor DB Asterisk](https://github.com/edsonarios/Sistema-Integrador-de-Llamadas-VoIP/blob/master/mod-db/Docs/DB%20Refactor.md)

---

**Advertisement :)**

- **[pica](https://nodeca.github.io/pica/demo/)** - high quality and fast image
  resize in browser.
- **[babelfish](https://github.com/nodeca/babelfish/)** - developer friendly
  i18n with plurals support and easy syntax.

You will like those projects!

---

# h1 Heading 8-)

## h2 Heading

### h3 Heading

#### h4 Heading

##### h5 Heading

###### h6 Heading

## Horizontal Rules

---

---

---

## Typographic replacements

Enable typographer option to see result.

(c) (C) (r) (R) (tm) (TM) (p) (P) +-

test.. test... test..... test?..... test!....

!!!!!! ???? ,, -- ---

"Smartypants, double quotes" and 'single quotes'

## Emphasis

**This is bold text**

**This is bold text**

_This is italic text_

_This is italic text_

~~Strikethrough~~

## Blockquotes

> Blockquotes can also be nested...
>
> > ...by using additional greater-than signs right next to each other...
> >
> > > ...or with spaces between arrows.

## Lists

Unordered

- Create a list by starting a line with `+`, `-`, or `*`
- Sub-lists are made by indenting 2 spaces:
  - Marker character change forces new list start:
    - Ac tristique libero volutpat at
    * Facilisis in pretium nisl aliquet
    - Nulla volutpat aliquam velit
- Very easy!

Ordered

1. Lorem ipsum dolor sit amet
2. Consectetur adipiscing elit
3. Integer molestie lorem at massa

1) You can use sequential numbers...
1) ...or keep all the numbers as `1.`

Start numbering with offset:

57. foo
1. bar

## Code

Inline `code`

Indented code

    // Some comments
    line 1 of code
    line 2 of code
    line 3 of code

Block code "fences"

```
Sample text here...
```

Syntax highlighting

```js
var foo = function (bar) {
  return bar++;
};

console.log(foo(5));
```

## Tables

| Option | Description                                                               |
| ------ | ------------------------------------------------------------------------- |
| data   | path to data files to supply the data that will be passed into templates. |
| engine | engine to be used for processing templates. Handlebars is the default.    |
| ext    | extension to be used for dest files.                                      |

Right aligned columns

| Option |                                                               Description |
| -----: | ------------------------------------------------------------------------: |
|   data | path to data files to supply the data that will be passed into templates. |
| engine |    engine to be used for processing templates. Handlebars is the default. |
|    ext |                                      extension to be used for dest files. |

## Links

[link text](http://dev.nodeca.com)

[link with title](http://nodeca.github.io/pica/demo/ 'title text!')

Autoconverted link https://github.com/nodeca/pica (enable linkify to see)

## Images

![Minion](https://octodex.github.com/images/minion.png)
![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg 'The Stormtroopocat')

Like links, Images also have a footnote style syntax

![Alt text][id]

With a reference later in the document defining the URL location:

[id]: https://octodex.github.com/images/dojocat.jpg 'The Dojocat'

## Plugins

The killer feature of `markdown-it` is very effective support of
[syntax plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin).

### [Emojies](https://github.com/markdown-it/markdown-it-emoji)

> Classic markup: :wink: :crush: :cry: :tear: :laughing: :yum:
>
> Shortcuts (emoticons): :-) :-( 8-) ;)

see [how to change output](https://github.com/markdown-it/markdown-it-emoji#change-output) with twemoji.

### [Subscript](https://github.com/markdown-it/markdown-it-sub) / [Superscript](https://github.com/markdown-it/markdown-it-sup)

- 19^th^
- H~2~O

### [\<ins>](https://github.com/markdown-it/markdown-it-ins)

++Inserted text++

### [\<mark>](https://github.com/markdown-it/markdown-it-mark)

==Marked text==

### [Footnotes](https://github.com/markdown-it/markdown-it-footnote)

Footnote 1 link[^first].

Footnote 2 link[^second].

Inline footnote^[Text of inline footnote] definition.

Duplicated footnote reference[^second].

[^first]: Footnote **can have markup**

and multiple paragraphs.

[^second]: Footnote text.

### [Definition lists](https://github.com/markdown-it/markdown-it-deflist)

Term 1

: Definition 1
with lazy continuation.

Term 2 with _inline markup_

: Definition 2

        { some code, part of Definition 2 }

    Third paragraph of definition 2.

_Compact style:_

Term 1
~ Definition 1

Term 2
~ Definition 2a
~ Definition 2b

### [Abbreviations](https://github.com/markdown-it/markdown-it-abbr)

This is HTML abbreviation example.

It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on.

\*[HTML]: Hyper Text Markup Language

### [Custom containers](https://github.com/markdown-it/markdown-it-container)

::: warning
_here be dragons_
:::

::: warning
++here be dragons++
:::
