Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

domingo, 6 de septiembre de 2015

Renato system

[inbound]
exten=>s,1,Goto(inbound,_x.,1)
exten=>_x.,1,Set(__FECHA=${STRFTIME(${EPOCH},,%Y-%m-%d_%H-%M-%S)}_${CALLERID(num)})
exten=>_x.,2,MixMonitor(/var/www/html/recordings/${FECHA}.wav)
exten=>_x.,3,Answer()
same=>n,Playback(/var/www/html/sounds/intro)
;same=>n,Set(TIMEOUT(absolute)=200)
same=>n,Set(__msg=${STRFTIME(${EPOCH},,%Y-%m-%d_%H-%M-%S)}_${CALLERID(num)})
same=>n,Record(/var/www/html/recordings/${msg}.wav,,60)
same=>n,Wait(1)
same=>n,Playback(/var/www/html/sounds/name)
same=>n,Set(__name=${STRFTIME(${EPOCH},,%Y-%m-%d_%H-%M-%S)}_${CALLERID(num)})
same=>n,Record(/var/www/html/recordings/${name}.wav,,60)
same=>n,Wait(1)
same=>n,Playback(/var/www/html/sounds/redirect)
same=>n,System(/usr/bin/sox /var/www/html/recordings/${name}.wav /var/www/html/recordings/${msg}.wav /var/www/html/recordings/${name:-5}.wav)
same=>n,Dial(Local/0@overflow)
;same=>n,confbridge(${UNIQUEID})
;same=>n,Dial(SIP/109)
;same=>n,Dial(Local/1924@spy-exten,30,G(recording^0^1))
;same=>n,playback(goodbye)
;exten=>h,1,System(/usr/bin/mpack -s "Asterisk Dominicana ${FECHA}" /var/lib/asterisk/sounds/${FECHA}.wav ambiorixg12@hotmail.com,ambiorixg12@gmail.com)
;exten=>h,1,System(/usr/bin/mpack -s "Asterisk Dominicana ${FECHA}" /var/www/${FECHA}.wav ambiorixg12@hotmail.com,ambiorixg12@gmail.com)



[overflow]
exten=>0,1,Dial(SIP/2656671/+5511963244661,15,A(/var/www/html/recordings/${name:-5}))
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)

same=>n(unavail),Playback(ss-noservice)
same=>n,Hangup()

same=>n(busy),Playback(ss-noservice)
same=>n,Hangup()
exten=>h,1,System(/bin/echo Listen to the http://31.220.22.105/recordings/${name:-5}.wav | mail -s  Missed call from  ${CALLERID(num)}  atendimento@avitis.com.br,ambiorixg12@gmail.com)


;exten=>0,1,Dial(SIP/2656671/+5511963244661,,A(/var/www/html/recordings/${msg}))
;exten=>0,1,Dial(SIP/100,,A(/var/www/html/recordings/${name:-5}))


jueves, 3 de septiembre de 2015

FOP2 admin login script


/var/www/html/fop2/admin/index.php


agregamos la linea  
require_once("login.php");



###################Login Script called login.php############
###
<?php


  $dbhost='localhost';
        $dbuser='root';
        $dbpass=71345;
        $dbname='asterisk';

        $db = mysql_connect($dbhost, $dbuser, $dbpass) or die("Couldn't connect to the database.");

        mysql_select_db($dbname) or die("Couldn't select the database");



    //--------------- AUTHENTICATION MODULE --------------------------

        function displayLogin() {
                header("WWW-Authenticate: Basic realm=\"Ambiorix\"");
                header("HTTP/1.0 401 Unauthorized");
                echo "<h2>Authentication Failure</h2>";
                echo "The username and password provided did not work. Please reload this page and try again.";
                exit;
        }



        if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
                // If username or password hasn't been set, display the login request.
                displayLogin();
        } else {
                // Escape both the password and username string to prevent users from inserting bogus data.
                $PHP_AUTH_USER = addslashes($_SERVER['PHP_AUTH_USER']);
                //$PHP_AUTH_PW = md5($PHP_AUTH_PW);
                $PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];

                // Check username and password against the database.
                $result = mysql_query("SELECT count(id) FROM fop2users WHERE secret='$PHP_AUTH_PW' AND exten='$PHP_AUTH_USER' ") or exit();

                $num = mysql_result($result, 0);

                if (!$num) {
                        // If there were no matching users, show the login
                        displayLogin();
                }
        }

