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, 30 de diciembre de 2017

twilio sms url help

https://support.twilio.com/hc/en-us/articles/223183648-Sending-and-Receiving-Limitations-on-Calls-and-SMS-Messages

https://www.twilio.com/docs/api/messaging/message

//https://www.twilio.com/docs/guides/how-to-confirm-delivery-in-php#receive-status-events-in-your-web-application


https://support.twilio.com/hc/en-us/articles/223181708-Can-my-Twilio-SMS-messages-be-blacklisted-as-spam-


https://www.twilio.com/blog/2017/12/how-to-set-up-sms-broadcasts-in-five-minutes.html

asterisk control playback

exten=>002,1,Answer()


exten=>002,n,controlplayback(/var/www/html/cdr/recordings/1514305802.24597,10000,#,*,0,1,2,,)




# avanza

* retrocede

0 para

1 pausa y vuelve a reiniciar donde se quedo pausado

2  empieza desde el principio



Arguments
  • filename
  • skipms - This is number of milliseconds to skip when rewinding or fast-forwarding.
  • ff - Fast-forward when this DTMF digit is received. (defaults to #)
  • rew - Rewind when this DTMF digit is received. (defaults to *)
  • stop - Stop playback when this DTMF digit is received.
  • pause - Pause playback when this DTMF digit is received.
  • restart - Restart playback when this DTMF digit is received.
  • options
    • otime )
      • time - Start at time ms from the beginning of the file.

jueves, 21 de diciembre de 2017

Directories Used by Asterisk


Asterisk uses several directories on a Linux system to manage the various aspects of the system, such as voicemail recordings, voice prompts, and configuration files. This section discusses the necessary directories, all of which are created during installation and configured in the asterisk.conf file.

/etc/asterisk/

The /etc/asterisk/ directory contains the Asterisk configuration files. One file, however—zaptel.conf—is located in the /etc/ directory. The Zaptel hardware was originally designed by Jim Dixon of the Zapata Telephony Group as a way of bringing reasonable and affordable computer telephony equipment to the world. Asterisk makes use of this hardware, but any other software can also make use of the Zaptel hardware and drivers. Consequently, the zaptel.conf configuration file is not directly located in the /etc/asterisk/directory.

/usr/lib/asterisk/modules/

The /usr/lib/asterisk/modules/ directory contains all of the Asterisk loadable modules. Within this directory are the various applications, codecs, formats, and channels used by Asterisk. By default, Asterisk loads all of these modules at startup. You can disable any modules you are not using in the modules.conf file, but be aware that certain modules are required by Asterisk or are dependencies of other modules. Attempting to load Asterisk without these modules will cause an error at startup.

/var/lib/asterisk

The /var/lib/asterisk/ directory contains the astdb file and a number of subdirectories. The astdb file contains the local Asterisk database information, which is somewhat like the Microsoft Windows Registry. The Asterisk database is a simple implementation based on v1 of the Berkeley database. The db.c file in the Asterisk source states that this version was chosen for the following reason: “DB3 implementation is released under an alternative license incompatible with the GPL. Thus, in order to keep Asterisk licensing simplistic, it was decided to use version 1 as it is released under the BSD license.”
The subdirectories within /var/lib/asterisk/ include:
agi-bin/
The agi-bin/ directory contains your custom scripts, which can interface with Asterisk via the various built-in AGI applications. For more information about AGI, see Chapter 8, Protocols for VoIP.
firmware/
The firmware/ directory contains firmware for various Asterisk-compatible devices. It currently contains only the iax/ subdirectory, which holds the binary firmware image for Digium’s IAXy.
images/
Applications that communicate with channels supporting graphical images look in the images/ directory. Most channels do not support the transmission of images, so this directory is rarely used. However, if more devices that support and make use of graphical images are released, this directory will become more relevant.
keys/
Asterisk can use a public/private key system to authenticate peers connecting to your box via an RSA digital signature. If you place a peer’s public key in your keys/ directory, that peer can be authenticated by channels supporting this method (such as the IAX2 channels). The private key is never distributed to the public. The reverse is also true: you can distribute your public key to your peers, allowing you to be authenticated with the use of your private key. Both the public and private keys—ending in the .pub and .key file extensions, respectively—are stored in the keys/ directory.
mohmp3/
When you configure Asterisk for Music on Hold, applications utilizing this feature look for their MP3 files in the mohmp3/ directory. Asterisk is a bit picky about how the MP3 files are formatted, so you should use constant bitrate (CBR) encoding and strip the ID3 tags from your files.
sounds/
All of the available voice prompts for Asterisk reside in the sounds/ directory. The contents of the basic prompts included with Asterisk are in the sounds.txt file located in your Asterisk source code directory. Contents of the additional prompts are located in the sounds-extra.txt file in the directory to which you extracted theasterisk-sounds package earlier in this chapter.

/var/spool/asterisk/

The Asterisk spool directory contains several subdirectories, including dictate/, meetme/, monitor/, outgoing/system/tmp/, and voicemail/ (see Figure 3.4, “/var/spool/asterisk/ directory structure”). Asterisk monitors the outgoing directory for text files containing call request information. These files allow you to generate a call simply by moving the correctly structured file into the outgoing/ directory.
Figure 3.4. /var/spool/asterisk/ directory structure
/var/spool/asterisk/ directory structure
Call files being placed into the outgoing/ directory can contain useful information, such as the Context, Extension, and Priority where the answered call should start, or simply the application and its arguments. You can also set variables and specify an account code for Call Detail Records. More information about the use of call files is presented in Chapter 9, The Asterisk Gateway Interface (AGI).
The dictate/ directory is the default location where the Dictate() application looks for files.
The meetme/ directory is the location where MeetMe() conference recordings are saved.
Recordings from either one-touch recording (the w and W flags to the Dial() application), the MixMonitor(), or Monitor() applications are stored in the monitor/ directory.
system/ is used by the System() application for temporary storage of data.
The tmp/ directory is used, funny enough, to hold temporary information. Certain applications may require a place to write files to before copying the complete files to their final destinations. This prevents two processes from trying to write to and read from a file at the same time.
All voicemail and user greetings are contained within the voicemail/ directory. Extensions configured in voicemail.conf that have been logged in to at least once are created as subdirectories of voicemail/.

/var/run/

The /var/run/ directory contains the process ID (PID) information for all active processes on the system, including Asterisk (as specified in the asterisk.conf file). Note that /var/run/ is OS-dependent and may differ.

/var/log/asterisk/

The /var/log/asterisk/ directory is where Asterisk logs information. You can control the type of information being logged to the various files by editing the logger.conffile located in the /etc/asterisk/ directory. Basic configuration of the logger.conf file is covered in Appendix D, Configuration Files.

/var/log/asterisk/cdr-csv

The /var/log/asterisk/cdr-csv directory is used to store the CDRs in comma-separated value (CSV) format. By default information is stored in the Master.csv file, but individual accounts can store their own CDRs in separate files with the use of the accountcode option (see Appendix A, VoIP Channels for more information).

jueves, 14 de diciembre de 2017

Early Media

Early media is simply media that is sent before a call is answered. It’s not the voice of the person you called, but rather system tones, announcements, or any other sound that the phone company wants to send your way. It’s the distinctive ringing you hear when you call a telephone in England. It’s an “all circuits are busy” message. It’s anything you might hear until you hear the called party’s voice.
Early media is typically supported by the use of the 183 Session In Progress response. Unlike a 180 Ringing response, 183 will contain SDP. This SDP is used to establish a media connection that carries those network tones and messages. It will eventually be torn down when the call is answered, but until then, it’s a way for the caller to audibly hear call progress.
I have been talking about early media in terms of the public switched telephone network (PSTN), but early media is also used by some IP PBXs. Why? Because they want to play the same kinds of sounds that the PSTN uses. They want to play announcements and country specific ring-back. Remember, PBXs are rooted in the same TDM world as the PSTN and have adopted much of its behavior.

https://andrewjprokop.wordpress.com/2014/04/18/sip-media-management-early-media-vs-late-media/

https://tools.ietf.org/html/rfc3960

miércoles, 13 de diciembre de 2017

asterisk expressions

same=>n,GotoIf($[$["${profile_id:0:-1}"= "6"] & $["${version:0:-1}"<"7"]]?from-internal,970040015,1)


same=>n,GotoIf($[$["${profile_id:0:-1}"= "6"] & $["${version:0:-1}">="7"] & $["${version:0:-1}"<="8"]]?from-internal,970040010,1)

sábado, 9 de diciembre de 2017

Asterisk timing calls based on API

#!/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://108.61.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();

?>

jueves, 23 de noviembre de 2017

freepbx modules

https://wiki.freepbx.org/display/FPG/Module+List

https://www.freepbx.org/store/commercial-modules/

https://wiki.freepbx.org/pages/viewpage.action?pageId=37912685

miércoles, 8 de noviembre de 2017

a2billing caller id authentication

CLID Enablecid_enableyes

Ask PINcid_askpincode_ifnot_calleridYes
Then add the CID to the customer ( in this case  customer id is1  ) and all calls from my cell pjobe having this caller id will be authenticated automatically





enable direct dialing on a2billing( disabled enter pin)

use_dnid=yes  , number_try=1 , play_audio=no

Note  need to disabled Caller Id Verification

CLID Enablecid_enableNoenable the callerid authentication if this option is active the CC system will check the CID of caller .agi-conf1  Edit this Configuration
Ask PINcid_askpincode_ifnot_calleridNoif the CID does not exist, then the caller will be prompt to enter his cardnumber .agi-conf1

a2billing rate

_

 A2BILLING 7 DIGITS RATE  EXAMPLE : 3051010

domingo, 5 de noviembre de 2017

a2billing enabled calling card with pin number


inbound calls to

[a2billing-out]
exten => _X.,1,AGI(a2billing.php,1)
exten => _X.,n,Hangup()



a2billing settings


cid_askpincode_ifnot_callerid=yes

use_dni=no

number_try=2

play_audio=yes

this will eneable  the ivr asking for pin # ( card number)

jueves, 2 de noviembre de 2017

restarting freepbx every midnight

crontab -e
@midnight /usr/sbin/fwconsole restart > /root/asterisk-results.txt 2> /root/asterisk-errror.txt


verify crontab -l

miércoles, 1 de noviembre de 2017

recording conference system

  1. [conferencesys]
  2. exten=>_x.,1,Answer()
  3. ;same=>n,System(php /var/www/html/conference/insert.php ${UNIQUEID} ${CDR(billsec)} ${CALLERID(num)} ${UNIQUEID})
  4. same=>n,Set(Id=${SHELL(php /var/www/html/conference/insert.php ${UNIQUEID} ${CDR(billsec)} ${CALLERID(num)} ${UNIQUEID})})
  5. same=>n,Playback(confirm-number-is)
  6. same=>n,Saydigits(${Id})
  7. same=>n,Set(CONFBRIDGE(bridge,record_conference)=yes)
  8. same=>n,Set(CONFBRIDGE(bridge,record_file)=/var/www/html/conference/${UNIQUEID}.wav)
  9. same=>n,Set(CONFBRIDGE(bridge,max_members)=1)
  10. same=>n,ConfBridge(${UNIQUEID})
  11. same=>n,hangup()
  12. exten=>h,1,Noop(${UNIQUEID} ..)
  13. same=>n,Set(path=${SHELL(find /var/www/html/conference -name ${UNIQUEID}*)})
  14. same=>n,System(mysql --user=root --password='1234' conferences -e "update recordings set path='${path:0:-1}',duration='${CDR(billsec)}' where Id='${Id}'")
  15. [listenrec]
  16. exten=>_x.,1,Answer()
  17. same=>n,read(idnum,enter-conf-call-number)
  18. same=>n,Set(Id=${SHELL(mysql --user=root --password='1234' --skip-column-names  conferences -e "select path from recordings where Id='${idnum}'")})
  19. same=>n,Noop(${Id:0:-5})
  20. same=>n,Playback(${Id:0:-5})
  21. <?php
  22. $link = mysqli_connect("localhost", "root", "1234", "conferences");
  23. /* check connection */
  24. if (mysqli_connect_errno()) {
  25.     printf("Connect failed: %s\n", mysqli_connect_error());
  26.     exit();
  27. }
  28. $conf_name=$argv[1];
  29. $duration=$argv[2];
  30. $cid=$argv[3];
  31. $path="/var/www/html/conference/$argv[4]";
  32. $query = "INSERT INTO  `conferences`.`recordings` (
  33. `id` ,
  34. `path` ,
  35. `conference_name` ,
  36. `duration` ,
  37. `callerid` ,
  38. `date` ,
  39. `reserved1` ,
  40. `reserved2`
  41. )
  42. VALUES (
  43. NULL ,  '$path',  '$conf_name',  '$duration',  '$cid',
  44. CURRENT_TIMESTAMP , NULL , NULL
  45. )";
  46. if(mysqli_query($link, $query)) {
  47. printf(mysqli_insert_id($link));
  48. exit();
  49. }
  50. else {
  51.  printf("Error: %s\n", mysqli_error($link));
  52. }
  53. /* close connection */
  54. mysqli_close($link);
  55. ?>
  56. Creating table
