summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-pbx/root
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-pbx/root')
-rwxr-xr-xapplications/luci-pbx/root/etc/init.d/pbx-asterisk152
-rwxr-xr-xapplications/luci-pbx/root/etc/pbx-asterisk/delayedcallback18
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions.conf.TEMPLATE1
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check.conf.TEMPLATE1
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check_footer.conf.TEMPLATE2
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check_header.conf.TEMPLATE3
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_gtalk.conf.TEMPLATE4
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_header.conf.TEMPLATE1
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_sip.conf.TEMPLATE4
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_default.conf.TEMPLATE2
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_disa-nopin.conf.TEMPLATE5
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_gtalk.conf.TEMPLATE2
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_sip.conf.TEMPLATE2
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/extensions_voicemail_enabled.conf.TEMPLATE28
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/sip.conf.TEMPLATE2
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/sounds/auth-incorrect.gsmbin0 -> 7458 bytes
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/sounds/beep.gsmbin0 -> 726 bytes
-rw-r--r--applications/luci-pbx/root/etc/pbx-asterisk/sounds/vm-goodbye.gsmbin0 -> 1683 bytes
18 files changed, 211 insertions, 16 deletions
diff --git a/applications/luci-pbx/root/etc/init.d/pbx-asterisk b/applications/luci-pbx/root/etc/init.d/pbx-asterisk
index 99663a971..e05ae11cd 100755
--- a/applications/luci-pbx/root/etc/init.d/pbx-asterisk
+++ b/applications/luci-pbx/root/etc/init.d/pbx-asterisk
@@ -54,6 +54,14 @@ TMPL_EXTCTHRUCHECK=$TEMPLATEDIR/extensions_disa-check.conf.TEMPLATE
TMPL_EXTCTHRUCHECKFTR=$TEMPLATEDIR/extensions_disa-check_footer.conf.TEMPLATE
TMPL_EXTCTHRUHDR=$TEMPLATEDIR/extensions_disa_header.conf.TEMPLATE
TMPL_EXTCTHRU=$TEMPLATEDIR/extensions_disa.conf.TEMPLATE
+TMPL_EXTCTHRUNOPIN=$TEMPLATEDIR/extensions_disa-nopin.conf.TEMPLATE
+
+TMPL_EXTCBACKCHECKHDR=$TEMPLATEDIR/extensions_callback-check_header.conf.TEMPLATE
+TMPL_EXTCBACKCHECK=$TEMPLATEDIR/extensions_callback-check.conf.TEMPLATE
+TMPL_EXTCBACKCHECKFTR=$TEMPLATEDIR/extensions_callback-check_footer.conf.TEMPLATE
+TMPL_EXTCBACKHDR=$TEMPLATEDIR/extensions_callback_header.conf.TEMPLATE
+TMPL_EXTCBACKSIP=$TEMPLATEDIR/extensions_callback_sip.conf.TEMPLATE
+TMPL_EXTCBACKGTALK=$TEMPLATEDIR/extensions_callback_gtalk.conf.TEMPLATE
TMPL_EXTENSIONS=$TEMPLATEDIR/extensions.conf.TEMPLATE
@@ -114,6 +122,18 @@ localusers_can_dial=""
# which will be used to dial out by default (whose outgoing contexts will
# be included in users' contexts by default.
outbound_providers=""
+sip_outbound_providers=""
+gtalk_outbound_providers=""
+
+# Function which escapes non-alpha-numeric characters in a string
+escape_non_alpha() {
+ echo $@ | sed 's/\([^a-zA-Z0-9]\)/\\\1/g'
+}
+
+# Function which replaces non-alpha-numeric characters with an underscore
+sub_underscore_for_non_alpha() {
+ echo $@ | sed 's/[^a-zA-Z0-9]/_/g'
+}
# Copies the template files which we don't edit.
copy_unedited_templates_over()
@@ -149,6 +169,7 @@ pbx_create_extensions_config()
rm -f $WORKDIR/outextgtalk.TMP
mv $WORKDIR/blacklist.TMP $WORKDIR/extensions_blacklist.conf
mv $WORKDIR/userext.TMP $WORKDIR/extensions_user.conf
+
cp $TMPL_EXTCTHRUHDR $WORKDIR/extensions_callthrough.conf
cat $WORKDIR/callthrough.TMP >> $WORKDIR/extensions_callthrough.conf 2>/dev/null
rm -f $WORKDIR/callthrough.TMP
@@ -156,6 +177,15 @@ pbx_create_extensions_config()
cat $WORKDIR/callthroughcheck.TMP >> $WORKDIR/extensions_callthrough.conf 2>/dev/null
rm -f $WORKDIR/callthroughcheck.TMP
cat $TMPL_EXTCTHRUCHECKFTR >> $WORKDIR/extensions_callthrough.conf 2>/dev/null
+
+ cp $TMPL_EXTCBACKHDR $WORKDIR/extensions_callback.conf
+ cat $WORKDIR/callback.TMP >> $WORKDIR/extensions_callback.conf 2>/dev/null
+ rm -f $WORKDIR/callback.TMP
+ cat $TMPL_EXTCBACKCHECKHDR >> $WORKDIR/extensions_callback.conf 2>/dev/null
+ cat $WORKDIR/callbackcheck.TMP >> $WORKDIR/extensions_callback.conf 2>/dev/null
+ rm -f $WORKDIR/callbackcheck.TMP
+ cat $TMPL_EXTCBACKCHECKFTR >> $WORKDIR/extensions_callback.conf 2>/dev/null
+
rm -f $WORKDIR/outext-*.TMP
rm -f $WORKDIR/localext.TMP
sed "s/|LOCALUSERS|/$localusers_to_ring/g" $TMPL_EXTDEFAULT \
@@ -246,13 +276,17 @@ pbx_add_user()
{
local fullname
local defaultuser
+ local rawdefaultuser
local secret
local ring
local can_call
config_get fullname $1 fullname
- config_get defaultuser $1 defaultuser
+ fullname=`escape_non_alpha $fullname`
+ config_get rawdefaultuser $1 defaultuser
+ defaultuser=`escape_non_alpha $rawdefaultuser`
config_get secret $1 secret
+ secret=`escape_non_alpha $secret`
config_get ring $1 ring
config_get can_call $1 can_call
@@ -263,7 +297,7 @@ pbx_add_user()
if [ "$can_call" = "yes" ] ; then
# Add user to list of all users that are allowed to make calls.
- localusers_can_dial="$localusers_can_dial $defaultuser"
+ localusers_can_dial="$localusers_can_dial $rawdefaultuser"
sed -i "s/|CONTEXTNAME|/$defaultuser/g" $WORKDIR/sip_user.tmp
else
sed -i "s/|CONTEXTNAME|/$HANGUPCNTXT/g" $WORKDIR/sip_user.tmp
@@ -307,13 +341,18 @@ pbx_add_jabber()
local statusmessage
config_get username $1 username
+ username=`escape_non_alpha $username`
config_get secret $1 secret
+ secret=`escape_non_alpha $secret`
+ #TODO: Is this really necessary here? Numprefix is retrieved below.
config_get numprefix $1 numprefix
config_get register $1 register
config_get make_outgoing_calls $1 make_outgoing_calls
config_get name $1 name
config_get status $1 status
+ status=`escape_non_alpha $status`
config_get statusmessage $1 statusmessage
+ statusmessage=`escape_non_alpha $statusmessage`
[ -z "$username" -o -z "$secret" ] && return
@@ -338,7 +377,7 @@ pbx_add_jabber()
# messes entered by users.
set $users_to_ring
users_to_ring="SIP\/$1" && shift
- for u in $@ ; do users_to_ring=$users_to_ring\\\&SIP\\\/$u ; done
+ for u in $@ ; do u=`escape_non_alpha $u` ; users_to_ring=$users_to_ring\\\&SIP\\\/$u ; done
fi
# Now, we add this account to the gtalk incoming context.
@@ -361,6 +400,7 @@ pbx_add_jabber()
[ -z "$numprefix" ] && numprefix="X"
for p in $numprefix ; do
+ p=`escape_non_alpha $p`
sed "s/|NUMPREFIX|/$p/g" $TMPL_EXTOUTGTALK |\
sed "s/|NAME|/$name/g" >> $WORKDIR/outext-$name.TMP
done
@@ -371,6 +411,13 @@ pbx_add_jabber()
else
outbound_providers="$outbound_providers $name"
fi
+
+ # Add this provider to the list of enabled gtalk outbound providers.
+ if [ -z "$gtalk_outbound_providers" ] ; then
+ gtalk_outbound_providers="$name"
+ else
+ gtalk_outbound_providers="$gtalk_outbound_providers $name"
+ fi
fi
rm -f $WORKDIR/jabber.tmp
@@ -394,11 +441,16 @@ pbx_add_peer()
local outboundproxy
config_get defaultuser $1 defaultuser
+ defaultuser=`escape_non_alpha $defaultuser`
config_get secret $1 secret
+ secret=`escape_non_alpha $secret`
config_get host $1 host
+ host=`escape_non_alpha $host`
config_get port $1 port
config_get outbountproxy $1 outboundproxy
+ outbountproxy=`escape_non_alpha $outbountproxy`
config_get fromdomain $1 fromdomain
+ fromdomain=`escape_non_alpha $fromdomain`
config_get register $1 register
config_get numprefix $1 numprefix
config_get make_outgoing_calls $1 make_outgoing_calls
@@ -453,6 +505,7 @@ pbx_add_peer()
# If no prefixes are specified, then we use "X" which matches any prefix.
[ -z "$numprefix" ] && numprefix="X"
for p in $numprefix ; do
+ p=`escape_non_alpha $p`
sed "s/|NUMPREFIX|/$p/g" $TMPL_EXTOUTSIP |\
sed "s/|NAME|/$name/g" >> $WORKDIR/outext-$name.TMP
done
@@ -463,6 +516,13 @@ pbx_add_peer()
else
outbound_providers="$outbound_providers $name"
fi
+
+ # Add this provider to the list of enabled sip outbound providers.
+ if [ -z "$sip_outbound_providers" ] ; then
+ sip_outbound_providers="$name"
+ else
+ sip_outbound_providers="$sip_outbound_providers $name"
+ fi
fi
rm -f $WORKDIR/sip_peer.tmp
@@ -477,6 +537,7 @@ pbx_create_user_contexts()
local providers
for u in $localusers_can_dial ; do
+ u=`escape_non_alpha $u`
sed "s/|DEFAULTUSER|/$u/g" $TMPL_EXTUSERCNTXTHDR >> $WORKDIR/userext.TMP
cat $WORKDIR/localext.TMP >> $WORKDIR/userext.TMP
providers="`uci -q get ${MODULENAME}-calls.providers_user_can_use.$u`"
@@ -504,6 +565,7 @@ pbx_add_blacklist()
# to the context for a check against the list anyway.
cp $TMPL_EXTBLKLISTHDR $WORKDIR/blacklist.TMP
for n in $blacklist1 $blacklist2 ; do
+ n=`escape_non_alpha $n`
sed "s/|BLACKLISTITEM|/$n/g" $TMPL_EXTBLKLIST >> $WORKDIR/blacklist.TMP
done
cat $TMPL_EXTBLKLISTFTR >> $WORKDIR/blacklist.TMP
@@ -517,10 +579,13 @@ pbx_add_callthrough()
local defaultuser
local pin
local enabled
+ local F
config_get callthrough_number_list $1 callthrough_number_list
config_get defaultuser $1 defaultuser
+ defaultuser=`escape_non_alpha $defaultuser`
config_get pin $1 pin
+ pin=`escape_non_alpha $pin`
config_get enabled $1 enabled
[ "$enabled" = "no" ] && return
@@ -529,12 +594,66 @@ pbx_add_callthrough()
for callthrough_number in $callthrough_number_list ; do
sed "s/|NUMBER|/$callthrough_number/g" $TMPL_EXTCTHRUCHECK >> $WORKDIR/callthroughcheck.TMP
- sed "s/|NUMBER|/$callthrough_number/g" $TMPL_EXTCTHRU |\
- sed "s/|DEFAULTUSER|/$defaultuser/" |\
- sed "s/|PIN|/$pin/" >> $WORKDIR/callthrough.TMP
+ if [ -n "$pin" ] ; then F=$TMPL_EXTCTHRU ; else F=$TMPL_EXTCTHRUNOPIN ; fi
+ sed "s/|NUMBER|/$callthrough_number/g" $F |\
+ sed "s/|DEFAULTUSER|/$defaultuser/" |\
+ sed "s/|PIN|/$pin/" >> $WORKDIR/callthrough.TMP
done
}
+
+# Creates the callback context which allows specified numbers to get
+# a callback into the PBX and dial out as the configured user.
+pbx_add_callback()
+{
+ local callback_number_list
+ local defaultuser
+ local pin
+ local enabled
+ local callback_provider
+ local callback_hangup_delay
+ local FB
+ local FT
+
+ config_get callback_number_list $1 callback_number_list
+ config_get defaultuser $1 defaultuser
+ defaultuser=`escape_non_alpha $defaultuser`
+ config_get pin $1 pin
+ pin=`escape_non_alpha $pin`
+ config_get enabled $1 enabled
+ config_get callback_provider $1 callback_provider
+ callback_provider=`sub_underscore_for_non_alpha $callback_provider`
+ config_get callback_hangup_delay $1 callback_hangup_delay
+
+ [ "$enabled" = "no" ] && return
+ [ "$defaultuser" = "" ] && return
+
+ # If the provider is a SIP provider, set the file to use to $TMPL_EXTCBACKSIP
+ # otherwise, set it to $TMPL_EXTCBACKGTALK
+ if echo $sip_outbound_providers | grep -q $callback_provider 2>/dev/null
+ then
+ FB=$TMPL_EXTCBACKSIP
+ else
+ FB=$TMPL_EXTCBACKGTALK
+ fi
+
+ for callback_number in $callback_number_list ; do
+ sed "s/|NUMBER|/$callback_number/g" $TMPL_EXTCBACKCHECK >> $WORKDIR/callbackcheck.TMP
+
+ sed "s/|NUMBER|/$callback_number/g" $FB |\
+ sed "s/|CALLBACKPROVIDER|/$callback_provider/" |\
+ sed "s/|CALLBACKHUPDELAY|/$callback_hangup_delay/" >> $WORKDIR/callback.TMP
+
+ # Perhaps a bit confusingly, we create "callthrough" configuration for callback
+ # numbers, because we use the same DISA construct as for callthrough.
+ if [ -n "$pin" ] ; then FT=$TMPL_EXTCTHRU ; else FT=$TMPL_EXTCTHRUNOPIN ; fi
+ sed "s/|NUMBER|/$callback_number/g" $FT |\
+ sed "s/|DEFAULTUSER|/$defaultuser/" |\
+ sed "s/|PIN|/$pin/" >> $WORKDIR/callthrough.TMP
+ done
+}
+
+
# Creates sip.conf from its template.
pbx_cook_sip_template()
{
@@ -543,6 +662,7 @@ pbx_cook_sip_template()
local bindport
config_get useragent advanced useragent
+ useragent=`escape_non_alpha $useragent`
config_get externhost advanced externhost
config_get bindport advanced bindport
@@ -628,7 +748,9 @@ pbx_configure_voicemail()
config_get smtp_server voicemail_smtp smtp_server
config_get smtp_port voicemail_smtp smtp_port
config_get smtp_user voicemail_smtp smtp_user
+ smtp_user=`escape_non_alpha $smtp_user`
config_get smtp_password voicemail_smtp smtp_password
+ smtp_password=`escape_non_alpha $smtp_password`
sed "s/|AUTH|/$smtp_auth/" $TMPL_MSMTPDEFAULT |\
sed "s/|TLS|/$smtp_tls/" > $WORKDIR/pbx-msmtprc
@@ -644,12 +766,25 @@ pbx_configure_voicemail()
cat $TMPL_MSMTPACCTDFLT >> $WORKDIR/pbx-msmtprc
[ ! -f /etc/pbx-msmtprc ] && cp $WORKDIR/pbx-msmtprc /etc/pbx-msmtprc
- diff -q $WORKDIR/pbx-msmtprc /etc/pbx-msmtprc 1>/dev/null \
+ cmp -s $WORKDIR/pbx-msmtprc /etc/pbx-msmtprc 1>/dev/null \
|| mv $WORKDIR/pbx-msmtprc /etc/pbx-msmtprc
chmod 600 /etc/pbx-msmtprc
+ chown nobody /etc/pbx-msmtprc
# Copy over the extensions file which has voicemail enabled.
cp $TMPL_EXTVMENABLED $WORKDIR/extensions_voicemail.conf
+
+ # Create the voicemail directory in /tmp
+ mkdir -p /tmp/voicemail
+ chown nobody /tmp/voicemail
+
+ # Create the recordings directory
+ mkdir -p /etc/pbx-voicemail/recordings
+ chown nobody /etc/pbx-voicemail/recordings
+
+ # Working around a bug in OpenWRT 12.09-rc1
+ # TODO: REMOVE AS SOON AS POSSIBLE
+ chmod ugo+w /tmp
}
@@ -670,12 +805,13 @@ start() {
config_load ${MODULENAME}-voip
config_foreach pbx_add_peer voip_provider
- # Create the user contexts, and phone blacklist.
+ # Create the user contexts, callthroug/back, and phone blacklist.
config_unset
config_load ${MODULENAME}-calls
pbx_create_user_contexts
pbx_add_blacklist
config_foreach pbx_add_callthrough callthrough_numbers
+ config_foreach pbx_add_callback callback_numbers
# Prepare sip.conf using settings from the "advanced" section.
config_unset
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/delayedcallback b/applications/luci-pbx/root/etc/pbx-asterisk/delayedcallback
new file mode 100755
index 000000000..903efe9ad
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/delayedcallback
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Check if there are more than one instance of this command
+# with the same command line running at the same time for some
+# reason, then quit. We are checking for the same
+# commandline in order to permit two different callback
+# attempts simultaneously.
+
+if ! grep -q "$@" /dev/shm/delayedcallback.[0-9]* 2>/dev/null
+then
+ echo "$@" > /dev/shm/delayedcallback.$$
+ sleep 25
+ asterisk -r -x "$1 $2 \"$3\" $4 $5 $6"
+ rm /dev/shm/delayedcallback.$$
+# echo "`date` $@": >> /dev/shm/delayedcallback.log
+#else
+# echo "`date` ERROR: There appears to be a callback attempt in progress to: $@" >> /dev/shm/delayedcallback.err
+fi
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions.conf.TEMPLATE
index 534945cc1..c8966edd8 100644
--- a/applications/luci-pbx/root/etc/pbx-asterisk/extensions.conf.TEMPLATE
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions.conf.TEMPLATE
@@ -21,4 +21,5 @@ exten => _[!-~].,1,Dial(SIP/${EXTEN},60,r)
#include extensions_incoming_gtalk.conf
#include extensions_blacklist.conf
#include extensions_callthrough.conf
+#include extensions_callback.conf
#include extensions_user.conf
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check.conf.TEMPLATE
new file mode 100644
index 000000000..06b1a4b6b
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check.conf.TEMPLATE
@@ -0,0 +1 @@
+exten => s,n,Gotoif($[ "${CALLERID(NUM)}" =~ ".*|NUMBER|" ]?context-user-callback,|NUMBER|,1)
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check_footer.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check_footer.conf.TEMPLATE
new file mode 100644
index 000000000..282fe9e8f
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check_footer.conf.TEMPLATE
@@ -0,0 +1,2 @@
+exten => s,n,Goto(${SOURCECONTEXT},${SOURCEEXTEN},donecallback)
+
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check_header.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check_header.conf.TEMPLATE
new file mode 100644
index 000000000..be289c4d3
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback-check_header.conf.TEMPLATE
@@ -0,0 +1,3 @@
+
+[callback-check-call-context]
+exten => s,1,Noop()
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_gtalk.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_gtalk.conf.TEMPLATE
new file mode 100644
index 000000000..43eec788f
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_gtalk.conf.TEMPLATE
@@ -0,0 +1,4 @@
+exten => |NUMBER|,1,System(/etc/pbx-asterisk/delayedcallback "channel originate Gtalk/gtalk-|CALLBACKPROVIDER|/|NUMBER|@voice.google.com extension |NUMBER|@disa-call-context" &)
+exten => |NUMBER|,n,Wait(|CALLBACKHUPDELAY|)
+exten => |NUMBER|,n,Hangup()
+
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_header.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_header.conf.TEMPLATE
new file mode 100644
index 000000000..0b8fb4c23
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_header.conf.TEMPLATE
@@ -0,0 +1 @@
+[context-user-callback]
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_sip.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_sip.conf.TEMPLATE
new file mode 100644
index 000000000..300e9fa0e
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_callback_sip.conf.TEMPLATE
@@ -0,0 +1,4 @@
+exten => |NUMBER|,1,System(/etc/pbx-asterisk/delayedcallback "channel originate SIP/|NUMBER|@peer-|CALLBACKPROVIDER| extension |NUMBER|@disa-call-context" &)
+exten => |NUMBER|,n,Wait(|CALLBACKHUPDELAY|)
+exten => |NUMBER|,n,Hangup()
+
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_default.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_default.conf.TEMPLATE
index 8d37ddccb..35836e290 100644
--- a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_default.conf.TEMPLATE
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_default.conf.TEMPLATE
@@ -4,6 +4,8 @@ exten => s,n,Set(SOURCECONTEXT=default-incoming-call-context)
exten => s,n,Set(SOURCEEXTEN=s)
exten => s,n,Goto(blacklist-call-context,s,1)
exten => s,n(doneblacklist),NoOp()
+exten => s,n,Goto(callback-check-call-context,s,1)
+exten => s,n(donecallback),NoOp()
exten => s,n,Goto(disa-check-call-context,s,1)
exten => s,n(donedisacheck),Dial(|LOCALUSERS|,${RINGTIME},r)
exten => s,n,Goto(context-voicemail,s,1)
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_disa-nopin.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_disa-nopin.conf.TEMPLATE
new file mode 100644
index 000000000..74e48de8c
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_disa-nopin.conf.TEMPLATE
@@ -0,0 +1,5 @@
+exten => |NUMBER|,1,Noop()
+exten => |NUMBER|,n,Set(TIMEOUT(digit)=15)
+exten => |NUMBER|,n,Set(TIMEOUT(response)=40)
+exten => |NUMBER|,n,DISA(no-password,context-user-|DEFAULTUSER|)
+
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_gtalk.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_gtalk.conf.TEMPLATE
index f0ca37209..3f9cf4c7d 100644
--- a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_gtalk.conf.TEMPLATE
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_gtalk.conf.TEMPLATE
@@ -7,6 +7,8 @@ same => n,Set(SOURCECONTEXT=context-incoming-gtalk)
same => n,Set(SOURCEEXTEN=|USERNAME|)
same => n,Goto(blacklist-call-context,s,1)
same => n(doneblacklist),NoOp()
+same => n,Goto(callback-check-call-context,s,1)
+same => n(donecallback),NoOp()
same => n,Goto(disa-check-call-context,s,1)
same => n(donedisacheck),Dial(|LOCALUSERS|,${RINGTIME},D(:w11111111))
same => n,Goto(context-voicemail,s,1)
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_sip.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_sip.conf.TEMPLATE
index 195600754..b2c3716bf 100644
--- a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_sip.conf.TEMPLATE
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_incoming_context_sip.conf.TEMPLATE
@@ -5,6 +5,8 @@ exten => s,n,Set(SOURCECONTEXT=context-incoming-|NAME|)
exten => s,n,Set(SOURCEEXTEN=s)
exten => s,n,Goto(blacklist-call-context,s,1)
exten => s,n(doneblacklist),NoOp()
+exten => s,n,Goto(callback-check-call-context,s,1)
+exten => s,n(donecallback),NoOp()
exten => s,n,Goto(disa-check-call-context,s,1)
exten => s,n(donedisacheck),Dial(|LOCALUSERS|,${RINGTIME},r)
exten => s,n,Goto(context-voicemail,s,1)
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_voicemail_enabled.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_voicemail_enabled.conf.TEMPLATE
index e4b34b5b0..4edd9cb42 100644
--- a/applications/luci-pbx/root/etc/pbx-asterisk/extensions_voicemail_enabled.conf.TEMPLATE
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/extensions_voicemail_enabled.conf.TEMPLATE
@@ -1,15 +1,27 @@
[context-voicemail-record-greeting]
-exten => *789,1,Wait(2)
-exten => *789,n,Playback(/etc/pbx-voicemail/greeting)
-exten => *789,n,Wait(5)
-exten => *789,n,Record(/etc/pbx-voicemail/greeting:WAV,20,90,k)
-exten => *789,n,Wait(2)
-exten => *789,n,Playback(/etc/pbx-voicemail/greeting)
+exten => *789,1,Wait(1)
+exten => *789,n,Playback(/etc/pbx-voicemail/recordings/greeting)
+exten => *789,n,Wait(1)
+exten => *789,n,Playback(beep)
+exten => *789,n,Playback(beep)
+exten => *789,n,WaitExten(30)
+
+exten => t,1,Playback(vm-goodbye)
+exten => t,n,Wait(2)
+exten => t,n,Hangup()
+
+exten => *,1,Playback(beep)
+exten => *,n,Playback(beep)
+exten => *,n,Record(/tmp/voicemail/greeting:gsm,20,120,k)
+exten => *,n,Wait(1)
+exten => *,n,Playback(/tmp/voicemail/greeting)
+
+exten => h,1,System(/etc/pbx-voicemail/pbx-move-greeting &)
[context-voicemail]
exten => s,1,Wait(2)
-exten => s,2,Playback(/etc/pbx-voicemail/greeting)
+exten => s,2,Playback(/etc/pbx-voicemail/recordings/greeting)
exten => s,3,Wait(2)
-exten => s,n,Record(/tmp/voicemail%d:WAV,20,180,k)
+exten => s,n,Record(/tmp/voicemail/voicemail%d:WAV,20,180,k)
exten => h,1,System(/etc/pbx-voicemail/pbx-send-voicemail '${RECORDED_FILE}.WAV' '${CALLERID(all)}' &)
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/sip.conf.TEMPLATE b/applications/luci-pbx/root/etc/pbx-asterisk/sip.conf.TEMPLATE
index 6069554e0..8f3b112ff 100644
--- a/applications/luci-pbx/root/etc/pbx-asterisk/sip.conf.TEMPLATE
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/sip.conf.TEMPLATE
@@ -1,4 +1,5 @@
[general]
+transport=udp
context=default-incoming-call-context
allowoverlap=yes
allowtransfer=yes
@@ -28,6 +29,7 @@ directmedia=no
sipdebug=no
bindport=|BINDPORT|
externhost=|EXTERNHOST|
+externrefresh=60
#include sip_registrations.conf
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/sounds/auth-incorrect.gsm b/applications/luci-pbx/root/etc/pbx-asterisk/sounds/auth-incorrect.gsm
new file mode 100644
index 000000000..12fec25d5
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/sounds/auth-incorrect.gsm
Binary files differ
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/sounds/beep.gsm b/applications/luci-pbx/root/etc/pbx-asterisk/sounds/beep.gsm
new file mode 100644
index 000000000..d38eda9cc
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/sounds/beep.gsm
Binary files differ
diff --git a/applications/luci-pbx/root/etc/pbx-asterisk/sounds/vm-goodbye.gsm b/applications/luci-pbx/root/etc/pbx-asterisk/sounds/vm-goodbye.gsm
new file mode 100644
index 000000000..735b281c8
--- /dev/null
+++ b/applications/luci-pbx/root/etc/pbx-asterisk/sounds/vm-goodbye.gsm
Binary files differ