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, 31 de enero de 2016

Top reasons why VoIP calls drop



VoIP based phone systems bring many benefits, but they also bring some problems. Not least is the annoying tendency for some calls to drop mid-way through your conversation for no obvious reason. In this article I will identify the most common reasons why a VoIP call might suddenly drop mid-way through an established call and explain how you can diagnose the cause. At the end are some pointers to the solutions for these problems.

asterisk confbridge

 /etc/asterisk/confbridge.conf


[general]

[fancybridge]
type=bridge
max_members=20
mixing_interval=10
internal_sample_rate=auto
record_conference=no

[fancyuser]
type=user
music_on_hold_when_empty=yes
music_on_hold_class=Michael
announce_user_count_all=yes
announce_join_leave=yes
dsp_drop_silence=yes
denoise=yes

[fancymenu]
type=menu
*=playback_and_continue(conf-togglemute&press&digits/1&silence/1&conf-leave&press&digits/2&silence/1&add-a-caller&press&digits/3&silence/1&conf-decrease-talking&press&digits/4&silence/1&reset-talking&press$
*1=toggle_mute
1=toggle_mute
*2=leave_conference
2=leave_conference
*3=dialplan_exec(addcallers,1,1)
3=dialplan_exec(addcallers,1,1)
*4=decrease_listening_volume
4=decrease_listening_volume
*5=reset_listening_volume
5=reset_listening_volume
*6=increase_listening_volume
6=increase_listening_volume
7=decrease_talking_volume
7=decrease_talking_volume
*8=reset_talking_volume
8=reset_talking_volume
*9=increase_talking_volume
9=increase_talking_volume
0=leave_conference
0=leave_conference


/etc/asterisk/extensions.conf




[ivr_conference]
exten=>_x.,1,Answer()
same=>n(start),read(conf_num,conference/welcome&conference/intro&conference/disclaimer,1,,,2)
same => n,GotoIf($["${conf_num}">="1"]?ivr_conference,1,1:ivr_conference,no,1)


exten=>1,1(conf),Confbridge(${conf_num},fancybridge,fancyuser,fancymenu)
same=>n,Noop(we quit from the conference ${CONFBRIDGE_RESULT})
same=>n,Goto(ivr_conference,_x.,1)
same=>n,Hangup()

exten=>i,1,Playback(conference/noagree)
same=>n,Hangup()


exten=>t,1,Playback(conference/noagree)
same=>n,Hangup()

exten=>no,1(no),Playback(conference/noagree)
same=>n,Hangup()

jueves, 28 de enero de 2016

asterisk ConfBridge

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_ConfBridge

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

Asterisk custom follow me


  1. [from-internal-custom]
    exten=>007X.,1,NooP( fowarding call to  ${EXTEN:3})
    same=>n,Goto(from-internal,${DB(${EXTEN:3}/dest)},1)

  2. [custom-follow]
  3. exten=>*996,1,Answer()
  4. same=>n(start),Read(num,please-enter-your-extension-then-press-pound)
  5. same=>n,GotoIf($[${LEN(${num})}>=3]?continue)
  6. same=>n,Playback(im-sorry)
  7. same=>n,Goto(start)
  8. same=>n(continue),Read(dest,please-enter-your-extension-then-press-pound)
  9. same=>n,GotoIf($[${LEN(${dest})}>= 3]?ok)
  10. same=>n(ok),Set(DB(${num}/dest)=${dest})
  11. same=>n,Playback(auth-thankyou)
  12. same=>n,SayDigits(${DB(${num}/dest)})
  13. ;;;review
  14. exten=>*997,1,Answer()
  15. same=>n(start),Read(num,please-enter-your-extension-then-press-pound)
  16. same=>n,GotoIf($[${LEN(${num})}>=3]?continue)
  17. same=>n,Playback(im-sorry)
  18. same=>n,Goto(start)
  19. same=>n(continue),Playback(auth-thankyou)
  20. same=>n,SayDigits(${DB(${num}/dest)})

if we want to use it  on an extensions or DID we just set a misc let say 007200 for extension  200 or   00718007142020 for  DID  18007142020

miércoles, 27 de enero de 2016

Using the Asterisk Database (AstDB)

Having fun yet? It gets even better!

Asterisk provides a powerful mechanism for storing values called the Asterisk database (AstDB). The AstDB provides a simple way to store data for use within your dialplan.
For those of you with experience using relational databases such as PostgreSQL or MySQL, the Asterisk database is not a traditional relational database; it is a Berkeley DB version 1 database. There are several ways to store data from Asterisk in a relational database. Check out Chapter 16, Relational Database Integration for more about relational databases.
The Asterisk database stores its data in groupings called families, with values identified by keys. Within a family, a key may be used only once. For example, if we had a family called test, we could store only one value with a key called count. Each stored value must be associated with a family.

viernes, 22 de enero de 2016

call counter

misc destination to this  example  9918007143030

[from-internal-custom]
exten=>101013,1,Agi(ivr.php)
same=>n,Hangup()

exten=>_991NXXNXXXXXX,1,Noop( dialing to this number  ${EXTEN:2})
exten=>_991NXXNXXXXXX,2,Gosub(insert,${EXTEN:2},1)
same=>n,Dial(SIP/${trunk}/${EXTEN:2},25)
same=>n,Hangup()

[insert]
exten=>_X.,1,Noop(var values are ${CALLERID(num)} ${EXTEN})
same=>n,system(mysql --user=root --password='786' counter -e "INSERT INTO calls (id,phone,did) values (NULL,"${EXTEN}","${CALLERID(num)}")")
same=>n,return()




On shell   test


mysql --user=root --password='786' counter -e "INSERT INTO calls (id,phone,did) values (NULL,"13052361010","18007143030")";




SELECT DISTINCT COUNT( * ) , phone
FROM list
GROUP BY phone
LIMIT 0 , 30

viernes, 15 de enero de 2016

Email notifications for missed calls in Asterisk

[<<][asterisk][>>][..]
Wed Apr 18 15:29:28 EDT 2012

Email notifications for missed calls in Asterisk

Cached from [1].
Author: Matt Schmandt

A feature I have wanted for a long time is to get emails about missed
calls. I have a Blackberry and knowing that people are calling and
hanging up before leaving a vm is very useful when I am out in the
field. I wrote a small shell script to add this functionality to
Asterisk.

I place the script in the h extension of the stdexten marco. The h
extension triggers once a call is hung up from that context. The first
and only priority for the h extension is a System() call. It calls
this shell script and passes many parameters to it. The first
parameter is the email address to send the email to. To make this work
for the marco, I adjust the macro to have a third parameter which is
email address. I would like to pull the email address from that
extensions vm but that function does not exist and I could not figure
out how to add that function in the C source code. If anyone knows a
better way, please let me know. The script requires you have the mailx
package installed.

miércoles, 13 de enero de 2016

PHP Asterisk VM checker

#!/usr/bin/php
<?php

//first Voicemail
$exten=18452220881;
$box=1166;
$carrier="vitcom_Outgoing";
$vmnum= system("/usr/sbin/asterisk -x \" voicemail show users\" | grep -i $box |  awk '{print $4}'");

if($vmnum>0) {

echo "you got $vmnum messages";
$call=System("/usr/sbin/asterisk -x \"channel originate Local/$exten@vm_customd extension *97@from-internal\"");
}

else {
echo " no messages found";

}


?>





[vm_customd]
exten=>_x.,1,Set(cid=8457313700)
exten=>_x.,n,Set(CALLERID(num)=${cid}) ;test callerid
exten=>_x.,n,Dial(SIP/vitcom_Outgoing/8977${EXTEN},25)
same=>n,hangup()





*/30 * * * * /usr/bin/php /root/vm.php

lunes, 11 de enero de 2016

Hangup Handlers

Saltar al final de los metadatos
Ir al inicio de los metadatos
Icon
Hangup Handlers were added in Asterisk 11

Overview

Hangup handlers are subroutines attached to a channel that will execute when that channel hangs up. Unlike the traditional h extension, hangup handlers follow the channel. Thus hangup handlers are always run when a channel is hung up, regardless of where in the dialplan a channel is executing.
Multiple hangup handlers can be attached to a single channel. If multiple hangup handlers are attached to a channel, the hangup handlers will be executed in the order of most recently added first.
NOTES
Icon
  • Please note that when the hangup handlers execute in relation to the h extension is not defined. They could execute before or after the h extension.
  • Call transfers, call pickup, and call parking can result in channels on both sides of a bridge containing hangup handlers.
  • Hangup handlers can be attached to any call leg using pre-dial handlers.
WARNINGS
Icon
  • As hangup handlers are subroutines, they must be terminated with a call to Return.
  • Adding a hangup handler in the h extension or during a hangup handler execution is undefined behaviour.
  • As always, hangup handlers, like the h extension, need to execute quickly because they are in the hangup sequence path of the call leg. Specific channel driver protocols like ISDN and SIP may not be able to handle excessive delays completing the hangup sequence.

Dialplan Applications and Functions

All manipulation of a channel's hangup handlers are done using the CHANNEL function. All values manipulated for hangup handlers are write-only.

hangup_handler_push

Used to push a hangup handler onto a channel.
same => n,Set(CHANNEL(hangup_handler_push)=[[context,]exten,]priority[(arg1[,...][,argN])]);

hangup_handler_pop

Used to pop a hangup handler off a channel. Optionally, a replacement hangup handler can be added to the channel.
same => n,Set(CHANNEL(hangup_handler_pop)=[[[context,]exten,]priority[(arg1[,...][,argN])]]);

hangup_handler_wipe

Remove all hangup handlers on the channel. Optionally, a new hangup handler can be pushed onto the channel.
same => n,Set(CHANNEL(hangup_handler_wipe)=[[[context,]exten,]priority[(arg1[,...][,argN])]]);

Examples

Adding hangup handlers to a channel
In this example, three hangup handlers are added to a channel: hdlr3, hdlr2, and hdlr1. When the channel is hung up, they will be executed in the order of most recently added first - so hdlr1 will execute first, followed by hdlr2, then hdlr3.
; Some dialplan extension
same => n,Set(CHANNEL(hangup_handler_push)=hdlr3,s,1(args));
same => n,Set(CHANNEL(hangup_handler_push)=hdlr2,s,1(args));
same => n,Set(CHANNEL(hangup_handler_push)=hdlr1,s,1(args));
; Continuing in some dialplan extension
 
[hdlr1]
 
exten => s,1,Verbose(0, Executed First)
same => n,Return()
 
[hdlr2]
 
exten => s,1,Verbose(0, Executed Second)
same => n,Return()
 
[hdlr3]
 
exten => s,1,Verbose(0, Executed Third)
same => n,Return()
Removing and replacing hangup handlers
In this example, three hangup handlers are added to a channel: hdlr3, hdlr2, and hdlr1. Using the CHANNEL function's hangup_handler_pop value, hdlr1 is removed from the stack of hangup handlers. Then, using the hangup_handler_pop value again, hdlr2 is replaced with hdlr4. When the channel is hung up, hdlr4 will be executed, followed by hdlr3.
; Some dialplan extension
same => n,Set(CHANNEL(hangup_handler_push)=hdlr3,s,1(args));
same => n,Set(CHANNEL(hangup_handler_push)=hdlr2,s,1(args));
same => n,Set(CHANNEL(hangup_handler_push)=hdlr1,s,1(args));
; Remove hdlr1
same => n,Set(CHANNEL(hangup_handler_pop)=)
; Replace hdlr2 with hdlr4
same => n,Set(CHANNEL(hangup_handler_pop)=hdlr4,s,1(args));
 
; Continuing in some dialplan extension
 
[hdlr1]
 
exten => s,1,Verbose(0, Not Executed)
same => n,Return()
 
[hdlr2]
 
exten => s,1,Verbose(0, Not Executed)
same => n,Return()
 
[hdlr3]
 
exten => s,1,Verbose(0, Executed Second)
same => n,Return()
 
[hdlr4]
 
exten => s,1,Verbose(0, Executed First)
same => n,Return()

CLI Commands

Single channel
core show hanguphandlers <chan>
Output
Channel       Handler
<chan-name>   <first handler to execute>
              <second handler to execute>
              <third handler to execute>
All channels
core show hanguphandlers all
Output
Channel       Handler
<chan1-name>  <first handler to execute>
              <second handler to execute>
              <third handler to execute>
<chan2-name>  <first handler to execute>
<chan3-name>  <first handler to execute>
              <second handler to execute>





Hangup handlers are similar to the h extension - they execute logic on a channel when that channel is hung up. Unlike the h extension however, they are associated explicitly with a channel. If a channel moves between contexts it will still safely execute its hangup handlers - while if a channel moved into a context that did not contain an h extension, it would not execute the h extension in the context it just left.

[hdlr1]
 
exten => s,1,Verbose(0, Executed First)
same => n,Return()
 
[context_one]
 
exten => s,1,Set(CHANNEL(hangup_handler_push)=hdlr1,s,1(args));
same => n,Goto(context_two,s,1)
 
exten => h,1,Verbose(1, I wont be executed if the channel hangs up in context_two)
 
[context_two]
 
exten => s,1,Verbose(1, The hangup handler pushed in context_one will still get executed)
same => n,Verbose(1, The h extension in context_one wont)
same => n,Hangup()