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, 1 de abril de 2018

asterisk voicemail configuration sample

/etc/asterisk/extensions.conf
exten => 6001,1,Dial(SIP/demo-alice,20)
exten => 6001,n,VoiceMail(6001@vm-demo,u)
 
exten => 6002,1,Dial(SIP/demo-bob,20)
exten => 6002,n,VoiceMail(6002@vm-demo,u)


/etc/asterisk/voicemail.conf

create  a context called vm-demo


[vm-demo]
6001 => 8762,Alice Jones,alice@example.com,alice2@example.com,attach=no|tz=central|maxmsg=10
6002 => 9271,Bob Smith,bob@example.com,bob2@example.com,attach=yes|tz=eastern


https://wiki.asterisk.org/wiki/display/AST/Configuring+Voice+Mail+Boxes

https://wiki.asterisk.org/wiki/display/AST/Application_VoiceMail

domingo, 25 de marzo de 2018

autoanswer

PPJSIP  and SIP  auto Answer

Set(PJSIP_HEADER(add,Call-Info)=answer-after=0)


Or

Set(PJSIP_HEADER(add,Alert-Info)=info=AutoAnswer)

domingo, 18 de marzo de 2018

Built-in Dynamic Features

Ir al inicio de los metadatos
The FEATURE and FEATUREMAP dialplan functions allow you to set some features.conf options on a per channel basis.
Icon
To see what options are currently supported, look at the FEATURE and FEATUREMAP function descriptions. These functions were added in Asterisk 11.

At this time the functions do not work with custom features. Those are set with a channel variable as described in the Custom Dynamic Features section.
Set the parking time of this channel to be 100 seconds if it is parked.
exten => s,1,Set(FEATURE(parkingtime)=100)
same => n,Dial(SIP/100)
same => n,Hangup()
Set the DTMF sequence for attended transfer on this channel to *9.
exten => s,1,Set(FEATUREMAP(atxfer)=*9)
same => n,Dial(SIP/100,,T)
same => n,Hangup()

Custom Dynamic Features

Ir al inicio de los metadatos

Overview

Asterisk allows you to define custom features mapped to Asterisk applications. You can then enable these features dynamically, on a per-channel basis by using a channel variable.

Defining the Features

Custom features are defined in the applicationmap section of the features.conf file.
Syntax:
[applicationmap]
<FeatureName> = <DTMF_sequence>,<ActivateOn>[/<ActivatedBy>],<Application>[,<AppArguments>[,MOH_Class]]
<FeatureName> = <DTMF_sequence>,<ActivateOn>[/<ActivatedBy>],<Application>[,"<AppArguments>"[,MOH_Class]]
<FeatureName> = <DTMF_sequence>,<ActivateOn>[/<ActivatedBy>],<Application>([<AppArguments>])[,MOH_Class]
Syntax Fields:
Field Name
Description
FeatureNameThis is the name of the feature used when setting the DYNAMIC_FEATURES variable to enable usage of this feature.
DTMF_sequenceThis is the key sequence used to activate this feature.
ActivateOnThis is the channel of the call that the application will be executed on. Valid values are "self" and "peer". "self" means run the application on the same channel that activated the feature. "peer" means run the application on the opposite channel from the one that has activated the feature.
ActivatedByActivatedBy is no longer honored. The feature is activated by which channel DYNAMIC_FEATURES includes the feature is on. Use a pre-dial handler to set different values for DYNAMIC_FEATURES on the channels. Historic values are: "caller", "callee", and "both".
ApplicationThis is the application to execute.
AppArgumentsThese are the arguments to be passed into the application. If you need commas in your arguments, you should use either the second or third syntax, above.
MOH_ClassThis is the music on hold class to play while the idle channel waits for the feature to complete. If left blank, no music will be played.

Application Mapping

The applicationmap is not intended to be used for all Asterisk applications. When applications are used in extensions.conf, they are executed by the PBX core. In this case, these applications are executed outside of the PBX core, so it does *not* make sense to use any application which has any concept of dialplan flow. Examples of this would be things like Goto, Background, WaitExten, and many more.  The exceptions to this are Gosub and Macro routines which must complete for the call to continue.
Enabling these features means that the PBX needs to stay in the media flow and media will not be re-directed if DTMF is sent in the media stream.

Example Feature Definitions:

