<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ekim</title>
    <description>The latest articles on DEV Community by Ekim (@ekim34351855).</description>
    <link>https://dev.to/ekim34351855</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F619384%2F4aa21837-0be9-4bd3-a853-c40bfc644628.png</url>
      <title>DEV Community: Ekim</title>
      <link>https://dev.to/ekim34351855</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ekim34351855"/>
    <language>en</language>
    <item>
      <title>Asterisk AGI short sharing </title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 02 Jul 2021 02:24:48 +0000</pubDate>
      <link>https://dev.to/ekim34351855/asterisk-agi-short-sharing-2m1f</link>
      <guid>https://dev.to/ekim34351855/asterisk-agi-short-sharing-2m1f</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/sharing-of-how-i-made-my-own-command-5dfl"&gt;Sharing of how I made my own command&lt;/a&gt;&lt;br&gt;
 &lt;br&gt;
 &lt;/p&gt;
&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Today, I am going to start integrating my previous call flow with the use of AGI. To do that, we need the help of AGI (Asterisk Gateway Interface). The reason we might need to do that is that sometimes we want to record every call and insert the call logs into the database. So that, we could know what calls have been made or received. Moreover, the use of database could help us create an IVR , for it could contain all the IVR logic we have. &lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;
&lt;h3&gt;
  
  
  What is AGI ?
&lt;/h3&gt;

&lt;p&gt;AGI provides an interface between the Asterisk dialplan and an external program that wants to manipulate a channel in the dialplan. &lt;/p&gt;

&lt;p&gt;  &lt;/p&gt;
&lt;h3&gt;
  
  
  PostgreSQL installation &amp;amp; DB creation
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install PostgreSQL&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;postgresql postgresql-contrib

&lt;span class="c"&gt;# start the postgres service&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;service postgresql start

&lt;span class="c"&gt;# Change to user postgres as it can perform all tasks on the database&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;su postgres

&lt;span class="c"&gt;# login to the DB&lt;/span&gt;
psql

&lt;span class="c"&gt;# You should see something similar in your terminal&lt;/span&gt;
&lt;span class="nv"&gt;postgres&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="c"&gt;# &lt;/span&gt;

&lt;span class="c"&gt;# Create database&lt;/span&gt;
&lt;span class="c"&gt;# don't miss the colon&lt;/span&gt;
CREATE Database &amp;lt;your-database-name-here&amp;gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c"&gt;# Create an account to manage the database&lt;/span&gt;
&lt;span class="c"&gt;# don't miss the colon and the quotation marks&lt;/span&gt;
CREATE USER &amp;lt;your-username-here&amp;gt; WITH PASSWORD &lt;span class="s1"&gt;'your-password-here'&lt;/span&gt; SUPERUSER&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c"&gt;# Leaving Database and postgres user&lt;/span&gt;
ctrl + d 
ctrl + d

&lt;span class="c"&gt;# Try login from the current user&lt;/span&gt;
psql &lt;span class="nt"&gt;-U&lt;/span&gt; &amp;lt;user_name&amp;gt; &lt;span class="nt"&gt;-W&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt; &amp;lt;&lt;span class="nb"&gt;hostname&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &amp;lt;db_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Using AGI in Asterisk
&lt;/h3&gt;

&lt;p&gt;In Asterisk, AGI can be treated as a dialplan application in &lt;code&gt;extensions.conf&lt;/code&gt;. In the following, I will show you how you could use it as a way to insert data into the PostgreSQL database. &lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;br&gt;
In modules.conf&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# add the agi module&lt;/span&gt;
load &lt;span class="o"&gt;=&lt;/span&gt; res_agi.so
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;br&gt;
 &lt;br&gt;
In pjsip.conf&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;transport-udp-nat]
&lt;span class="nb"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; transport
protocol &lt;span class="o"&gt;=&lt;/span&gt; udp
&lt;span class="nb"&gt;bind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; 0.0.0.0

&lt;span class="o"&gt;[&lt;/span&gt;calling]&lt;span class="o"&gt;(!)&lt;/span&gt;                 
&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;endpoint                
&lt;span class="nv"&gt;context&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;interaction          
allow &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;all, ulaw, alaw     
&lt;span class="nv"&gt;direct_media&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;no              
&lt;span class="nv"&gt;trust_id_outbound&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;yes
&lt;/span&gt;&lt;span class="nv"&gt;rtp_symmetric&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;yes
&lt;/span&gt;&lt;span class="nv"&gt;force_rport&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;yes
&lt;/span&gt;&lt;span class="nv"&gt;rewrite_contact&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;yes
&lt;/span&gt;&lt;span class="nv"&gt;device_state_busy_at&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;span class="nv"&gt;dtmf_mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;rfc4733

&lt;span class="o"&gt;[&lt;/span&gt;auth-userpass]&lt;span class="o"&gt;(!)&lt;/span&gt;       
&lt;span class="nb"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; auth              
auth_type &lt;span class="o"&gt;=&lt;/span&gt; userpass     
&lt;span class="o"&gt;[&lt;/span&gt;aor-single-reg]&lt;span class="o"&gt;(!)&lt;/span&gt;     
&lt;span class="nb"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; aor
max_contacts &lt;span class="o"&gt;=&lt;/span&gt; 1         

&lt;span class="o"&gt;[&lt;/span&gt;7000]&lt;span class="o"&gt;(&lt;/span&gt;calling&lt;span class="o"&gt;)&lt;/span&gt;          
&lt;span class="nv"&gt;auth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7000                
&lt;span class="nv"&gt;aors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7000                
callerid &lt;span class="o"&gt;=&lt;/span&gt; 7000 &amp;lt;7000&amp;gt;   

&lt;span class="o"&gt;[&lt;/span&gt;7000]&lt;span class="o"&gt;(&lt;/span&gt;auth-userpass&lt;span class="o"&gt;)&lt;/span&gt;    
password &lt;span class="o"&gt;=&lt;/span&gt; 7000
username &lt;span class="o"&gt;=&lt;/span&gt; 7000