?>

domingo, 30 de agosto de 2015

Asterisk tee output

asterisk -gvvvvvvvvvvvvvvv | tee /tmp/debug.log

 cat /tmp/asteriskdebug.log  | grep -i error

sábado, 29 de agosto de 2015

TRUNK and DID setup

<?php

echo "<center><h2>Caller ID & Trunk  setup. <h2></center>";


// asignar permisos chmod 777 /var/www/cid.conf
// asignar permisos chmod 777 /var/www/trunk.conf

if(isset($_POST[submit])&& strlen($_POST[cid])>0 &&  strlen($_POST[trunk])>0 ){
$myfile = fopen("/var/www/cid.conf", "w") or die("Unable to open file!");
$cid=$_POST[cid];
fwrite($myfile,$cid);
fclose($myfile);
echo "<strong> Selected caller id : $cid</strong><br>";

$myfile1 = fopen("/var/www/trunk.conf", "w") or die("Unable to open file!");
$trunk=$_POST[trunk];
fwrite($myfile1,$trunk);
fclose($myfile1);


echo "<strong>Selected trunk : $trunk</strong>";
}

?>

<body>
<center>
    <div class="login-help">
      <p>Click here to <a href="cid.php"> Go to the main panel </a>.</p>
    </div>
  <section class="container">
    <div class="login">
      <h1>Add Caller ID</h1> <form enctype="multipart/form-data" action="cid.php" method="POST" onsubmit="return val(this)">


        <p><input type="text" name="cid" value="" placeholder="caller id"></p>
        <p><input type="text" name="trunk" value="" placeholder="trunk"></p>


    <p class="submit"><input type="submit" name="submit" value="Done"></p>
</center>
      </form>
    </div>


  </section>

</body>
</html>

####################
[outbound]
exten=>_7.,1,Noop()
same=>n,Set(CID=${SHELL(cat /var/www/cid.conf)})
same=>n,Set(CALLERID(num)=${CID})
same=>n,Set(TRUNK=${SHELL(cat /var/www/trunk.conf)})
same=>n,Dial(SIP/${EXTEN:1}@${TRUNK},25)
same=>n,hangup()

lunes, 10 de agosto de 2015

Callid based on extension number

[did-exten]
exten=>_15619230427,1,Dial(SIP/101)
exten=>_15619230443,1,Dial(SIP/102)
exten=>_15619230473,1,Dial(SIP/103)
exten=>_15619230474,1,Dial(SIP/104)
exten=>_15619230475,1,Dial(SIP/105)
exten=>_15619230485,1,Dial(SIP/106)
exten=>_15619230490,1,Dial(SIP/107)
exten=>_15619230660,1,Dial(SIP/108)
exten=>_15619238301,1,Dial(SIP/109)
exten=>_15619480726,1,Dial(SIP/110)

[outbound]
exten=>_x.,1,Gosub(cid-exten,${CALLERID(num)},1)
exten=>_x.,2,Dial(SIP/rapidvox/${EXTEN})


[cid-exten]
exten =>101,1,ExecIf($["${CALLERID(NUM)}"= "101"]?Set(CALLERID(num)=15619230427))
  same => n,Return

exten =>102,1,ExecIf($["${CALLERID(NUM)}"= "102"]?Set(CALLERID(num)=15619230443))
  same => n,Return