CREATE TABLE IF NOT EXISTS `recordings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `path` varchar(150) DEFAULT NULL,
  `conference_name` varchar(20) NOT NULL,
  `duration` varchar(10) NOT NULL,
  `callerid` varchar(20) DEFAULT NULL,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `reserved1` varchar(20) DEFAULT NULL,
  `reserved2` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`,`conference_name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;



RAW Paste Data

martes, 31 de octubre de 2017

Asterisk Project… Asterisk Standard Channel Variables Various application variables

Saltar al final de los metadatos
Ir al inicio de los metadatos
  • ${CURL} - Resulting page content for CURL()
  • ${ENUM} - Result of application EnumLookup()
  • ${EXITCONTEXT} - Context to exit to in IVR menu (Background()) or in the RetryDial() application
  • ${MONITOR} - Set to "TRUE" if the channel is/has been monitored (app monitor())
  • ${MONITOR_EXEC} - Application to execute after monitoring a call
  • ${MONITOR_EXEC_ARGS} - Arguments to application
  • ${MONITOR_FILENAME} - File for monitoring (recording) calls in queue
  • ${QUEUE_PRIO} - Queue priority
  • ${QUEUE_MAX_PENALTY} - Maximum member penalty allowed to answer caller
  • ${QUEUE_MIN_PENALTY} - Minimum member penalty allowed to answer caller
  • ${QUEUESTATUS} - Status of the call, one of: (TIMEOUT | FULL | JOINEMPTY | LEAVEEMPTY | JOINUNAVAIL | LEAVEUNAVAIL)
  • ${QUEUEPOSITION} - When a caller is removed from a queue, his current position is logged in this variable. If the value is 0, then this means that the caller was serviced by a queue member. If non-zero, then this was the position in the queue the caller was in when he left.
  • ${RECORDED_FILE} - Recorded file in record()
  • ${TALK_DETECTED} - Result from talkdetect()
  • ${TOUCH_MONITOR} - The filename base to use with Touch Monitor (auto record)
  • ${TOUCH_MONITOR_PREF} - The prefix for automonitor recording filenames.
  • ${TOUCH_MONITOR_FORMAT} - The audio format to use with Touch Monitor (auto record)
  • ${TOUCH_MONITOR_OUTPUT} - Recorded file from Touch Monitor (auto record)
  • ${TOUCH_MONITOR_MESSAGE_START} - Recorded file to play for both channels at start of monitoring session
  • ${TOUCH_MONITOR_MESSAGE_STOP} - Recorded file to play for both channels at end of monitoring session
  • ${TOUCH_MIXMONITOR} - The filename base to use with Touch MixMonitor (auto record)
  • ${TOUCH_MIXMONITOR_FORMAT} - The audio format to use with Touch MixMonitor (auto record)
  • ${TOUCH_MIXMONITOR_OUTPUT} - Recorded file from Touch MixMonitor (auto record)
  • ${TXTCIDNAME} - Result of application TXTCIDName
  • ${VPB_GETDTMF} - chan_vpb

sábado, 28 de octubre de 2017

asterisk-voicemail-transcription-via-ibm-bluemix-speech-

https://jrklein.com/2015/08/17/asterisk-voicemail-transcription-via-ibm-bluemix-speech-to-text-api/

Microsft TTS

https://docs.microsoft.com/en-us/azure/cognitive-services/speech/concepts

https://azure.microsoft.com/en-us/services/cognitive-services/speech/

https://docs.microsoft.com/en-us/azure/cognitive-services/speech/concepts#recognition-modes

https://docs.microsoft.com/en-us/azure/cognitive-services/speech/getstarted/getstartedrest?tabs=curl

https://docs.microsoft.com/en-us/azure/cognitive-services/speech/api-reference-rest/supportedlanguages


 curl -v -X POST "https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservicdetailed" -H "Transfer-Encoding: chunked" -H "Ocp-Apim-Subscription-Key: 7f4f6dcfa2d34ab7ac05f49dba4f34bbOO" -H "Content-type: audio/wav; codec=audio/pcm; samplerate=16000" --data-binary @hello-world.wav

https://azure.microsoft.com/es-es/try/cognitive-services/?apiSlug=speaker-recognition-api&country=DominicanRepublic&allowContact=true

miércoles, 25 de octubre de 2017

saving recording path on the cdr ( FreePBX)

  1. [macro-record-enable]
  2. include => macro-record-enable-custom
  3. exten => s,1,GotoIf($["${BLINDTRANSFER}" = ""]?check)
  4. exten => s,n,ResetCDR(w)
  5. exten => s,n,StopMixMonitor()
  6. exten => s,n(check),ExecIf($["${ARG1}"=""]?MacroExit())
  7. exten => s,n,GotoIf($["${ARG2}"="Group"]?Group:OUT)
  8. exten => s,n(Group),Set(LOOPCNT=${FIELDQTY(ARG1,-)})
  9. exten => s,n,Set(ITER=1)
  10. exten => s,n(begin),Noop(macro-record-enable group loop begin)
  11. exten => s,n,Set(TEXTEN=${CUT(ARG1,-,${ITER})})
  12. exten => s,n,Set(CALLFILENAME=g${TEXTEN}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID})
  13. exten => s,n,Goto(record)
  14. exten => s,n(continue),Set(ITER=$[${ITER}+1])
  15. exten => s,n,GotoIf($[${ITER}<=${LOOPCNT}]?begin)
  16. exten => s,n,MacroExit()
  17. exten => s,n(OUT),GotoIf($["${ARG2}"="IN"]?IN)
  18. exten => s,n,Set(CALLFILENAME=OUT${ARG1}-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID})
  19. exten => s,n,Goto(record)
  20. exten => s,n(IN),Noop(macro-record-enable IN)
  21. exten => s,n,Set(CALLFILENAME=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${UNIQUEID})
  22. exten => s,n(record),MixMonitor(${EVAL(${MIXMON_DIR})}${CALLFILENAME}.${MIXMON_FORMAT},,${MIXMON_POST})
  23. exten=>s,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})
  24. exten => s,n,MacroExit()



I modify the recording macro adding the  additional line to  extensions_override_freepbx.conf



I just added this line  exten=>s,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME})

martes, 24 de octubre de 2017

freepbx extensions_override_freepbx.conf saving on a DB

  1. [from-internal] save Vm on  DB ;save recording  on inbound
  2. exten=>h,1,Noop(${VM_MESSAGEFILE}   )
  3. same=>n,System(php /var/www/html/voicemail/insert.php ${VM_MESSAGEFILE} )
  4. ;same=>n,Set(CDR(accountcode)=00000)
  5. ;same=>n,Set(CDR(userfield)=222)
  6. same=>n,hangup()

  1. [macro-dialout-trunk] ;save recording  on outbound
  2. include => macro-dialout-trunk-custom
  3. exten => s,1,Set(DIAL_TRUNK=${ARG1})
  4. exten=>s,n,Set(CDR(userfield)=${MIXMONITOR_FILENAME});; code ${EPOCH},,%Y%m%d-%H%M%S)}
  5. [from-did-direct]
  6. exten=>h,1,Set(CDR(userfield)=${MIXMONITOR_FILENAME}) ;save recording  on inbound


PHP

<?php


$db_values=array();

$filename=$argv[1].".txt";
   // echo "$filename  path  <br><br>";
$vm_prop=file($filename);
foreach($vm_prop as $key=>$value) {
//echo" $key => $value<br>";
$db_values[]=$value;
}
print_r($db_values);


function clean($var) {
$var=stristr($var, '=');
$var=str_replace ("=" ,"",$var);

return $var;

}
$path=$argv[1].".wav";
//$path=str_replace("txt","wav",$path);
$origmailbox=clean($db_values[4]);
$duration=clean($db_values[16]);
$callerchan=clean($db_values[10]);
$callerid=clean($db_values[11]);
$origdate=clean($db_values[12]);



$link = mysqli_connect("localhost", "asteriskuser", "amp109", "asteriskcdrdb");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}


$query = "INSERT INTO `voicemails` (`id`, `origmailbox`, `context`, `macrocontext`, `exten`, `rdnis`, `priority`, `callerchan`, `callerid`, `origdate`, `origtime`, `category`, `duration`, `path`) VALUES (NULL, '$origmailbox', 'context', 'macro-context-1', 'exten', 'rdsi', 'prio', '$callerchan', '$callerid', '$origdate', 'origtime', 'categ', '$duration', '$path')";


if(mysqli_query($link, $query)) {

printf ("New Record has id %d.\n", mysqli_insert_id($link));
}

else {

 printf("Error: %s\n", mysqli_error($link));

}
/* close connection */
mysqli_close($link);
?>