&lt;span class="o"&gt;[&lt;/span&gt;7000]&lt;span class="o"&gt;(&lt;/span&gt;aor-single-reg&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;[&lt;/span&gt;7100]&lt;span class="o"&gt;(&lt;/span&gt;calling&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;auth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7100
&lt;span class="nv"&gt;aors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;7100
callerid &lt;span class="o"&gt;=&lt;/span&gt; 7100 &amp;lt;7100&amp;gt;

&lt;span class="o"&gt;[&lt;/span&gt;7100]&lt;span class="o"&gt;(&lt;/span&gt;auth-userpass&lt;span class="o"&gt;)&lt;/span&gt;
password &lt;span class="o"&gt;=&lt;/span&gt; 7100
username &lt;span class="o"&gt;=&lt;/span&gt; 7100

&lt;span class="o"&gt;[&lt;/span&gt;7100]&lt;span class="o"&gt;(&lt;/span&gt;aor-single-reg&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt; &lt;br&gt;
 &lt;br&gt;
In extensions.conf&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;interaction]
exten &lt;span class="o"&gt;=&lt;/span&gt; _7X00,1,NoOp&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;EXTEN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;;&lt;/span&gt; setting variables &lt;span class="k"&gt;for &lt;/span&gt;data insertion
same &lt;span class="o"&gt;=&lt;/span&gt; n,Set&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;_callInTime&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;STRFTIME&lt;/span&gt;&lt;span class="p"&gt;(,,%Y%b%d-%H%M%S)&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
same &lt;span class="o"&gt;=&lt;/span&gt; n,Set&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;_callerId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CALLERID&lt;/span&gt;&lt;span class="p"&gt;(num)&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
same &lt;span class="o"&gt;=&lt;/span&gt; n,Set&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;_extension&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;EXTEN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
same &lt;span class="o"&gt;=&lt;/span&gt; n,Set&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;_callDuration&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CDR&lt;/span&gt;&lt;span class="p"&gt;(billsec)&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
same &lt;span class="o"&gt;=&lt;/span&gt; n,Answer
same &lt;span class="o"&gt;=&lt;/span&gt; n,Dial&lt;span class="o"&gt;(&lt;/span&gt;PJSIP/&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;EXTEN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;,30&lt;span class="o"&gt;)&lt;/span&gt;
same &lt;span class="o"&gt;=&lt;/span&gt; n,Goto&lt;span class="o"&gt;(&lt;/span&gt;update_call_duration,s,1&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;[&lt;/span&gt;update_call_duration]
&lt;span class="p"&gt;;&lt;/span&gt; call_log is the agi file, the rest are the arguments
exten &lt;span class="o"&gt;=&lt;/span&gt; s,1,agi&lt;span class="o"&gt;(&lt;/span&gt;call_log,&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;callerId&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;,&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;callInTime&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;,&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;extension&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;,&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;callDuration&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
same &lt;span class="o"&gt;=&lt;/span&gt; n,Hangup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;extensions.conf&lt;/code&gt;, we use the &lt;code&gt;agi&lt;/code&gt; dialplan application. Think of it as running a program like &lt;code&gt;node abc.js&lt;/code&gt; or &lt;code&gt;python3 cde.py&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;

&lt;h3&gt;
  
  
  So, where is our program ?
&lt;/h3&gt;

&lt;p&gt;Actually, we need to go to the default &lt;code&gt;agi-bin&lt;/code&gt; path to create the program. &lt;/p&gt;

&lt;p&gt;But that would be too much for me today. So, please bear with me and stay tuned for the next week sharing and I will go deeper into the &lt;code&gt;agi&lt;/code&gt; program.&lt;/p&gt;

</description>
      <category>agi</category>
      <category>asterisk</category>
      <category>database</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Sharing of how I made my own command</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 25 Jun 2021 02:34:54 +0000</pubDate>
      <link>https://dev.to/ekim34351855/sharing-of-how-i-made-my-own-command-5dfl</link>
      <guid>https://dev.to/ekim34351855/sharing-of-how-i-made-my-own-command-5dfl</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Last week was a hectic journey. I didn't have much time working on blog writing. So this blog wouldn't be as detailed as others I've written. Despite that, I would like to share with you some tips for making your own command on Ubuntu. &lt;/p&gt;

&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/multi-master-vrrp-set-up-5f2g"&gt;Multi-Master VRRP set-up&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How I made my own command ?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Writing in &lt;code&gt;~./bashrc&lt;/code&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After writing a &lt;code&gt;.js&lt;/code&gt; file or other kinds of files, you could run it with &lt;code&gt;node&lt;/code&gt; or other runtime tools. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the &lt;code&gt;~./bashrc&lt;/code&gt;, we could make use of &lt;code&gt;alias&lt;/code&gt; to help us run those files in a much easier way&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For example to execute &lt;code&gt;node abcd.js&lt;/code&gt;, we could make it with as simple as only one word &lt;code&gt;abcd&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Here is how we could do it&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;       &lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;abcd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"node /var/local/abcd.js"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The down side of writing &lt;code&gt;alias&lt;/code&gt; in &lt;code&gt;~./bashrc&lt;/code&gt; is that the script can only be used by the users whose &lt;code&gt;~./bashrc&lt;/code&gt;  has those script. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If there are multiple accounts in the server, you could not make sure that everyone could use that shortcut&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Writing an executable at &lt;code&gt;/usr/local/bin&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An executable is a file which is set to be executed&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In that file, you specify how the script is run&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using the above &lt;code&gt;abcd&lt;/code&gt; as an example, what you need is the following&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;       &lt;span class="nb"&gt;cd&lt;/span&gt; /usr/local/bin
       &lt;span class="nb"&gt;touch &lt;/span&gt;abcd
       &lt;span class="nb"&gt;chmod &lt;/span&gt;a+x ./abcd         &lt;span class="c"&gt;# enable execution for all groups&lt;/span&gt;

       &lt;span class="c"&gt;# edit the executable&lt;/span&gt;
       vim abcd

       &lt;span class="c"&gt;# ------- vim abcd -------&lt;/span&gt;
       &lt;span class="c"&gt;#!bin/bash&lt;/span&gt;

       node &lt;span class="s2"&gt;"/var/local/abcd.js"&lt;/span&gt;
       &lt;span class="c"&gt;# ------- vim abcd -------&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;By doing so, every user could use the &lt;code&gt;abcd&lt;/code&gt; command&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the &lt;code&gt;abcd.js&lt;/code&gt; accepts 3 arguments, which you include something like &lt;code&gt;let [ var1, var2, var 3] = process.argv.slice(2)&lt;/code&gt; in your &lt;code&gt;.js&lt;/code&gt; file to get the arguments , you could further do this&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;       &lt;span class="c"&gt;# ------- vim abcd -------&lt;/span&gt;
       &lt;span class="c"&gt;#!bin/bash&lt;/span&gt;

       node &lt;span class="s2"&gt;"/var/local/abcd.js"&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt; &lt;span class="nv"&gt;$2&lt;/span&gt; &lt;span class="nv"&gt;$3&lt;/span&gt;
       &lt;span class="c"&gt;# ------- vim abcd -------&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Now, you have created a command called &lt;code&gt;abcd&lt;/code&gt; in your system. Input your newly created command into your console and see if it could run as expected. If I did anything wrong, please let me know as well. That's all for today. I hope you enjoy reading. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Multi-Master VRRP set-up</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 18 Jun 2021 04:31:15 +0000</pubDate>
      <link>https://dev.to/ekim34351855/multi-master-vrrp-set-up-5f2g</link>
      <guid>https://dev.to/ekim34351855/multi-master-vrrp-set-up-5f2g</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;In the last week sharing, I revealed that I had failed to make my VRRP working. Fortunately, that was fixed and is running successfully now. One thing I noticed was that most resources online only taught people how to make master-backup VRRP instead of master-master. Today, I would like to share my configurations of &lt;code&gt;Keepalived&lt;/code&gt; for master-master usage. &lt;/p&gt;

&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/pptp-vpn-without-gui-56d5"&gt;PPTP VPN without GUI&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation and configurations of keepalived
&lt;/h3&gt;

&lt;p&gt;Machine one&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;keepalived
&lt;span class="nb"&gt;cd&lt;/span&gt; /etc/keepalived
vim keepalived.conf

&lt;span class="c"&gt;# ----- vim keepalived.conf -----&lt;/span&gt;
vrrp_instance machineOne &lt;span class="o"&gt;{&lt;/span&gt;
        state MASTER
        nopreempt                   &lt;span class="c"&gt;# preempt = get back the master position when recovers, nopreempt = stay in backup position when recovers (dual-master setting)&lt;/span&gt;
        interface eno1              &lt;span class="c"&gt;# interface&lt;/span&gt;
        virtual_router_id 101
        priority 101                &lt;span class="c"&gt;# same priority to make sure both machines are master&lt;/span&gt;
        advert_int 1                &lt;span class="c"&gt;# interval between advertisements&lt;/span&gt;
        authentication &lt;span class="o"&gt;{&lt;/span&gt;
                auth_type PASS
                auth_pass abcdefg
        &lt;span class="o"&gt;}&lt;/span&gt;
        virtual_ipaddress &lt;span class="o"&gt;{&lt;/span&gt;         &lt;span class="c"&gt;# virtual IP &lt;/span&gt;
                192.168.29.11
        &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;# ----- vim keepalived.conf -----&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Machine two&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;keepalived
&lt;span class="nb"&gt;cd&lt;/span&gt; /etc/keepalived
vim keepalived.conf

&lt;span class="c"&gt;# ----- vim keepalived.conf -----&lt;/span&gt;
vrrp_instance esl35 &lt;span class="o"&gt;{&lt;/span&gt;
        state MASTER
        nopreempt
        interface eno1
        virtual_router_id 101
        priority 101
        advert_int 1
        authentication &lt;span class="o"&gt;{&lt;/span&gt;
                auth_type PASS
                auth_pass abcdefg
        &lt;span class="o"&gt;}&lt;/span&gt;
        virtual_ipaddress &lt;span class="o"&gt;{&lt;/span&gt;
                192.168.29.11
        &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;# ----- vim keepalived.conf -----&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  SSH key integration
&lt;/h3&gt;

&lt;p&gt;Before starting the &lt;code&gt;keepalived&lt;/code&gt; service, we need to make sure that the SSH key files are the two machines are the same if master-master VRRP approach is adopted. This will avoid conflicts between machines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# In any one of the machine&lt;/span&gt;
&lt;span class="c"&gt;# e.g. 192.168.29.10&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /etc/ssh
&lt;span class="nb"&gt;ls&lt;/span&gt; 

&lt;span class="c"&gt;# ----- ls -----&lt;/span&gt;
&lt;span class="c"&gt;#moduli        sshd_config       ssh_host_dsa_key.pub    ssh_host_ed25519_key      ssh_host_rsa_key.pub&lt;/span&gt;
&lt;span class="c"&gt;#ssh_config    sshd_config.d     ssh_host_ecdsa_key      ssh_host_ed25519_key.pub  ssh_import_id&lt;/span&gt;
&lt;span class="c"&gt;#ssh_config.d  ssh_host_dsa_key  ssh_host_ecdsa_key.pub  ssh_host_rsa_key&lt;/span&gt;
&lt;span class="c"&gt;# ----- ls -----&lt;/span&gt;

&lt;span class="c"&gt;# syncing all those files to another machine&lt;/span&gt;
&lt;span class="c"&gt;# account@server-ip should be like abcd@192.168.29.10&lt;/span&gt;
rsync ./&lt;span class="k"&gt;*&lt;/span&gt; &amp;lt; account@server-ip &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;:/etc/ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;I hope you enjoy my sharing so far. I am not sure if I could keep writing and sharing every week. I aimed to make the VRRP working through &lt;code&gt;rVRRPd&lt;/code&gt;, but I could not find sufficient resources that could help me set that up successfully. If you do know how to make it working, please comment below no matter how ancient this sharing has become. &lt;/p&gt;

</description>
      <category>vrrp</category>
      <category>keepalived</category>
      <category>rvrrpd</category>
      <category>beginners</category>
    </item>
    <item>
      <title>PPTP VPN without GUI</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 11 Jun 2021 03:14:07 +0000</pubDate>
      <link>https://dev.to/ekim34351855/pptp-vpn-without-gui-56d5</link>
      <guid>https://dev.to/ekim34351855/pptp-vpn-without-gui-56d5</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/a-wee-asterisk-self-signed-certificate-sharing-3p55"&gt;A wee Asterisk self-signed certificate sharing&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Recently, I have been working and experimenting on VRRP stuff. Most resources I found on the Internet are related to CISCO, which is not suitable for me. So, I came up with an idea of connecting my ec2 instances through PPTP VPN to achieve VRRP. Things look logical, but I still failed to make the VRRP running. Nevertheless, allow me to share how you could connect a PPTP VPN on Ubuntu without the help of GUI. &lt;/p&gt;

&lt;h3&gt;
  
  
  PPTP VPN set-up
&lt;/h3&gt;

&lt;p&gt;Since I am using an ASUS router, it is pretty easy to set up a PPTP VPN server. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.asus.com/en/support/FAQ/114892/"&gt;https://www.asus.com/en/support/FAQ/114892/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Ubuntu PPTP VPN connection
&lt;/h3&gt;

&lt;p&gt;Connecting VPN with GUI is pretty easy. However, as I am working on a headless Ubuntu, I need to do the configurations myself. Here is what I found online, which is very useful. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://wiki.archlinux.org/title/PPTP_Client"&gt;https://wiki.archlinux.org/title/PPTP_Client&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Installation of PPTP client
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Installation of PPTP client&lt;/span&gt;
apt-get update
apt-get upgrade
apt-get autoclean
apt-get &lt;span class="nb"&gt;install &lt;/span&gt;pptp-linux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Options set-up
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# options set-up&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /etc/ppp/
vim options

&lt;span class="c"&gt;# --------- options ---------&lt;/span&gt;
&lt;span class="c"&gt;# Lock the port&lt;/span&gt;
lock
&lt;span class="c"&gt;# We don't need the tunnel server to authenticate itself&lt;/span&gt;
noauth
&lt;span class="c"&gt;# Turn off compression protocols we know won't be used&lt;/span&gt;
nobsdcomp
nodeflate
&lt;span class="c"&gt;# We won't do PAP, EAP, CHAP, or MSCHAP, but we will accept MSCHAP-V2&lt;/span&gt;
&lt;span class="c"&gt;# (you may need to remove these refusals if the server is not using MPPE)&lt;/span&gt;
refuse-pap
refuse-eap
refuse-chap
refuse-mschap
&lt;span class="c"&gt;# --------- options ---------&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  chap-secrets set-up
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# chap-secrets set-up&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;0600 /etc/ppp/chap-secrets
vim /etc/ppp/chap-secrets

&lt;span class="c"&gt;# --------- chap-secrets ---------&lt;/span&gt;
&lt;span class="c"&gt;# Secrets for authentication using CHAP&lt;/span&gt;
&lt;span class="c"&gt;# client        server  secret                  IP addresses&lt;/span&gt;
&amp;lt;username&amp;gt;      PPTP    &amp;lt;password&amp;gt;     &lt;span class="k"&gt;*&lt;/span&gt;
&lt;span class="c"&gt;# --------- chap-secrets ---------&lt;/span&gt;

&lt;span class="c"&gt;# username and password are your VPN login name and password set in the PPTP server via your router&lt;/span&gt;
&lt;span class="c"&gt;# remember to use double quote for both of your username and password&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  tunnel name
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# giving name for your vpn connection&lt;/span&gt;
&lt;span class="nb"&gt;touch&lt;/span&gt; /etc/ppp/peers/vpn            &lt;span class="c"&gt;# I want my vpn connection called "vpn"&lt;/span&gt;
vim /etc/ppp/peers/vpn  

&lt;span class="c"&gt;# --------- tunnel ---------&lt;/span&gt;
pty &lt;span class="s2"&gt;"pptp &amp;lt;server&amp;gt; --nolaunchpppd"&lt;/span&gt;
name &amp;lt;username&amp;gt;
remotename PPTP
require-mppe-128
file /etc/ppp/options
ipparam &amp;lt;tunnel&amp;gt;
&lt;span class="c"&gt;# --------- tunnel ---------&lt;/span&gt;

&lt;span class="c"&gt;# server means the remote address of the VPN server (I used my own public IP)&lt;/span&gt;
&lt;span class="c"&gt;# tunnel means the name of the connection, which is "vpn" in this example &lt;/span&gt;

&lt;span class="c"&gt;# remember to use double quote for both of your username&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Implementation
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Connect&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;pon vpn                                &lt;span class="c"&gt;# start PPTP VPN connection4&lt;/span&gt;

&lt;span class="c"&gt;# Check&lt;/span&gt;
ip addr     
&lt;span class="c"&gt;# you should see a ppp0 interface with a subnet address&lt;/span&gt;

&lt;span class="c"&gt;# ppp0: &amp;lt;POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP&amp;gt; mtu 1446 qdisc fq_codel state UNKNOWN group default qlen 3&lt;/span&gt;
    &lt;span class="c"&gt;# link/ppp&lt;/span&gt;
    &lt;span class="c"&gt;# inet 192.168.10.9 peer 192.168.1.1/32 scope global ppp0&lt;/span&gt;
       &lt;span class="c"&gt;# valid_lft forever preferred_lft forever&lt;/span&gt;

&lt;span class="c"&gt;# Disconnect&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;poff vpn                           &lt;span class="c"&gt;# turn off the PPTP VPN connection&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Routing of servers
&lt;/h3&gt;

&lt;p&gt;If you have multiple devices using the VPN, it does not mean that they could connect with each other automatically. When you ping from one device to another, you would receive no response as the routing has not yet been set up. &lt;/p&gt;

&lt;p&gt;Therefore, you may need to add the following command in your devices&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Route all the traffic with a destination of 192.168.10. through ppp0 interface&lt;/span&gt;
ip route add 192.168.10.0/24 dev ppp0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Hardly could I find resources on VPN connection fully with command lines. I hope you would somehow find this sharing useful. That's all for today. See you next time. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>vpn</category>
      <category>vrrp</category>
      <category>networking</category>
    </item>
    <item>
      <title>A wee Asterisk self-signed certificate sharing</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 04 Jun 2021 02:36:20 +0000</pubDate>
      <link>https://dev.to/ekim34351855/a-wee-asterisk-self-signed-certificate-sharing-3p55</link>
      <guid>https://dev.to/ekim34351855/a-wee-asterisk-self-signed-certificate-sharing-3p55</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/basic-ivr-with-asterisk-4elj"&gt;Basic IVR with Asterisk&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Last week, I was doing something related to WebRTC, which was an amazing experience. However, there's one thing I got stuck for a pretty long time related to web socket. It turns out I had to manually permit access for different ports I used even though I had created a self-signed certificate. Today, I would like to share how to create a self-signed certificate on Asterisk and import that into your browser. &lt;/p&gt;

&lt;h3&gt;
  
  
  Create your self-signed certificate
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It is not difficult to create a self-signed certificate.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /asterisk-18.3.0/contrib/scripts         &lt;span class="c"&gt;# go to /contrib/script&lt;/span&gt;

&lt;span class="c"&gt;# -C = DNS name or our IP address, -O = organizational name, -d = output directory of the keys&lt;/span&gt;
&lt;span class="c"&gt;# use the same pass phrase you want for the whole registration&lt;/span&gt;
&lt;span class="nb"&gt;sudo&lt;/span&gt; ./ast_tls_cert &lt;span class="nt"&gt;-C&lt;/span&gt; &amp;lt;server-ip&amp;gt; &lt;span class="nt"&gt;-O&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;organizational name&amp;gt;"&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; /etc/asterisk/keys

&lt;span class="c"&gt;# check if the 'keys' file exists&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; 1 /etc/asterisk/keys

&lt;span class="nb"&gt;sudo &lt;/span&gt;service asterisk restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Import your certificate to let waive manual permission access
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Now, we are going to import our &lt;code&gt;ca.crt&lt;/code&gt; into our browser. I will use Firefox and Chrome as examples. &lt;/li&gt;
&lt;li&gt;You may wonder why you need to import the certificate. The reason is that once you import your certificate, you don't need to permit access for browser to go to your web every time. &lt;/li&gt;
&lt;li&gt;More importantly, when you play around with WebRTC, you need to enable the web socket every time if you don't do so, which is absolutely annoying. &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Firefox browser set-up
&lt;/h4&gt;

&lt;p&gt;If you are using &lt;strong&gt;Firefox browser&lt;/strong&gt;, please:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Go to "Options"&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1saVuuyxWjG6bzpWkec2GeITZjs6rPgUT" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1saVuuyxWjG6bzpWkec2GeITZjs6rPgUT" alt="microsip-set-up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Select "Privacy &amp;amp; Security"&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D18yybvBIaZ4CC3j5QRamWbsAGoKPptBFi" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D18yybvBIaZ4CC3j5QRamWbsAGoKPptBFi" alt="microsip-set-up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Scroll to the bottom of the page under "Security" and "Certificates"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Select "View Certificates"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D19EEiZ26P7Rh7tPfnGrjlOnmvZNIY8srl" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D19EEiZ26P7Rh7tPfnGrjlOnmvZNIY8srl" alt="microsip-set-up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Make sure "Authorities is selected"&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1vwQ9x-k75v_8ytpK3ZkQa77tUkbPLmc_" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1vwQ9x-k75v_8ytpK3ZkQa77tUkbPLmc_" alt="microsip-set-up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Import "ca.crt", the self-signed certificate we have just created, which is located at /etc/asterisk/keys&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Check "Trust this CA to identify websites" and "Trust this CA to identify email users"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1F68cRGC-pLSiT9Ct15Gxnxwo-3KZRHtN" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1F68cRGC-pLSiT9Ct15Gxnxwo-3KZRHtN" alt="microsip-set-up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Then click "ok"&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;If you also face the web socket granting permission problem like I did, I hope you would find this article helpful to you. Or if you are interested in WebRTC, please check out this guide: &lt;a href="https://github.com/paneru-rajan/asterisk-jssip" rel="noopener noreferrer"&gt;https://github.com/paneru-rajan/asterisk-jssip&lt;/a&gt;. A big shoutout to &lt;a href="https://github.com/paneru-rajan" rel="noopener noreferrer"&gt;paneru-rajan&lt;/a&gt; who provides the WebRTC set-up guide. In the meantime, please take care and stay healthy, and I will see you next week. &lt;/p&gt;

</description>
      <category>asterisk</category>
      <category>websocket</category>
      <category>webrtc</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Basic IVR with Asterisk</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 28 May 2021 03:14:19 +0000</pubDate>
      <link>https://dev.to/ekim34351855/basic-ivr-with-asterisk-4elj</link>
      <guid>https://dev.to/ekim34351855/basic-ivr-with-asterisk-4elj</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/asterisk-manager-with-javascript-4idc"&gt;Asterisk Manager with JavaScript&lt;/a&gt; &lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Today, I would like to share how we could make a simple interactive voice response (IVR). I know you might have had some horrible experiences with that, but it would be a weird but fun experience when you hear your voice on the phone talking to you. &lt;/p&gt;

&lt;h3&gt;
  
  
  What is Interactive Voice Response (IVR) menu?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;An IVR menu is a list of options that are presented to an &lt;strong&gt;inbound caller&lt;/strong&gt; which prompts them to &lt;strong&gt;make a selection&lt;/strong&gt;, thus qualifying the call and &lt;strong&gt;directing&lt;/strong&gt; it to the most &lt;strong&gt;appropriate contact&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Recording our own audio track through Asterisk for IVR
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you have read my previous posts, you would know that the codecs that telephony supports are limited. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Even if you have recorded a very good quality audio track, you still need to convert it into the format that our phones support. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To save time, I am not going to go through the &lt;code&gt;ffmpeg&lt;/code&gt; part again. Instead, I am going to record all the IVR audio track through the &lt;code&gt;Record&lt;/code&gt; dialplan application. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In pjsip.conf&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;    [&lt;span class="n"&gt;transport&lt;/span&gt;-&lt;span class="n"&gt;udp&lt;/span&gt;-&lt;span class="n"&gt;nat&lt;/span&gt;]
    &lt;span class="n"&gt;type&lt;/span&gt; = &lt;span class="n"&gt;transport&lt;/span&gt;
    &lt;span class="n"&gt;protocol&lt;/span&gt; = &lt;span class="n"&gt;udp&lt;/span&gt;
    &lt;span class="n"&gt;bind&lt;/span&gt; = &lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;

    [&lt;span class="n"&gt;calling&lt;/span&gt;](!)                 
    &lt;span class="n"&gt;type&lt;/span&gt;=&lt;span class="n"&gt;endpoint&lt;/span&gt;                
    &lt;span class="n"&gt;context&lt;/span&gt;=&lt;span class="n"&gt;interaction&lt;/span&gt;          
    &lt;span class="n"&gt;allow&lt;/span&gt; = !&lt;span class="n"&gt;all&lt;/span&gt;, &lt;span class="n"&gt;ulaw&lt;/span&gt;, &lt;span class="n"&gt;alaw&lt;/span&gt;     
    &lt;span class="n"&gt;direct_media&lt;/span&gt;=&lt;span class="n"&gt;no&lt;/span&gt;              
    &lt;span class="n"&gt;trust_id_outbound&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
    &lt;span class="n"&gt;rtp_symmetric&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
    &lt;span class="n"&gt;force_rport&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
    &lt;span class="n"&gt;rewrite_contact&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
    &lt;span class="n"&gt;device_state_busy_at&lt;/span&gt;=&lt;span class="m"&gt;1&lt;/span&gt;
    &lt;span class="n"&gt;dtmf_mode&lt;/span&gt;=&lt;span class="n"&gt;rfc4733&lt;/span&gt;

    [&lt;span class="n"&gt;auth&lt;/span&gt;-&lt;span class="n"&gt;userpass&lt;/span&gt;](!)       
    &lt;span class="n"&gt;type&lt;/span&gt; = &lt;span class="n"&gt;auth&lt;/span&gt;              
    &lt;span class="n"&gt;auth_type&lt;/span&gt; = &lt;span class="n"&gt;userpass&lt;/span&gt;     
    [&lt;span class="n"&gt;aor&lt;/span&gt;-&lt;span class="n"&gt;single&lt;/span&gt;-&lt;span class="n"&gt;reg&lt;/span&gt;](!)     
    &lt;span class="n"&gt;type&lt;/span&gt; = &lt;span class="n"&gt;aor&lt;/span&gt;
    &lt;span class="n"&gt;max_contacts&lt;/span&gt; = &lt;span class="m"&gt;1&lt;/span&gt;         

    [&lt;span class="m"&gt;7000&lt;/span&gt;](&lt;span class="n"&gt;calling&lt;/span&gt;)          
    &lt;span class="n"&gt;auth&lt;/span&gt;=&lt;span class="m"&gt;7000&lt;/span&gt;                
    &lt;span class="n"&gt;aors&lt;/span&gt;=&lt;span class="m"&gt;7000&lt;/span&gt;                
    &lt;span class="n"&gt;callerid&lt;/span&gt; = &lt;span class="m"&gt;7000&lt;/span&gt; &amp;lt;&lt;span class="m"&gt;7000&lt;/span&gt;&amp;gt;   

    [&lt;span class="m"&gt;7000&lt;/span&gt;](&lt;span class="n"&gt;auth&lt;/span&gt;-&lt;span class="n"&gt;userpass&lt;/span&gt;)    
    &lt;span class="n"&gt;password&lt;/span&gt; = &lt;span class="m"&gt;7000&lt;/span&gt;
    &lt;span class="n"&gt;username&lt;/span&gt; = &lt;span class="m"&gt;7000&lt;/span&gt;

    [&lt;span class="m"&gt;7000&lt;/span&gt;](&lt;span class="n"&gt;aor&lt;/span&gt;-&lt;span class="n"&gt;single&lt;/span&gt;-&lt;span class="n"&gt;reg&lt;/span&gt;)
    &lt;span class="n"&gt;mailboxes&lt;/span&gt; = &lt;span class="m"&gt;7000&lt;/span&gt;@&lt;span class="n"&gt;main&lt;/span&gt;

    [&lt;span class="m"&gt;7100&lt;/span&gt;](&lt;span class="n"&gt;calling&lt;/span&gt;)
    &lt;span class="n"&gt;auth&lt;/span&gt;=&lt;span class="m"&gt;7100&lt;/span&gt;
    &lt;span class="n"&gt;aors&lt;/span&gt;=&lt;span class="m"&gt;7100&lt;/span&gt;
    &lt;span class="n"&gt;callerid&lt;/span&gt; = &lt;span class="m"&gt;7100&lt;/span&gt; &amp;lt;&lt;span class="m"&gt;7100&lt;/span&gt;&amp;gt;

    [&lt;span class="m"&gt;7100&lt;/span&gt;](&lt;span class="n"&gt;auth&lt;/span&gt;-&lt;span class="n"&gt;userpass&lt;/span&gt;)
    &lt;span class="n"&gt;password&lt;/span&gt; = &lt;span class="m"&gt;7100&lt;/span&gt;
    &lt;span class="n"&gt;username&lt;/span&gt; = &lt;span class="m"&gt;7100&lt;/span&gt;

    [&lt;span class="m"&gt;7100&lt;/span&gt;](&lt;span class="n"&gt;aor&lt;/span&gt;-&lt;span class="n"&gt;single&lt;/span&gt;-&lt;span class="n"&gt;reg&lt;/span&gt;)
    &lt;span class="n"&gt;mailboxes&lt;/span&gt; = &lt;span class="m"&gt;7100&lt;/span&gt;@&lt;span class="n"&gt;main&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In extensions.conf
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;[&lt;span class="n"&gt;interaction&lt;/span&gt;]
&lt;span class="n"&gt;exten&lt;/span&gt; = *&lt;span class="m"&gt;555&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;NoOp&lt;/span&gt;(&lt;span class="n"&gt;recording&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Answer&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Record&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/&lt;span class="n"&gt;greeting&lt;/span&gt;.&lt;span class="n"&gt;wav&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;vm&lt;/span&gt;-&lt;span class="n"&gt;received&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;en&lt;/span&gt;/&lt;span class="n"&gt;digits&lt;/span&gt;/&lt;span class="m"&gt;1&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Record&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/&lt;span class="n"&gt;press1&lt;/span&gt;.&lt;span class="n"&gt;wav&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;vm&lt;/span&gt;-&lt;span class="n"&gt;received&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;en&lt;/span&gt;/&lt;span class="n"&gt;digits&lt;/span&gt;/&lt;span class="m"&gt;2&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Record&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/&lt;span class="n"&gt;press2&lt;/span&gt;.&lt;span class="n"&gt;wav&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;vm&lt;/span&gt;-&lt;span class="n"&gt;received&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;en&lt;/span&gt;/&lt;span class="n"&gt;digits&lt;/span&gt;/&lt;span class="m"&gt;3&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;vm&lt;/span&gt;-&lt;span class="n"&gt;last&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Record&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/&lt;span class="n"&gt;wrong&lt;/span&gt;-&lt;span class="n"&gt;key&lt;/span&gt;.&lt;span class="n"&gt;wav&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;vm&lt;/span&gt;-&lt;span class="n"&gt;received&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;en&lt;/span&gt;/&lt;span class="n"&gt;digits&lt;/span&gt;/&lt;span class="m"&gt;4&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Hangup&lt;/span&gt;

;&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="err"&gt;_&lt;/span&gt;&lt;span class="m"&gt;7&lt;/span&gt;&lt;span class="n"&gt;X00&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;NoOp&lt;/span&gt;(&lt;span class="n"&gt;Call&lt;/span&gt; &lt;span class="n"&gt;for&lt;/span&gt; ${&lt;span class="n"&gt;EXTEN&lt;/span&gt;})    
;&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Dial&lt;/span&gt;(&lt;span class="n"&gt;PJSIP&lt;/span&gt;/${&lt;span class="n"&gt;EXTEN&lt;/span&gt;})      
;&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Hangup&lt;/span&gt;    

&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="m"&gt;8888&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;NoOp&lt;/span&gt;(&lt;span class="n"&gt;Call&lt;/span&gt; &lt;span class="n"&gt;IVR&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Goto&lt;/span&gt;(&lt;span class="n"&gt;ivr&lt;/span&gt;,&lt;span class="n"&gt;s&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;)

[&lt;span class="n"&gt;ivr&lt;/span&gt;]
&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="n"&gt;s&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;NoOp&lt;/span&gt;(&lt;span class="n"&gt;You&lt;/span&gt; &lt;span class="n"&gt;are&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;IVR&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Answer&lt;/span&gt;                     ; &lt;span class="n"&gt;here&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;SIP&lt;/span&gt; &lt;span class="n"&gt;protocol&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;(&lt;span class="n"&gt;play&lt;/span&gt;),&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/&lt;span class="n"&gt;greeting&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;WaitExten&lt;/span&gt;(&lt;span class="m"&gt;10&lt;/span&gt;)              ; &lt;span class="n"&gt;wait&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt; &lt;span class="n"&gt;seconds&lt;/span&gt; &lt;span class="n"&gt;for&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;caller&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;press&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;

&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;NoOp&lt;/span&gt;(&lt;span class="n"&gt;Pressed&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/&lt;span class="n"&gt;press1&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Goto&lt;/span&gt;(&lt;span class="n"&gt;s&lt;/span&gt;,&lt;span class="n"&gt;play&lt;/span&gt;)               ; &lt;span class="n"&gt;go&lt;/span&gt; &lt;span class="n"&gt;back&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="s1"&gt;'n(play),Playback(record/greeting)'&lt;/span&gt;

&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="m"&gt;2&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;NoOp&lt;/span&gt;(&lt;span class="n"&gt;Pressed&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/&lt;span class="n"&gt;press2&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Goto&lt;/span&gt;(&lt;span class="n"&gt;s&lt;/span&gt;,&lt;span class="n"&gt;play&lt;/span&gt;)

&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="n"&gt;i&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;NoOp&lt;/span&gt;(&lt;span class="n"&gt;unknown&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;)       ; &lt;span class="n"&gt;handle&lt;/span&gt; &lt;span class="n"&gt;invalid&lt;/span&gt; &lt;span class="n"&gt;keys&lt;/span&gt; --&amp;gt; &lt;span class="n"&gt;when&lt;/span&gt; &lt;span class="n"&gt;keys&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt; &lt;span class="n"&gt;than&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt; &lt;span class="n"&gt;are&lt;/span&gt; &lt;span class="n"&gt;pressed&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/&lt;span class="n"&gt;wrong&lt;/span&gt;-&lt;span class="n"&gt;key&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Goto&lt;/span&gt;(&lt;span class="n"&gt;s&lt;/span&gt;,&lt;span class="n"&gt;play&lt;/span&gt;)

&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="n"&gt;t&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;NoOp&lt;/span&gt;(&lt;span class="n"&gt;Waited&lt;/span&gt; &lt;span class="n"&gt;too&lt;/span&gt; &lt;span class="n"&gt;long&lt;/span&gt; &lt;span class="n"&gt;for&lt;/span&gt; &lt;span class="n"&gt;exten&lt;/span&gt;)     ; &lt;span class="n"&gt;handle&lt;/span&gt; &lt;span class="n"&gt;WaitExten&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Goto&lt;/span&gt;(&lt;span class="n"&gt;s&lt;/span&gt;,&lt;span class="n"&gt;play&lt;/span&gt;)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Implementation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;First of all, let's record all the necessary navigation menu tracks. &lt;/li&gt;
&lt;li&gt;I have set in the dialplan that when we call

&lt;code&gt;*555&lt;/code&gt;

, we will start recording each audio file one by one.
- When you hear the first 'beep' sound, it is for the recording of the greeting. 
- For example, "thanks for calling, English, press 1; Deutsch, press 2". 
- When you finish each recording, remember to press

&lt;code&gt;#&lt;/code&gt;

to save it. &lt;/li&gt;
&lt;li&gt;If successful, you will hear the number of recording received. 

&lt;ul&gt;
&lt;li&gt;If you finished one recording, you will hear "received 1"&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;When you hear "last", that means you are going to record the last audio. &lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Here is the sequence of the recording sections&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;greeting

&lt;ol&gt;
&lt;li&gt;the navigation after pressing 1&lt;/li&gt;
&lt;li&gt;the navigation after pressing 2&lt;/li&gt;
&lt;li&gt;the navigation when wrong key is pressed&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To go into the IVR, dial &lt;code&gt;8888&lt;/code&gt; and it will start the IVR menu. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Now, you have just made yourself an IVR menu. If you follow tight, you would realize that the whole IVR is a loop. You could feel free to add the &lt;code&gt;Hangup&lt;/code&gt; dialplan application wherever you like. One thing I would like to stress here is that this IVR structure is a very basic one as things are repetitive and could be refactorized in another way. A more advanced one might be introduced some time later (I hope ... ) with the use of database and AGI (Asterisk Gateway Interface). That's all for today. See you next time. &lt;/p&gt;

</description>
      <category>asterisk</category>
      <category>ivr</category>
      <category>beginners</category>
      <category>voip</category>
    </item>
    <item>
      <title>Asterisk Manager with JavaScript</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 21 May 2021 03:35:42 +0000</pubDate>
      <link>https://dev.to/ekim34351855/asterisk-manager-with-javascript-4idc</link>
      <guid>https://dev.to/ekim34351855/asterisk-manager-with-javascript-4idc</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/brief-intro-of-asterisk-manager-1n65"&gt;Brief intro of Asterisk Manager&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;This time, we will go through how we could control the asterisk through our codes. Below, I will use JavaScript to illustrate how you could fiddle with asterisk without the CLI (command-line interface). And as the previous sharing, my pjsip.conf and extensions.conf align with &lt;a href="https://dev.to/ekim34351855/asterisk-basic-set-up-4ple"&gt;my first sharing&lt;/a&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Set up your environment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Install the package we need
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;asterisk-ami-client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Coding section
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a

&lt;code&gt;main.js&lt;/code&gt;

file and copy these
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;AmiClient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;asterisk-ami-client&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;AmiClient&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="nx"&gt;client&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;YOUR USERNAME&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;YOUR PASSWORD&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;127.0.0.1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5038&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;     &lt;span class="c1"&gt;// connect to your AMI remotely&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="nx"&gt;client&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;connect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;connect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;                &lt;span class="c1"&gt;// show connection logs in terminal&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;event&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;                   &lt;span class="c1"&gt;// show AMI event logs in terminal&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;response&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;          &lt;span class="c1"&gt;// show response logs in terminal&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;disconnect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;disconnect&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;          &lt;span class="c1"&gt;// show disconnection logs in terminal&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;reconnection&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;reconnection&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;      &lt;span class="c1"&gt;// show reconnection logs in terminal&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;internalError&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;           &lt;span class="c1"&gt;// show AMI error logs in terminal&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;action&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;                                                   &lt;span class="c1"&gt;// manager action   &lt;/span&gt;
                &lt;span class="na"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Originate&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                                     &lt;span class="c1"&gt;// Originate call&lt;/span&gt;
                &lt;span class="na"&gt;Channel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;PJSIP/7000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                                   &lt;span class="c1"&gt;// calling from endpoint 7000&lt;/span&gt;
                &lt;span class="na"&gt;Exten&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;7100&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                                           &lt;span class="c1"&gt;// expected to be received by endpoint 7100&lt;/span&gt;
                &lt;span class="na"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;interaction&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;Priority&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;please replace &lt;code&gt;"&amp;lt;YOUR USERNAME&amp;gt;"&lt;/code&gt;  and &lt;code&gt;"&amp;lt;YOUR PASSWORD&amp;gt;"&lt;/code&gt; with your AMI login username and password. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then, it's time to run the code&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    node main.js            &lt;span class="c"&gt;# make sure you execute the command in the correct path that has the newly created main.js&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You should now be able to originate a call without using the CLI. And in your terminal, your could see all the states and processes of asterisk when you connect to the AMI and originate the call. You could use them to do different kinds of things. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For example, think about converting voice messages in the voicemail into texts, and then send those texts to a telegram group. Wouldn't it be amazing? &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It is a short and simple sharing, but you could do various things based on it. I tend to keep things easy and avoid people getting overwhelmed by the asterisk thing. I hope you enjoy my reading so far. In the meantime, stay healthy and stay tuned for more content !!! &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>asterisk</category>
      <category>beginners</category>
      <category>ami</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Brief intro of Asterisk Manager</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 14 May 2021 04:02:57 +0000</pubDate>
      <link>https://dev.to/ekim34351855/brief-intro-of-asterisk-manager-1n65</link>
      <guid>https://dev.to/ekim34351855/brief-intro-of-asterisk-manager-1n65</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/make-calls-through-asterisk-cli-45ba"&gt;Make calls through Asterisk CLI&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;After being able to make calls and play around with playback and record dialplan applications, it's time to prepare ourselves for using those functions through codes. But before that, we need to know what Asterisk Manager Interface is. &lt;/p&gt;

&lt;p&gt;**Warning: **Only try the following within your own local network. &lt;/p&gt;

&lt;h3&gt;
  
  
  What is Asterisk Manager Interface ?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It is like a remote control of the asterisk. &lt;/li&gt;
&lt;li&gt;Unlike running asterisk commands on the CLI, the state and process of which cannot be seen and controlled, the asterisk manager interface resolves those issues and helps monitor the operation of the asterisk. &lt;/li&gt;
&lt;li&gt;Since AMI allows you to remotely control the asterisk, it is advised that you do not use AMI directly with a public IP address without protection like SSL connection or a VPN tunnel.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Steps using AMI
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Check if port 5038 is available as we are going to use it.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    netstat &lt;span class="nt"&gt;-lpn&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Configure the manager.conf
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;    [&lt;span class="n"&gt;general&lt;/span&gt;]
    &lt;span class="n"&gt;enabled&lt;/span&gt; = &lt;span class="n"&gt;yes&lt;/span&gt;       ;&lt;span class="n"&gt;by&lt;/span&gt; &lt;span class="n"&gt;default&lt;/span&gt;, &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="s2"&gt;"no"&lt;/span&gt; &lt;span class="n"&gt;for&lt;/span&gt; &lt;span class="n"&gt;security&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;.
    &lt;span class="n"&gt;port&lt;/span&gt; = &lt;span class="m"&gt;5038&lt;/span&gt;
    &lt;span class="n"&gt;bindaddr&lt;/span&gt; = &lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;  ;&lt;span class="n"&gt;bind&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;ip&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;localhost&lt;/span&gt; &lt;span class="n"&gt;for&lt;/span&gt; &lt;span class="n"&gt;lcoal&lt;/span&gt; &lt;span class="n"&gt;testing&lt;/span&gt;, &lt;span class="n"&gt;need&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;change&lt;/span&gt; &lt;span class="n"&gt;when&lt;/span&gt; &lt;span class="n"&gt;remote&lt;/span&gt; &lt;span class="n"&gt;control&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;
    [&lt;span class="n"&gt;ekim&lt;/span&gt;]              ;&lt;span class="n"&gt;login&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;, &lt;span class="n"&gt;often&lt;/span&gt; &lt;span class="n"&gt;for&lt;/span&gt; &lt;span class="n"&gt;CRM&lt;/span&gt;, &lt;span class="n"&gt;ERP&lt;/span&gt; &lt;span class="n"&gt;or&lt;/span&gt; &lt;span class="n"&gt;dialer&lt;/span&gt; 
    &lt;span class="n"&gt;secret&lt;/span&gt;=&lt;span class="n"&gt;xxxxxxxx&lt;/span&gt;     ;&lt;span class="n"&gt;login&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;, &lt;span class="n"&gt;should&lt;/span&gt; &lt;span class="n"&gt;be&lt;/span&gt; &lt;span class="n"&gt;complex&lt;/span&gt;
    &lt;span class="n"&gt;deny&lt;/span&gt;=&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;        ;&lt;span class="n"&gt;deny&lt;/span&gt; &lt;span class="n"&gt;everything&lt;/span&gt; --&amp;gt; &lt;span class="n"&gt;much&lt;/span&gt; &lt;span class="n"&gt;safer&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;permit&lt;/span&gt; &lt;span class="n"&gt;each&lt;/span&gt; &lt;span class="n"&gt;ip&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt; &lt;span class="n"&gt;we&lt;/span&gt; &lt;span class="n"&gt;trust&lt;/span&gt;
    &lt;span class="n"&gt;permit&lt;/span&gt;=&lt;span class="n"&gt;XXX&lt;/span&gt;.&lt;span class="n"&gt;XXX&lt;/span&gt;.&lt;span class="n"&gt;XX&lt;/span&gt;.&lt;span class="n"&gt;XX&lt;/span&gt;/&lt;span class="m"&gt;255&lt;/span&gt;.&lt;span class="m"&gt;255&lt;/span&gt;.&lt;span class="m"&gt;255&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;      ;&lt;span class="n"&gt;permit&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt; &lt;span class="n"&gt;network&lt;/span&gt; &lt;span class="n"&gt;after&lt;/span&gt; &lt;span class="n"&gt;an&lt;/span&gt; &lt;span class="n"&gt;entire&lt;/span&gt; &lt;span class="n"&gt;denial&lt;/span&gt;, &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="n"&gt;can&lt;/span&gt; &lt;span class="n"&gt;also&lt;/span&gt; &lt;span class="n"&gt;be&lt;/span&gt; &lt;span class="n"&gt;done&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;acl&lt;/span&gt;.&lt;span class="n"&gt;conf&lt;/span&gt;
    &lt;span class="n"&gt;read&lt;/span&gt;=&lt;span class="n"&gt;all&lt;/span&gt;        ;&lt;span class="n"&gt;read&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="n"&gt;logs&lt;/span&gt;
    &lt;span class="n"&gt;write&lt;/span&gt;=&lt;span class="n"&gt;all&lt;/span&gt;       ;&lt;span class="n"&gt;write&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="n"&gt;logs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Restart asterisk after &lt;strong&gt;IP and port changes&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="nb"&gt;sudo &lt;/span&gt;service asterisk restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Use &lt;code&gt;telnet&lt;/code&gt; to connect to AMI&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;telnet&lt;/code&gt; allows access to remote servers, which is based on the TELNET protocol. &lt;strong&gt;Only recommend you use &lt;code&gt;telnet&lt;/code&gt; to connect within your own network.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="c"&gt;# telnet &amp;lt;permitted IP address&amp;gt; &amp;lt;port&amp;gt;&lt;/span&gt;
    telnet XXX.XXX.XX.XX 5038
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="c"&gt;# after that, tab "enter" once as we need to continue to login&lt;/span&gt;
    Action:login
    Username:ekim
    Secret:xxxxxxxx
    &lt;span class="c"&gt;# when finish registering, tab "enter" twice for signaling you're done&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;After that, you should see the &lt;code&gt;Response: Success&lt;/code&gt; and could see all actions in the asterisk.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    Response: Success
    Message: Authentication accepted

    Event: FullyBooted
    Privilege: system,all
    Uptime: 67
    LastReload: 67
    Status: Fully Booted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1hCWDgeStQqCyAnChB-HfK954FPdsQRSg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1hCWDgeStQqCyAnChB-HfK954FPdsQRSg" alt="ami"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now, you have accessed to your own asterisk server and entered the AMI. That means you are no longer playing on the CLI. You are 'remotely controlling' your asterisk pbx. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So, why not we try to originate a call (make a call) and see what would happen ?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The below is based on our &lt;a href="https://dev.to/ekim34351855/asterisk-basic-set-up-4ple"&gt;first tutorial&lt;/a&gt; pjsip and dialplan settings&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;      Action:Originate
      Channel:PJSIP/7000
      Exten:7100
      Context:interaction
      Priority:1
&lt;span class="c"&gt;# remember to tab 'enter' twice to signal that you are finished&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D17w7FzjIP0a_WCs4K-ajHEwZIMkGNl7OS" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D17w7FzjIP0a_WCs4K-ajHEwZIMkGNl7OS" alt="7000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D14Twg0hJY5rfP6v7n04biwSdJK28B3sKL" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D14Twg0hJY5rfP6v7n04biwSdJK28B3sKL" alt="7000"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mine is working now, how about yours ? Btw, if you want to leave the AMI, you could do this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;      Action:logoff
      &lt;span class="c"&gt;# remember to tab 'enter' twice to signal that you are finished&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;You might want to keep your eyes close to the log data shown in AMI since those are the things we might need if we touch on the coding part. That's all for today. In the meantime, stay healthy and stay tuned for more content !!! &lt;/p&gt;

</description>
      <category>asterisk</category>
      <category>ami</category>
      <category>beginners</category>
      <category>pbx</category>
    </item>
    <item>
      <title>Make calls through Asterisk CLI</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 07 May 2021 03:18:29 +0000</pubDate>
      <link>https://dev.to/ekim34351855/make-calls-through-asterisk-cli-45ba</link>
      <guid>https://dev.to/ekim34351855/make-calls-through-asterisk-cli-45ba</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/record-and-hear-my-voice-through-asterisk-11om"&gt;Record and Hear your voice through Asterisk&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;As promised, I will go through a more user-friendly process of recording a voice. Also, I would like to show you how to originate a call (make a call) from Asterisk. &lt;/p&gt;

&lt;h3&gt;
  
  
  Voice Navigation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;If you are careful enough, you would have noticed that the &lt;code&gt;Record&lt;/code&gt; dialplan application includes a "beep" sound when you dial 41XXXX. &lt;/li&gt;
&lt;li&gt;So now, let's make our voice navigation based on that.&lt;/li&gt;
&lt;li&gt;Record a track that signals people to start recording their voices after hearing a "beep" sound and press &lt;code&gt;#&lt;/code&gt; when they finish recording. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Phone restriction
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you dial 41XXXX to record your navigation audio, just like the previous sharing, you wouldn't need to worry about the audio restrictions. However, if you record your navigation audio through your smartphone application or other devices, the recording you got is highly likely incompatible with the telephony codecs. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Often, for &lt;strong&gt;hardphones&lt;/strong&gt;, there are restrictions for the audio file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Codec   →  .gsm (convention and saves space) | .wav (better quality but occupying more space)&lt;/li&gt;
&lt;li&gt;Channels    →  mono&lt;/li&gt;
&lt;li&gt;Sample rate     →  8000hz (at max)&lt;/li&gt;
&lt;li&gt;Bits per sample     →  16bits&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So, we need to convert the file into what we need using &lt;code&gt;ffmpeg&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ffmpeg &lt;span class="nt"&gt;-i&lt;/span&gt; &amp;lt;file&amp;gt; &lt;span class="nt"&gt;-ac&lt;/span&gt; 1 &lt;span class="nt"&gt;-ar&lt;/span&gt; 8000 &lt;span class="nt"&gt;-c&lt;/span&gt;:a pcm_s16le &lt;span class="s2"&gt;"&amp;lt;new file&amp;gt;.wav"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Audio track location
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;After that, let's move the converted file to the location where Asterisk stores sounds.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /var/lib/asterisk/sounds/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;I would like to create a folder for better organization, so I create a folder called "playback"
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;playback
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Dialplan modifications
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Going back to our extensions.conf,
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;[&lt;span class="n"&gt;recordAndPlayback&lt;/span&gt;]
&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="err"&gt;_&lt;/span&gt;&lt;span class="m"&gt;41&lt;/span&gt;&lt;span class="n"&gt;XXXX&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;Answer&lt;/span&gt;
; &lt;span class="n"&gt;Playback&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt;; &lt;span class="n"&gt;playback&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;folder&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; /&lt;span class="n"&gt;var&lt;/span&gt;/&lt;span class="n"&gt;lib&lt;/span&gt;/&lt;span class="n"&gt;asterisk&lt;/span&gt;/&lt;span class="n"&gt;sounds&lt;/span&gt;/ ; &lt;span class="n"&gt;xxxxx&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;converted&lt;/span&gt; &lt;span class="n"&gt;audio&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="n"&gt;where&lt;/span&gt; .&lt;span class="n"&gt;wav&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;excluded&lt;/span&gt;.
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;playback&lt;/span&gt;/&lt;span class="n"&gt;xxxxx&lt;/span&gt;)   
; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="n"&gt;your&lt;/span&gt; &lt;span class="n"&gt;voice&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;save&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;XXXX&lt;/span&gt;, &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;any&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt; &lt;span class="n"&gt;digits&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;dialed&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; .&lt;span class="n"&gt;gsm&lt;/span&gt; &lt;span class="n"&gt;format&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Record&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/${&lt;span class="n"&gt;EXTEN&lt;/span&gt;:&lt;span class="m"&gt;2&lt;/span&gt;}.&lt;span class="n"&gt;gsm&lt;/span&gt;)      
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Wait&lt;/span&gt;(&lt;span class="m"&gt;1&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Hangup&lt;/span&gt;()

&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="err"&gt;_&lt;/span&gt;&lt;span class="m"&gt;42&lt;/span&gt;&lt;span class="n"&gt;XXXX&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;Answer&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Wait&lt;/span&gt;(&lt;span class="m"&gt;1&lt;/span&gt;)
; &lt;span class="n"&gt;play&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;audio&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;recorded&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; /&lt;span class="n"&gt;var&lt;/span&gt;/&lt;span class="n"&gt;lib&lt;/span&gt;/&lt;span class="n"&gt;asterisk&lt;/span&gt;/&lt;span class="n"&gt;sounds&lt;/span&gt;/&lt;span class="n"&gt;record&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/${&lt;span class="n"&gt;EXTEN&lt;/span&gt;:&lt;span class="m"&gt;2&lt;/span&gt;})        
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Wait&lt;/span&gt;(&lt;span class="m"&gt;1&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Hangup&lt;/span&gt;()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;As always, after doing changes in the dialplan, reload it in the CLI.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;asterisk &lt;span class="nt"&gt;-rvvvvv&lt;/span&gt;
dialplan reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now, it is more user-friendly. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Calling through CLI
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Before we originate a call through CLI, we need to do some settings in pjsip.conf, extensions.conf and modules.conf.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In pjsip.conf,&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;[&lt;span class="n"&gt;transport&lt;/span&gt;-&lt;span class="n"&gt;udp&lt;/span&gt;-&lt;span class="n"&gt;nat&lt;/span&gt;]
&lt;span class="n"&gt;type&lt;/span&gt; = &lt;span class="n"&gt;transport&lt;/span&gt;
&lt;span class="n"&gt;protocol&lt;/span&gt; = &lt;span class="n"&gt;udp&lt;/span&gt;
&lt;span class="n"&gt;bind&lt;/span&gt; = &lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;


[&lt;span class="n"&gt;endpoint&lt;/span&gt;-&lt;span class="n"&gt;useragent&lt;/span&gt;](!)
&lt;span class="n"&gt;type&lt;/span&gt;=&lt;span class="n"&gt;endpoint&lt;/span&gt;
&lt;span class="n"&gt;context&lt;/span&gt;=&lt;span class="n"&gt;calling&lt;/span&gt;         ;&lt;span class="n"&gt;Context&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="s2"&gt;"calling"&lt;/span&gt;
&lt;span class="n"&gt;allow&lt;/span&gt; = !&lt;span class="n"&gt;all&lt;/span&gt;,&lt;span class="n"&gt;ulaw&lt;/span&gt;,&lt;span class="n"&gt;alaw&lt;/span&gt;
&lt;span class="n"&gt;direct_media&lt;/span&gt;=&lt;span class="n"&gt;no&lt;/span&gt;
&lt;span class="n"&gt;trust_id_outbound&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;span class="n"&gt;rtp_symmetric&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;span class="n"&gt;force_rport&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;span class="n"&gt;rewrite_contact&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;span class="n"&gt;device_state_busy_at&lt;/span&gt;=&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="n"&gt;dtmf_mode&lt;/span&gt;=&lt;span class="n"&gt;rfc4733&lt;/span&gt;

[&lt;span class="n"&gt;auth&lt;/span&gt;-&lt;span class="n"&gt;userpass&lt;/span&gt;](!)
&lt;span class="n"&gt;type&lt;/span&gt; = &lt;span class="n"&gt;auth&lt;/span&gt;
&lt;span class="n"&gt;auth_type&lt;/span&gt; = &lt;span class="n"&gt;userpass&lt;/span&gt;

[&lt;span class="n"&gt;aor&lt;/span&gt;-&lt;span class="n"&gt;single&lt;/span&gt;-&lt;span class="n"&gt;reg&lt;/span&gt;](!)
&lt;span class="n"&gt;type&lt;/span&gt; = &lt;span class="n"&gt;aor&lt;/span&gt;
&lt;span class="n"&gt;max_contacts&lt;/span&gt; = &lt;span class="m"&gt;1&lt;/span&gt;

[&lt;span class="m"&gt;1112&lt;/span&gt;](&lt;span class="n"&gt;endpoint&lt;/span&gt;-&lt;span class="n"&gt;useragent&lt;/span&gt;)      ;&lt;span class="n"&gt;created&lt;/span&gt; &lt;span class="m"&gt;1112&lt;/span&gt; &lt;span class="n"&gt;endpoint&lt;/span&gt;
&lt;span class="n"&gt;auth&lt;/span&gt;=&lt;span class="m"&gt;1112&lt;/span&gt;
&lt;span class="n"&gt;aors&lt;/span&gt;=&lt;span class="m"&gt;1112&lt;/span&gt;
&lt;span class="n"&gt;callerid&lt;/span&gt; = &lt;span class="m"&gt;1112&lt;/span&gt; &amp;lt;&lt;span class="m"&gt;1112&lt;/span&gt;&amp;gt;

[&lt;span class="m"&gt;1112&lt;/span&gt;](&lt;span class="n"&gt;auth&lt;/span&gt;-&lt;span class="n"&gt;userpass&lt;/span&gt;)
&lt;span class="n"&gt;password&lt;/span&gt; = &lt;span class="m"&gt;1112&lt;/span&gt;
&lt;span class="n"&gt;username&lt;/span&gt; = &lt;span class="m"&gt;1112&lt;/span&gt;

[&lt;span class="m"&gt;1113&lt;/span&gt;](&lt;span class="n"&gt;endpoint&lt;/span&gt;-&lt;span class="n"&gt;useragent&lt;/span&gt;)      ;&lt;span class="n"&gt;created&lt;/span&gt; &lt;span class="m"&gt;1113&lt;/span&gt; &lt;span class="n"&gt;endpoint&lt;/span&gt;
&lt;span class="n"&gt;auth&lt;/span&gt;=&lt;span class="m"&gt;1113&lt;/span&gt;
&lt;span class="n"&gt;aors&lt;/span&gt;=&lt;span class="m"&gt;1113&lt;/span&gt;
&lt;span class="n"&gt;callerid&lt;/span&gt; = &lt;span class="m"&gt;1113&lt;/span&gt; &amp;lt;&lt;span class="m"&gt;1113&lt;/span&gt;&amp;gt;

[&lt;span class="m"&gt;1113&lt;/span&gt;](&lt;span class="n"&gt;auth&lt;/span&gt;-&lt;span class="n"&gt;userpass&lt;/span&gt;)
&lt;span class="n"&gt;password&lt;/span&gt; = &lt;span class="m"&gt;1113&lt;/span&gt;
&lt;span class="n"&gt;username&lt;/span&gt; = &lt;span class="m"&gt;1113&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In extensions.conf
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;calling&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;exten&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;_111X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;Dial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;PJSIP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;EXTEN&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
 &lt;span class="nx"&gt;same&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;Hangup&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In modules.conf
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;;&lt;span class="n"&gt;Application&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_bridgewait&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_dial&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_playback&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_stack&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_verbose&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_voicemail&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_directory&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_confbridge&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_queue&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_record&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_originate&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;     ; &lt;span class="n"&gt;added&lt;/span&gt; 
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;res_clioriginate&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;  ; &lt;span class="n"&gt;added&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Also, don't forget to set up those endpoints on your two different softphones. For me, I use MicroSIP and Linphone. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And remember, restart after adding new modules in modules.conf, and reload the dialplan and pjsip.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;service asterisk restart
&lt;span class="nb"&gt;sudo &lt;/span&gt;asterisk &lt;span class="nt"&gt;-rvvvvv&lt;/span&gt;
dialplan reload     &lt;span class="p"&gt;;&lt;/span&gt; not necessary after restart
core reload     &lt;span class="p"&gt;;&lt;/span&gt; not necessary after restart
channel originate LOCAL/1112@calling application Dial&lt;span class="o"&gt;(&lt;/span&gt;PJSIP/1113&lt;span class="o"&gt;)&lt;/span&gt;       &lt;span class="c"&gt;# this is how you originate a call via CLI&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;TLDR: This is how you originate a call from CLI&lt;code&gt;channel originate LOCAL/1112@calling application Dial(PJSIP/1113)&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;I hope you know more about the codec for telephony system and know how to make calls from CLI. That's it for today. If you have problems regarding &lt;code&gt;ffmpeg&lt;/code&gt; installation, which I omitted in this sharing, please comment below and see if I could help. In the meantime, stay healthy and stay tuned for more content !!! &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>asterisk</category>
      <category>voip</category>
      <category>beginners</category>
      <category>codec</category>
    </item>
    <item>
      <title>Record and Hear your voice through Asterisk</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 30 Apr 2021 02:30:44 +0000</pubDate>
      <link>https://dev.to/ekim34351855/record-and-hear-my-voice-through-asterisk-11om</link>
      <guid>https://dev.to/ekim34351855/record-and-hear-my-voice-through-asterisk-11om</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Previously
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekim34351855/asterisk-basic-set-up-4ple"&gt;Asterisk basic set up&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Last week was quite a fuzzy journey. Not much concrete output has been done.  Although the progress is slow, I still would like to share how to record and play audio through Asterisk. &lt;/p&gt;

&lt;h3&gt;
  
  
  Recording through dialing 41XXXX
&lt;/h3&gt;

&lt;p&gt;Let's create an endpoint of 1114 for our softphone. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In pjsip.conf,
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;;================================ &lt;span class="n"&gt;TRANSPORTS&lt;/span&gt; ==
; &lt;span class="n"&gt;Our&lt;/span&gt; &lt;span class="n"&gt;primary&lt;/span&gt; &lt;span class="n"&gt;transport&lt;/span&gt; &lt;span class="n"&gt;definition&lt;/span&gt; &lt;span class="n"&gt;for&lt;/span&gt; &lt;span class="n"&gt;UDP&lt;/span&gt; &lt;span class="n"&gt;communication&lt;/span&gt; &lt;span class="n"&gt;behind&lt;/span&gt; &lt;span class="n"&gt;NAT&lt;/span&gt;.
[&lt;span class="n"&gt;transport&lt;/span&gt;-&lt;span class="n"&gt;udp&lt;/span&gt;-&lt;span class="n"&gt;nat&lt;/span&gt;]
&lt;span class="n"&gt;type&lt;/span&gt; = &lt;span class="n"&gt;transport&lt;/span&gt;
&lt;span class="n"&gt;protocol&lt;/span&gt; = &lt;span class="n"&gt;udp&lt;/span&gt;
&lt;span class="n"&gt;bind&lt;/span&gt; = &lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;
; &lt;span class="n"&gt;NAT&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt;
;&lt;span class="n"&gt;local_net&lt;/span&gt; = &lt;span class="m"&gt;10&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;/&lt;span class="m"&gt;8&lt;/span&gt;
;&lt;span class="n"&gt;external_media_address&lt;/span&gt; = &lt;span class="m"&gt;203&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;113&lt;/span&gt;.&lt;span class="m"&gt;1&lt;/span&gt;
;&lt;span class="n"&gt;external_signaling_address&lt;/span&gt; = &lt;span class="m"&gt;203&lt;/span&gt;.&lt;span class="m"&gt;0&lt;/span&gt;.&lt;span class="m"&gt;113&lt;/span&gt;.&lt;span class="m"&gt;1&lt;/span&gt;

;================================ &lt;span class="n"&gt;CONFIG&lt;/span&gt; &lt;span class="n"&gt;FOR&lt;/span&gt; &lt;span class="n"&gt;SIP&lt;/span&gt; &lt;span class="n"&gt;ITSP&lt;/span&gt; ==

[&lt;span class="n"&gt;endpoint&lt;/span&gt;-&lt;span class="n"&gt;useragent&lt;/span&gt;](!)
&lt;span class="n"&gt;type&lt;/span&gt;=&lt;span class="n"&gt;endpoint&lt;/span&gt;
&lt;span class="n"&gt;context&lt;/span&gt;=&lt;span class="n"&gt;recordAndPlayback&lt;/span&gt;
&lt;span class="n"&gt;allow&lt;/span&gt; = !&lt;span class="n"&gt;all&lt;/span&gt;,&lt;span class="n"&gt;ulaw&lt;/span&gt;,&lt;span class="n"&gt;alaw&lt;/span&gt;
&lt;span class="n"&gt;direct_media&lt;/span&gt;=&lt;span class="n"&gt;no&lt;/span&gt;
&lt;span class="n"&gt;trust_id_outbound&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;span class="n"&gt;rtp_symmetric&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;span class="n"&gt;force_rport&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;span class="n"&gt;rewrite_contact&lt;/span&gt;=&lt;span class="n"&gt;yes&lt;/span&gt;
&lt;span class="n"&gt;device_state_busy_at&lt;/span&gt;=&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="n"&gt;dtmf_mode&lt;/span&gt;=&lt;span class="n"&gt;rfc4733&lt;/span&gt;

[&lt;span class="n"&gt;auth&lt;/span&gt;-&lt;span class="n"&gt;userpass&lt;/span&gt;](!)
&lt;span class="n"&gt;type&lt;/span&gt; = &lt;span class="n"&gt;auth&lt;/span&gt;
&lt;span class="n"&gt;auth_type&lt;/span&gt; = &lt;span class="n"&gt;userpass&lt;/span&gt;

[&lt;span class="n"&gt;aor&lt;/span&gt;-&lt;span class="n"&gt;single&lt;/span&gt;-&lt;span class="n"&gt;reg&lt;/span&gt;](!)
&lt;span class="n"&gt;type&lt;/span&gt; = &lt;span class="n"&gt;aor&lt;/span&gt;
&lt;span class="n"&gt;max_contacts&lt;/span&gt; = &lt;span class="m"&gt;1&lt;/span&gt;

[&lt;span class="m"&gt;1114&lt;/span&gt;](&lt;span class="n"&gt;endpoint&lt;/span&gt;-&lt;span class="n"&gt;useragent&lt;/span&gt;)
&lt;span class="n"&gt;auth&lt;/span&gt;=&lt;span class="m"&gt;1114&lt;/span&gt;
&lt;span class="n"&gt;aors&lt;/span&gt;=&lt;span class="m"&gt;1114&lt;/span&gt;
&lt;span class="n"&gt;callerid&lt;/span&gt; = &lt;span class="m"&gt;1114&lt;/span&gt; &amp;lt;&lt;span class="m"&gt;1114&lt;/span&gt;&amp;gt;

[&lt;span class="m"&gt;1114&lt;/span&gt;](&lt;span class="n"&gt;auth&lt;/span&gt;-&lt;span class="n"&gt;userpass&lt;/span&gt;)
&lt;span class="n"&gt;password&lt;/span&gt; = &lt;span class="m"&gt;1114&lt;/span&gt;
&lt;span class="n"&gt;username&lt;/span&gt; = &lt;span class="m"&gt;1114&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What I want to do here is to dial a number, which starts with 41 and is followed by any 4 digits, to record my voice on the softphone. And then, I would like hear my voice again when I dial 42 + any 4 digits I've just dialed. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;So, in the extensions.conf
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;[&lt;span class="n"&gt;recordAndPlayback&lt;/span&gt;]
&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="err"&gt;_&lt;/span&gt;&lt;span class="m"&gt;41&lt;/span&gt;&lt;span class="n"&gt;XXXX&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;Answer&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Record&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/${&lt;span class="n"&gt;EXTEN&lt;/span&gt;:&lt;span class="m"&gt;2&lt;/span&gt;}.&lt;span class="n"&gt;gsm&lt;/span&gt;)      ; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="n"&gt;your&lt;/span&gt; &lt;span class="n"&gt;voice&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;save&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;XXXX&lt;/span&gt;, &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;any&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt; &lt;span class="n"&gt;digits&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;dialed&lt;/span&gt; &lt;span class="n"&gt;and&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; .&lt;span class="n"&gt;gsm&lt;/span&gt; &lt;span class="n"&gt;format&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Wait&lt;/span&gt;(&lt;span class="m"&gt;1&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Hangup&lt;/span&gt;()

&lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="err"&gt;_&lt;/span&gt;&lt;span class="m"&gt;42&lt;/span&gt;&lt;span class="n"&gt;XXXX&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;Answer&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Wait&lt;/span&gt;(&lt;span class="m"&gt;1&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;record&lt;/span&gt;/${&lt;span class="n"&gt;EXTEN&lt;/span&gt;:&lt;span class="m"&gt;2&lt;/span&gt;})        ; &lt;span class="n"&gt;play&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;audio&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;recorded&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; /&lt;span class="n"&gt;var&lt;/span&gt;/&lt;span class="n"&gt;lib&lt;/span&gt;/&lt;span class="n"&gt;asterisk&lt;/span&gt;/&lt;span class="n"&gt;sounds&lt;/span&gt;/&lt;span class="n"&gt;record&lt;/span&gt;
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Wait&lt;/span&gt;(&lt;span class="m"&gt;1&lt;/span&gt;)
&lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Hangup&lt;/span&gt;()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, add the &lt;code&gt;load = app_record.so&lt;/code&gt; in your &lt;code&gt;modules.conf&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;;&lt;span class="n"&gt;Application&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_bridgewait&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_dial&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_playback&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_stack&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_verbose&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_voicemail&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_directory&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_confbridge&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_queue&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;
&lt;span class="n"&gt;load&lt;/span&gt; = &lt;span class="n"&gt;app_record&lt;/span&gt;.&lt;span class="n"&gt;so&lt;/span&gt;        ; &lt;span class="n"&gt;add&lt;/span&gt; &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="n"&gt;into&lt;/span&gt; &lt;span class="n"&gt;your&lt;/span&gt; &lt;span class="n"&gt;modules&lt;/span&gt;.&lt;span class="n"&gt;conf&lt;/span&gt;, &lt;span class="n"&gt;so&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;do&lt;/span&gt; &lt;span class="n"&gt;not&lt;/span&gt; &lt;span class="n"&gt;need&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="n"&gt;every&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's time to restart the asterisk to make things ready.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;service asterisk restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then remember to go to CLI to reload the dialplan and pjsip.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;asterisk &lt;span class="nt"&gt;-rvvvvv&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dialplan reload
core reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open you softphone and do the following settings&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1sXdnzzHqNOeuOBlFJKzuOoSdCX22jZJg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1sXdnzzHqNOeuOBlFJKzuOoSdCX22jZJg" alt="microsip-set-up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The SIP server and Domain should be your Ubuntu's IP. You can check it by this command:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;ip addr&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you have problem connecting your softphone to your Ubuntu, please check that you've done these firewall settings: &lt;a href="https://www.voip-info.org/asterisk-firewall-rules/" rel="noopener noreferrer"&gt;https://www.voip-info.org/asterisk-firewall-rules/&lt;/a&gt; .&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hearing your voice
&lt;/h3&gt;

&lt;p&gt;So, if you followed the aforementioned steps, you should be able to record your voice by dialing, for example, 411234. &lt;strong&gt;Noted&lt;/strong&gt; that when you finish your recording, press # to finish the call. &lt;strong&gt;Do Not End The Call Right Away, or it won't save the recording&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1Zg-xjeln5JtFPx4iY7hC0hV0KVjHsaLN" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1Zg-xjeln5JtFPx4iY7hC0hV0KVjHsaLN" alt="microsip-set-up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After recording your voice, it's time to appreciate the cuss words you've just sworn yourself. (Yeah, I know it !!!! We all do it to ourselves.)&lt;/p&gt;

&lt;p&gt;When you dial &lt;code&gt;421234&lt;/code&gt;, you should hear your recording straight away. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1ppNwiP2np4BVHxjfYLAKQKZNRbdXFEWB" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1ppNwiP2np4BVHxjfYLAKQKZNRbdXFEWB" alt="microsip-set-up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Usually, when we want someone to record an audio track, we won't just use the &lt;code&gt;Record&lt;/code&gt; dialplan application alone because they won't have an idea that they need to press &lt;code&gt;#&lt;/code&gt; to save the recording. Hence, it is better to record a track that guides them what to do after they record their voices. That's what we'll do next time. For the time being, stay healthy and stay tuned !!! &lt;/p&gt;

</description>
      <category>asterisk</category>
      <category>record</category>
      <category>playback</category>
      <category>voip</category>
    </item>
    <item>
      <title>Asterisk basic set up</title>
      <dc:creator>Ekim</dc:creator>
      <pubDate>Fri, 23 Apr 2021 04:16:17 +0000</pubDate>
      <link>https://dev.to/ekim34351855/asterisk-basic-set-up-4ple</link>
      <guid>https://dev.to/ekim34351855/asterisk-basic-set-up-4ple</guid>
      <description>&lt;h2&gt;
  
  
  Weekly sharing
&lt;/h2&gt;

&lt;p&gt;Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer. &lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Over the last week, I've been familiarizing myself with Asterisk, the open-source communications toolkit, which powers IP PBX systems, VoIP gateways, and conference servers. It is such a bitter start for a coding newbie like me, in which I struggled a lot in the installation process and making a simple phone call under the same network. This article aims at sharing a laconic work flow of the asterisk set-up and how a video call is made. &lt;/p&gt;

&lt;h5&gt;
  
  
  Before getting started ...
&lt;/h5&gt;

&lt;p&gt;I'm using WSL Ubuntu to do the Asterisk set-up. &lt;/p&gt;

&lt;p&gt;And before getting straight into the code, I would like to share several links that helped me a lot when I started from zero. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A simplified Chinese installation guide of Asterisk 17 (Thanks for Google Translate)

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://zh.codepre.com/how-to-12071.html" rel="noopener noreferrer"&gt;https://zh.codepre.com/how-to-12071.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Call making via SIP Softphone

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=rtHFdhCm434&amp;amp;t=432s&amp;amp;ab_channel=RocketSystems" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=rtHFdhCm434&amp;amp;t=432s&amp;amp;ab_channel=RocketSystems&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Basic PBX set-up

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://wiki.asterisk.org/wiki/display/AST/Basic+PBX+Functionality" rel="noopener noreferrer"&gt;https://wiki.asterisk.org/wiki/display/AST/Basic+PBX+Functionality&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Asterisk firewall rules

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.voip-info.org/asterisk-firewall-rules/" rel="noopener noreferrer"&gt;https://www.voip-info.org/asterisk-firewall-rules/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Get started!
&lt;/h3&gt;

&lt;p&gt;To start with, as always,  &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 bash
sudo su     # enter the superuser mode 
apt update
apt upgrade
apt autoclean


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  How to install Asterisk ?
&lt;/h3&gt;

&lt;p&gt;Installing Asterisk 18&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nb"&gt;cd&lt;/span&gt; /var/local/  &lt;span class="c"&gt;# Go to /var/local as the download location&lt;/span&gt;
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz    &lt;span class="c"&gt;# Download Asterisk 18&lt;/span&gt;
&lt;span class="nb"&gt;tar &lt;/span&gt;zxf asterisk-18-current.tar.gz      &lt;span class="c"&gt;# Unzip it&lt;/span&gt;
apt &lt;span class="nb"&gt;install &lt;/span&gt;flex bison subversion       &lt;span class="c"&gt;# Install flex, bison, and subversion&lt;/span&gt;
contrib/scripts/get_mp3_source.sh       &lt;span class="c"&gt;# Download the mp3 decoder save it in ./asterisk 18.xxx/contrib/scripts&lt;/span&gt;
contrib/scripts/install_prereq &lt;span class="nb"&gt;install&lt;/span&gt;  &lt;span class="c"&gt;# Ensure all dependencies are set up&lt;/span&gt;
./configure     &lt;span class="c"&gt;# Set up the asterisk based on the above&lt;/span&gt;
make menuconfig &lt;span class="c"&gt;# Choose the modules you need&lt;/span&gt;
make &lt;span class="nt"&gt;-j&lt;/span&gt; 3       &lt;span class="c"&gt;# Allocate cpu cores to run the installation&lt;/span&gt;
&lt;span class="nb"&gt;install&lt;/span&gt;     &lt;span class="c"&gt;# Install all the things we've just set up&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Softphone recommendation
&lt;/h3&gt;

&lt;p&gt;I use MicroSIP and Linphone to make calls on Windows.  &lt;/p&gt;
&lt;h3&gt;
  
  
  Connecting softphone to WSL Ubuntu
&lt;/h3&gt;
&lt;h5&gt;
  
  
  Asterisk Firewall Rules
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Config of Linux IPTables firewall     (&lt;a href="https://www.voip-info.org/asterisk-firewall-rules/" rel="noopener noreferrer"&gt;https://www.voip-info.org/asterisk-firewall-rules/&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

  &lt;span class="c"&gt;# SIP on UDP port 5060. Other SIP servers may need TCP port 5060 as well&lt;/span&gt;
  iptables &lt;span class="nt"&gt;-A&lt;/span&gt; INPUT &lt;span class="nt"&gt;-p&lt;/span&gt; udp &lt;span class="nt"&gt;-m&lt;/span&gt; udp &lt;span class="nt"&gt;--dport&lt;/span&gt; 5060 &lt;span class="nt"&gt;-j&lt;/span&gt; ACCEPT

   &lt;span class="c"&gt;# IAX2- the IAX protocol&lt;/span&gt;
  iptables &lt;span class="nt"&gt;-A&lt;/span&gt; INPUT &lt;span class="nt"&gt;-p&lt;/span&gt; udp &lt;span class="nt"&gt;-m&lt;/span&gt; udp &lt;span class="nt"&gt;--dport&lt;/span&gt; 4569 &lt;span class="nt"&gt;-j&lt;/span&gt; ACCEPT

   &lt;span class="c"&gt;# IAX - most have switched to IAX v2, or ought to&lt;/span&gt;
  iptables &lt;span class="nt"&gt;-A&lt;/span&gt; INPUT &lt;span class="nt"&gt;-p&lt;/span&gt; udp &lt;span class="nt"&gt;-m&lt;/span&gt; udp &lt;span class="nt"&gt;--dport&lt;/span&gt; 5036 &lt;span class="nt"&gt;-j&lt;/span&gt; ACCEPT

   &lt;span class="c"&gt;# RTP - the media stream&lt;/span&gt;
   &lt;span class="c"&gt;# (related to the port range in /etc/asterisk/rtp.conf) &lt;/span&gt;
  iptables &lt;span class="nt"&gt;-A&lt;/span&gt; INPUT &lt;span class="nt"&gt;-p&lt;/span&gt; udp &lt;span class="nt"&gt;-m&lt;/span&gt; udp &lt;span class="nt"&gt;--dport&lt;/span&gt; 10000:20000 &lt;span class="nt"&gt;-j&lt;/span&gt; ACCEPT


   &lt;span class="c"&gt;# MGCP - if you use media gateway control protocol in your configuration&lt;/span&gt;
  iptables &lt;span class="nt"&gt;-A&lt;/span&gt; INPUT &lt;span class="nt"&gt;-p&lt;/span&gt; udp &lt;span class="nt"&gt;-m&lt;/span&gt; udp &lt;span class="nt"&gt;--dport&lt;/span&gt; 2727 &lt;span class="nt"&gt;-j&lt;/span&gt; ACCEPT


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Basic calling set-up
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Going to set our configs.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 bash
  cd /etc/asterisk
  nano pjsip.conf


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;The below is the pjsip.conf for basic calling (Account creation). &lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 conf
  ;================================ TRANSPORTS ==
  ; Our primary transport definition for UDP communication behind NAT.
  [transport-udp-nat]
  type = transport
  protocol = udp
  bind = 0.0.0.0
  ;================================ CONFIG FOR SIP ITSP ==

  [calling](!)                    ; template
  type=endpoint                   ; specify the below are the configurations related to an endpoint (a device)
  context=interaction             ; *** it refers to the context set in the dialplan (extensions.conf) ***
  allow = !all, ulaw, alaw  ; do not allow all codecs and only allow audio codecs - ulaw and alaw
  direct_media=no                   ; do not allow two devices directly talking to each other
  trust_id_outbound=yes
  rtp_symmetric=yes
  force_rport=yes
  rewrite_contact=yes
  device_state_busy_at=1
  dtmf_mode=rfc4733

  [auth-userpass](!)            ; template 
  type = auth                       ; specify the below are the configurations related to authentication
  auth_type = userpass      ; specify the type of the authentication is based on username and password

  [aor-single-reg](!)           ; template
  type = aor
  max_contacts = 1            ; specify the maximum sip addresses allocated. Here, that means each sip address could only connect to one device.

  [7000](calling)                 ; endpoint 7000 inherits the settings in calling template
  auth=7000                       ; authentication = 7000
  aors=7000                       ; address of record = 7000
  callerid = 7000 &amp;lt;7000&amp;gt;      ; caller's id = 7000

  [7000](auth-userpass)     ; account creation for endpoint 7000
  password = 7000
  username = 7000

  [7000](aor-single-reg)

  [7100](calling)
  auth=7100
  aors=7100
  callerid = 7100 &amp;lt;7100&amp;gt;

  [7100](auth-userpass)
  password = 7100
  username = 7100

  [7100](aor-single-reg)


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;The below are the configurations of the extensions.conf (Dialplan)&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;

  [&lt;span class="n"&gt;globals&lt;/span&gt;]
  &lt;span class="n"&gt;INTERNAL_DIAL_OPT&lt;/span&gt;=,&lt;span class="m"&gt;30&lt;/span&gt;

  [&lt;span class="n"&gt;interaction&lt;/span&gt;]                       ; &lt;span class="n"&gt;refers&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; `&lt;span class="n"&gt;context&lt;/span&gt;=&lt;span class="n"&gt;interaction&lt;/span&gt;` &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;calling&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;pjsip&lt;/span&gt;.&lt;span class="n"&gt;conf&lt;/span&gt;
  &lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="m"&gt;7000&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;Answer&lt;/span&gt;()               ; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt; &lt;span class="n"&gt;argument&lt;/span&gt; &lt;span class="m"&gt;7000&lt;/span&gt; &lt;span class="n"&gt;refers&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;dial&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt; &lt;span class="n"&gt;your&lt;/span&gt; &lt;span class="n"&gt;softphone&lt;/span&gt;. 
  &lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Dial&lt;/span&gt;(&lt;span class="n"&gt;PJSIP&lt;/span&gt;/&lt;span class="m"&gt;7000&lt;/span&gt;,&lt;span class="m"&gt;60&lt;/span&gt;)      ; &lt;span class="n"&gt;PJSIP&lt;/span&gt;/&lt;span class="m"&gt;7000&lt;/span&gt; &lt;span class="n"&gt;refers&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;endpoint&lt;/span&gt; &lt;span class="m"&gt;7000&lt;/span&gt; , &lt;span class="m"&gt;60&lt;/span&gt; &lt;span class="n"&gt;means&lt;/span&gt; &lt;span class="n"&gt;waiting&lt;/span&gt; &lt;span class="n"&gt;for&lt;/span&gt; &lt;span class="m"&gt;60&lt;/span&gt; &lt;span class="n"&gt;seconds&lt;/span&gt;
  &lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;vm&lt;/span&gt;-&lt;span class="n"&gt;nobodyavail&lt;/span&gt;)
  &lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Voicemail&lt;/span&gt;(&lt;span class="m"&gt;7000&lt;/span&gt;@&lt;span class="n"&gt;main&lt;/span&gt;)
  &lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Hangup&lt;/span&gt;()

  &lt;span class="n"&gt;exten&lt;/span&gt; = &lt;span class="m"&gt;7100&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;Answer&lt;/span&gt;()
  &lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Dial&lt;/span&gt;(&lt;span class="n"&gt;PJSIP&lt;/span&gt;/&lt;span class="m"&gt;7100&lt;/span&gt;,&lt;span class="m"&gt;60&lt;/span&gt;)
  &lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Playback&lt;/span&gt;(&lt;span class="n"&gt;vm&lt;/span&gt;-&lt;span class="n"&gt;nobodyavail&lt;/span&gt;)
  &lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Voicemail&lt;/span&gt;(&lt;span class="m"&gt;7000&lt;/span&gt;@&lt;span class="n"&gt;main&lt;/span&gt;)
  &lt;span class="n"&gt;same&lt;/span&gt; = &lt;span class="n"&gt;n&lt;/span&gt;,&lt;span class="n"&gt;Hangup&lt;/span&gt;()

  ; &lt;span class="n"&gt;same&lt;/span&gt; &lt;span class="n"&gt;means&lt;/span&gt; &lt;span class="n"&gt;following&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;same&lt;/span&gt; &lt;span class="n"&gt;extension&lt;/span&gt;
  ; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="n"&gt;means&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;. 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;After setting the pjsip.conf and extensions.conf, you need to reload the pjsip and dialplan. &lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

  asterisk &lt;span class="nt"&gt;-r&lt;/span&gt;   &lt;span class="c"&gt;# go to the CLI of Asterisk (command line interface)&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

  core reload       &lt;span class="c"&gt;# reload pjsip and modules&lt;/span&gt;

  dialplan reload       &lt;span class="c"&gt;# reload dialplan&lt;/span&gt;

  pjsip show endpoints &lt;span class="c"&gt;# showing the endpoints you have&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;The below is how you set up on the MicroSIP softphone&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1IyRFrFOInZC7gDlomfAgw1222aV4o4rF" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdrive.google.com%2Fuc%3Fexport%3Dview%26id%3D1IyRFrFOInZC7gDlomfAgw1222aV4o4rF" alt="microsip-set-up"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Do the same on another softphone for the 7100 endpoint. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then call 7100 on 7000 endpoint / 7000 on 7100 endpoint to each other. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why I can call certain numbers on my device and can ring another device ? &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href="https://wiki.asterisk.org/wiki/display/AST/Creating+Dialplan+Extensions" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://wiki.asterisk.org/wiki/display/AST/Creating+Dialplan+Extensions" rel="noopener noreferrer"&gt;https://wiki.asterisk.org/wiki/display/AST/Creating+Dialplan+Extensions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;This is because we've done the set-up in the extensions.conf, in which we've set a number, for example, 6001, in the illustration below, for the dial action. &lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;

                  [&lt;span class="n"&gt;from&lt;/span&gt;-&lt;span class="n"&gt;internal&lt;/span&gt;]
                  &lt;span class="n"&gt;exten&lt;/span&gt;=&amp;gt;&lt;span class="m"&gt;6001&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;Dial&lt;/span&gt;(&lt;span class="n"&gt;SIP&lt;/span&gt;/&lt;span class="n"&gt;demo&lt;/span&gt;-&lt;span class="n"&gt;alice&lt;/span&gt;,&lt;span class="m"&gt;20&lt;/span&gt;)
                  &lt;span class="n"&gt;exten&lt;/span&gt;=&amp;gt;&lt;span class="m"&gt;6002&lt;/span&gt;,&lt;span class="m"&gt;1&lt;/span&gt;,&lt;span class="n"&gt;Dial&lt;/span&gt;(&lt;span class="n"&gt;SIP&lt;/span&gt;/&lt;span class="n"&gt;demo&lt;/span&gt;-&lt;span class="n"&gt;bob&lt;/span&gt;,&lt;span class="m"&gt;20&lt;/span&gt;)


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Video calling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;To achieve video calling, you only need to add the video codec in the pjsip.conf to make it work. And there's no other differences from the basic calling settings. &lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 conf
  [calling](!)
              type=endpoint
              context=interaction
              allow = !all, ulaw, alaw, vp8, h263, h263p        ; video codec vp8, h263 and h263p are added 
              direct_media=no
              trust_id_outbound=yes
              rtp_symmetric=yes
              force_rport=yes
              rewrite_contact=yes
              device_state_busy_at=1
              dtmf_mode=rfc4733


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;After changing the pjsip.conf, remember to reload the pjsip like the above again. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;By now, I hope you could achieve video calling in your own network. In the meantime, stay healthy and stay tuned for more content !!! &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>asterisk</category>
      <category>voip</category>
      <category>videocall</category>
    </item>
  </channel>
</rss>