Here we have defined a few custom features to give you an idea of how the configuration looks.
features.conf
 [applicationmap]
playmonkeys => #9,peer,Playback,tt-monkeys
retrieveinfo => #8,peer,Set(ARRAY(CDR(mark),CDR(name))=${ODBC_FOO(${CALLERID(num)})})
pauseMonitor   => #1,self/callee,Pausemonitor
unpauseMonitor => #3,self/callee,UnPauseMonitor
Example feature descriptions:
  • playmonkeys - Allow both the caller and callee to play tt-monkeys to the bridged channel.
  • retrieveinfo - Set arbitrary channel variables, based upon CALLERID number (Note that the application argument contains commas)
  • pauseMonitor - Allow the callee to pause monitoring on their channel.
  • unpauseMonitor - Allow the callee to unpause monitoring on their channel.

Enabling Features

After you define a custom feature in features.conf you must enable it on a channel by setting the DYNAMIC_FEATURES channel variable.
DYNAMIC_FEATURES accepts as an argument a list of hash-sign delimited feature names.
Example Usage:
extensions.conf
Set(__DYNAMIC_FEATURES=playmonkeys#pauseMonitor#unpauseMonitor)
Tip: Variable Inheritance
Icon
The two leading underscores allow these feature settings to be set on the outbound channels, as well.  Otherwise, only the original channel will have access to these features.

martes, 13 de marzo de 2018

domingo, 11 de marzo de 2018

Block or set timeout calls based on a json response

[gestion_api]
exten=>_x.,1,Agi(/var/www/html/gestion/info.php,${CALLERID(num)},${EXTEN})
same=>n,Noop( time out value ${timeout})
same=>n,Set(TIMEOUT(absolute)=${timeout})
same=>n,goto(from-trunk,${EXTEN},1)


example reponse
{"blocked":0,"timer":0}



#!/usr/bin/php -q

<?php
error_reporting(E_ALL);
set_time_limit(30);
//require_once('/root/phpagi-svn/phpagi.php');
require_once('/var/lib/asterisk/agi-bin/phpagi-2.20/phpagi.php');
 $agi = new AGI();
$agi->answer();
$agi->stream_file("silence/1");
$url=file_get_contents("http://181.31.221.173/match_info.php?cid=$argv[1]&did=$argv[2]");

$url=json_decode($url, true);
$agi->verbose("$url[blocked] $argv[1] $argv[2] ***");
$agi->verbose("$url[timer] ***");
$agi->verbose("continue with the script execution ***");

if ($url[blocked]>0){
echo " calls blocked";
$agi->verbose("calls blocked");

$agi->stream_file("im-sorry");
$agi->hangup();
exit();

}

else {

//$agi->stream_file("auth-thankyou");

$agi->set_autohangup($url[blocked]);
$agi->verbose("calls allowed");
$agi->set_variable("timeout",$url[timer]);

}
exit();

?>



viernes, 9 de marzo de 2018

confimartion call updated version

[confirmation_call_original2]
exten=>_x.,1,Answer()
same=>n,Set(message=welcome)
same=>n(rec),Playback(${message})
same=>n,Record(/root/demo/recording/${CHANNEL:4}.wav,,20,y)
same=>n,Set(__dst=${EXTEN})
same=>n,Set(__file_name=${UNIQUEID})
same=>n,Set(__caller=${CHANNEL})
same=>n,Set(__callercid=${CALLERID(num)})
same=>n,Dial(Local/s@moh2&Local/${EXTEN}@response2)

[moh2]
exten=>s,1,Answer()
same=>n,MusicOnHold(m1)
same=>n,Hangup()


[response2]
exten=>_x.,1,Noop(///${caller}***${key}*  ${dst}**)
;same=>n,System(/usr/sbin/asterisk -x "channel originate SIP/${dst} extension ${caller}@hello2")
same=>n,System(/usr/sbin/asterisk -x "channel originate SIP/103 extension ${caller}@hello2")



[hello2]
exten=>_.,1,Answer()
same => n,read(confirm,/root/demo/recording/${EXTEN:4},1)
same=>n,GotoIf($["${confirm}"="1"]?bridge)
same=>n,GotoIf($["${confirm}"="2"]?vm)
same=>n,Hangup()
same=>n(bridge),Bridge(${EXTEN})
same=>n,Hangup()
same=>n(vm),VoiceMail(103@default,ug(8))