Soporte & Consultoria

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

sábado, 16 de abril de 2016

asterisl realtime notes

http://www.voip-info.org/wiki/view/Asterisk+RealTime+Sip
https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration#RealtimeDatabaseConfiguration-Notesonuseofthesipregsfamily
http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/I_section12_tt1465.html

https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime

http://www.open-voip.org/index.php?title=Asterisk_Full_RealTime_example





mysql> INSERT INTO asterisk.sippeers (  NAME, defaultuser, secret, context, HOST, nat, qualify, TYPE)  VALUES (  '1005', '1005', '0111234', 'from-internal', 'dynamic', 'yes', 'no', 'friend');
Query OK, 1 row affected (0.00 sec)

Update : use "sip prune realtime PEERNAME" then "sip show peer PEERNAME load" to flush the peer and reload from db - (Voicemeup)

 523  cd ..
  524  cd ..
  525  cd ast-db-manage/
  526  ls
  527  nano config.ini.sample
  528  nano config.ini.sample
  529  clear
  530  cp config.ini.sample config.ini
  531  alembic -c config.ini upgrade head
  532  pip install alembic
  533  alembic -c config.ini upgrade head
  534  mysql -u root -p -D asterisk


/etc/asterisk/extconfig

;iaxusers => odbc,asterisk
;iaxpeers => odbc,asterisk
 sippeers => odbc,asterisk
;sipregs => odbc,asterisk ; (avoid sipregs if possible, e.g. by using a view)
;ps_endpoints => odbc,asterisk
;ps_auths => odbc,asterisk
;ps_aors => odbc,asterisk
;ps_domain_aliases => odbc,asterisk
;ps_endpoint_id_ips => odbc,asterisk
;voicemail => odbc,asterisk
;extensions => odbc,asterisk
;meetme => mysql,general
;queues => odbc,asterisk
;queue_members => odbc,asterisk
;queue_rules => odbc,asterisk
;acls => odbc,asterisk
;musiconhold => mysql,general
;queue_log => mysql,general


res_odbc.conf
[asterisk]
enabled => yes
dsn => asterisk-mysql
username => root
password => 12223
pre-connect => ye



/etc/asterisk/sip.conf
[general]
switch => Realtime


cd /usr/src/asterisk-13.8.1/contrib/realtime/mysql


mysql -p1234 asterisk < mysql_config.sql

jueves, 7 de abril de 2016

Dialing based on CID

#!/usr/bin/php -q
<?php
set_time_limit(30);
require('/var/lib/asterisk/agi-bin/phpagi-2.20/phpagi.php');
error_reporting(E_ALL);
$agi = new AGI();
$cid = $agi->parse_callerid();
$agi->stream_file("welcome");
$agi->exec("sayalpha","$cid[username]");
//$result = $agi->get_data('agent-pass',8000,3);
$str =$cid[username];
$chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);

$num=0;
$letters=0;

foreach($chars as $elements){

  if (is_numeric($elements)) {
 $num+=1;

  }



 else{
 $letters+=1;

  }



}

$agi->exec("sayalpha","$num");
$agi->exec("sayalpha","$letters");

if($num==4){
$agi->exec_goto("cidialout","$argv[1]","_777");
}


if($num==5){
$agi->exec_goto("cidialout","$argv[1]","_888");
}

?>


[cidialout]
exten=>_x.,1,Noop( Dialing to ${EXTEN})
same=>n(_555 ),Dial(SIP/rapidvox/555${EXTEN},25)
same=>n,Hangup()
same=>n(_666),Dial(SIP/${TRUNK}/666${EXTEN},25)
same=>n,Hangup()
same=>n(_777),Dial(SIP/rapidvox/777${EXTEN},25)
same=>n,Hangup()
same=>n(_888),Dial(SIP/${TRUNK}/888${EXTEN},25)
same=>n,Hangup()



miércoles, 6 de abril de 2016

Record During Dial()

record (monitor to a file) the inbound audio of incoming calls up until the point that those calls are answered. In other words, only record up until the point the dial() command finishes executing and a call is either connected/bridged or sent somewhere else (like voicemail).



:one: The dial() command should look something like this:

exten => 300,n,Dial(SIP/110,30,itTm(stdmusic)M(answered^${CHANNEL}))

:two: The macro should look something like this:

[macro-answered]
exten => s,1,AGI(stop_monitor.agi,${ARG1})

:three: The stop_monitor.agi script should look something like this:

#!/usr/bin/php -q
<?php
$channel = $argv[1];
$socket = fsockopen("localhost","5038", $errno, $errstr, 2);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: <AMI username>\r\n");
fputs($socket, "Secret: <AMI password>\r\n\r\n");
fputs($socket, "Action: StopMonitor\r\n");
fputs($socket, "Channel: $channel\r\n\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
$wrets=fgets($socket,128);
while (!feof($socket)) { $wrets .= fread($socket, 8192); }
fclose($socket);
?>
https://community.asterisk.org/t/record-during-dial-unusual-problem-requires-creative-solution/65974

martes, 5 de abril de 2016

setting the caller caller on outbound call foward

create a misc destination on the GUI like 00818097142323  then  on outbound route on the GUI  with  1NXXNXXXXX


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


exten=>_001NXXNXXXXXX,1,Noop( ${CALLERID(num)})
same=>n,Set(CALLERID(num)=${CALLERID(num)})
same=>n,Goto(from-internal,${EXTEN:2},1)