Hello, i need to hangup an active call if an user start a new call with the same extension. The problem is for example using the softphone when an user start a new call (using the “callto” link from the browser) it open a new sip line but keeps also the previous call active. So, basically what i want is to force hangup all previous calls before start a new call. Maybe it’s possible using the dialplan, any idea?. Thanks in advance!
You will need to store the channel name in global variables.
I assume you mean device, rather than extension.
Thank you David, I solved it creating this ael script inside the dialout macro:
if(GLOBAL(USER_${CALLERID(number)}_CHANNEL) != "") {
Log(NOTICE, Hungup ${CALLERID(number)} previous channel: ${USER_${CALLERID(number)}_CHANNEL});
System(/usr/sbin/asterisk -rx "channel request hangup ${USER_${CALLERID(number)}_CHANNEL}");
}
Log(NOTICE, Setting ${CALLERID(number)} current channel: ${CHANNEL});
Set(GLOBAL(USER_${CALLERID(number)}_CHANNEL)=${CHANNEL});
And then after the Hangup() line:
Set(GLOBAL(USER_${CALLERID(number)}_CHANNEL)="");