exten =>103,1,ExecIf($["${CALLERID(NUM)}"= "103"]?Set(CALLERID(num)=15619230473))
  same => n,Return

exten =>104,1,ExecIf($["${CALLERID(NUM)}"= "104"]?Set(CALLERID(num)=15619230474))
  same => n,Return

exten =>105,1,ExecIf($["${CALLERID(NUM)}"= "105"]?Set(CALLERID(num)=15619230475))
  same => n,Return

exten =>106,1,ExecIf($["${CALLERID(NUM)}"= "106"]?Set(CALLERID(num)=15619230485))
  same => n,Return

exten =>107,1,ExecIf($["${CALLERID(NUM)}"= "107"]?Set(CALLERID(num)=15619230490))
  same => n,Return

exten =>108,1,ExecIf($["${CALLERID(NUM)}"= "108"]?Set(CALLERID(num)=15619230660))
  same => n,Return

exten =>109,1,ExecIf($["${CALLERID(NUM)}"= "109"]?Set(CALLERID(num)=15619238301))
  same => n,Return


exten =>110,1,ExecIf($["${CALLERID(NUM)}"= "110"]?Set(CALLERID(num)=15619480726))
  same => n,Return

viernes, 7 de agosto de 2015

Asterisk Click to call script

Web call URL

http://54.149.226.168/click/click.php?dest=18002342120&exten=101



// Calling Script
<?php



$dest=$_GET["dest"];
$exten=$_GET["exten"];
$pbx="127.0.0.1";
$timeout=30;

 $socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
 fputs($socket, "Action: Login\r\n");
 fputs($socket, "UserName: admin\r\n");     //
 fputs($socket, "Secret: 123456\r\n\r\n");  //
                                            //
              $wrets=fgets($socket,128);
              echo $wrets;
              fputs($socket, "Action: Originate\r\n" );
               fputs($socket, "Channel: SIP/$exten\r\n" );
               fputs($socket, "Exten: $dest\r\n" );
               fputs($socket, "Context: outbound\r\n" );
               fputs($socket, "Priority: 1\r\n" );
                 fputs($socket, "CallerID: $dest\r\n" );
               fputs($socket, "Async: yes\r\n\r\n" );
              fputs($socket, "Action: Logoff\r\n\r\n");
 sleep (1);
 $wrets=fgets($socket,128);


?>

Dial Plan


[outbound]
exten=>_x.,1,Dial(SIP/r1/${EXTEN})

miércoles, 5 de agosto de 2015

setting callerid based on extension range

[from-internal-custom]
exten => 1234,1,Playback(demo-congrats)         ; extensions can dial 1234
exten => 1234,2,Hangup()

exten=>_1NXXNXXXXXX,1,Noop(${CALLERID(NUM):0:1})

same=> n,ExecIf($["${CALLERID(NUM):0:1}"= "7"]?Set(CALLERID(all)=MOREHAIR<13525081099>))

same=> n,ExecIf($["${CALLERID(NUM):0:1}"= "8"]?Set(CALLERID(all)=TonerRefillKits<18005273712>))

same=> n,ExecIf($["${CALLERID(NUM):0:1}"= "9"]?Set(CALLERID(all)=LASERGROUP<13523433804>))

same=>n,Dial(SIP/${EXTEN}@Flowroute)

exten=>_NXXNXXXXXX,1,Noop(${CALLERID(NUM):0:1})

same=> n,ExecIf($["${CALLERID(NUM):0:1}"= "7"]?Set(CALLERID(all)=MOREHAIR<13525081099>))

same=> n,ExecIf($["${CALLERID(NUM):0:1}"= "8"]?Set(CALLERID(all)=TonerRefillKits<18005273712>))

same=> n,ExecIf($["${CALLERID(NUM):0:1}"= "9"]?Set(CALLERID(all)=LASERGROUP<13523433804>))


same=>n,Dial(SIP/1${EXTEN}@Flowroute)