Categories
Asterisk Support Knowledge Base Products and services Technical

Gradwell IP Address ranges

At Gradwell, they send internet traffic from different addresses (known as IP addresses) to allow their telephony systems to work smoothly. Below is the list of IP addresses where their VoIP (Voice over IP) traffic will come from. It’s important that your firewall allows traffic from these addresses however they recommend you don’t set it to allow only from these, just that they are included.

The reason they say don’t allow only these addresses is that there network is dynamic and may shift or new items added and we don’t want this to affect your service.

There are a couple of things you should do to ensure you get the most from the Gradwell Voice services:

  • Check your firewall filtering – is there anything being excluded?
    • If yes – Allow the IP range traffic – this will most likely be in your firewall settings or tools (they all differ so they can’t exactly point you there)
    • If no – you’re good to go
  • If you use UDP traffic then you’ll need to allow Media ports (known as RTP) with the numbers 1024 to 65535

Current ranges as of summer 2021

109.224.232.0/22 109.224.232.0 to 109.224.235.255
109.224.240.0/22 109.224.240.0 to 109.224.243.255
109.239.96.132/31 109.239.96.132 to 109.239.96.133
141.170.24.21/31 141.170.24.21 to 141.170.24.22
141.170.24.5/31 141.170.24.5 to 141.170.24.6
141.170.50.16/28 141.170.50.16 to 141.170.50.31
185.47.148.0/24 185.47.148.0 to 185.47.148.255
194.145.188.224/27 194.145.188.224 to 194.145.188.255
194.145.189.52/31 194.145.189.52 to 194.145.189.53
194.145.190.128/26 194.145.190.128 to 194.145.190.191
194.145.191.128/27 194.145.191.128 to 194.145.191.159
195.74.60.0/23 195.74.60.0 to 195.74.61.255
213.166.3.128/26 213.166.3.129 - 213.166.3.190
213.166.4.128/26 213.166.4.129 - 213.166.4.190
213.166.5.0/24 213.166.5.0 to 213.166.5.255
78.40.243.192/27 78.40.243.192 to 78.40.243.223
87.238.72.128/26 87.238.72.128 to 87.238.72.191
87.238.73.128/26 87.238.73.128 to 87.238.73.191
87.238.74.128/26 87.238.74.128 to 87.238.74.191
87.238.77.128/26 87.238.77.128 to 87.238.77.191

To simplify things a bit listed below are the ranges in common formats.

Rules for Freepbx Custom file “firewall-4.rules”

-A fpbxreject -s 109.224.232.0/22 -p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s 109.224.240.0/22 -p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	109.224.222.16/28	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	109.224.232.0/22	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	109.224.240.0/22	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	109.239.96.132/31	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	141.170.24.20/30	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	141.170.24.5/31	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	141.170.50.16/28	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	185.47.148.0/24	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	194.145.188.224/27	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	194.145.189.52/31	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	194.145.190.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	194.145.191.128/27	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	195.74.60.0/23	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	212.11.68.144/28	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	213.166.2.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	213.166.3.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	213.166.4.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	213.166.5.0/24	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	78.40.243.192/27	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	87.238.72.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	87.238.73.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	87.238.74.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A fpbxreject -s	87.238.77.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT

Rules for IPtables file

-A INPUT -s 109.224.232.0/22 -p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s 109.224.240.0/22 -p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	109.224.222.16/28	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	109.224.232.0/22	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	109.224.240.0/22	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	109.239.96.132/31	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	141.170.24.20/30	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	141.170.24.5/31	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	141.170.50.16/28	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	185.47.148.0/24	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	194.145.188.224/27	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	194.145.189.52/31	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	194.145.190.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	194.145.191.128/27	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	195.74.60.0/23	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	212.11.68.144/28	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	213.166.2.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	213.166.3.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	213.166.4.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	213.166.5.0/24	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	78.40.243.192/27	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	87.238.72.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	87.238.73.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	87.238.74.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
-A INPUT -s	87.238.77.128/26	-p udp -m udp --dport 4569:5270 -j ACCEPT
Categories
Blog Case Studies

An out of the normal Customer request

and how we solved it:

We were approached by one of our customers who provides support services to travellers and global companies who had a client that provides maritime engineering services world wide and required an emergency helpline that “followed the sun” 

Detailed Specification

A single number that called dependant on time the on call support staff.

The calls cannot go to users Voicemail.

The staff members are to be notified by email that the call was taken and who took it.

If the on call staff do not answer the call it is forwarded to our clients call centre.

On completion of the call a copy of the recording in mp3 format is emailed to the on call staff.

Solution.

Our customer uses FreePBX so the core of the project is the use of the Queue application but with some custom dial plan and scripts to exploit and enhance features that are not exposed, 

The inbound numbers destination is a “custom destination” that first sends it to some custom dial plan explained later and then to the “Call Flow Control” application to allow the system to be overridden, It is then sent to the “Time Conditions” application that uses UTC as its time zone to over come issues with daylight saving in different hemispheres, this then send the call to the correct queue depending on time 

To allow an email to be sent to staff we used the qgosub variable that is explained HERE , this sub routine sends the email on answer. this variable is set by a small dial plan snippet that sets the qgosub variable and an additional one to set a channel variable as the callers callerID number, as its lost when the call is made to the staff members by the queue application. 

To make sure calls do not go to voicemail, the queue option “call confirm” this forces the called staff to press 1 to accept a call, This much overlooked option is useful for many queue scenarios.

If the call is unanswered the call has to be passed to the callcenter with the callerID name tagged with the customers Name, We achieve this with the “SetCallerID” application passing the call onto the client call centre.

Finally when the call is complete we need to email the recording to the customer. To do this with the “Post Call Recording Script” option in Advanced options. (You may need to enable “Display Readonly Settings” and “Override Readonly Settings”), This did require a little lateral thinking as we were already using this script to convert recordings to MP3 and save them to AWSS3 storage, But we didn’t want an email sent after all recordings do we included an additional ‘if’ statement to check if the qgosub variable was passed over to the script and if it was email the attachment otherwise do nothing.

I hope this shows the flexibility of FreePBX and asterisk and how fairly complex call routings and requests can be fulfilled in a manner that doesn’t require complex dial plans or require high support overheads.

If you want to achieve similar don’t hesitate to get in touch as by using modules already in FreePBX you’re not paying to reinvent the wheel.

Categories
Blog FreePBX Knowledge Base

Running Subroutines on answer for Queues

Some years ago we wrote a post on running macros on queue answer here. this was very useful for integration with backends, At the time we raised a feature request to get it added to Freepbx, But this never happened.

Now the variable QGOSUB is in the dialplan for freepbx queues, But still there is no way of setting this in a default freepbx installation and it requires a snip-it of custom dialplan that is called from freepbx by a ‘custom destination’ . For example at its simplest the dialplan to set it could be :-

[qmacro-set]
exten => .,1,Noop(ians test) 
exten => .,n,Set(_QGOSUB=ians_routine) 
exten => .,n,Goto(app-daynight,1,1)  

and this sets the variable for all channels in this call, and when the Queue command is run in the default freepbx dialplan

Queue(9471,${QOPTIONS},,${QAANNOUNCE},${QMAXWAIT},${QAGI},,${QGOSUB},${QRULE},${QPOSITION})  

This allows simple or more complicated routines to be run. For example sending an email on answer which was a request we had that caused us to revisit this.

[ians_routine]
exten = s,1,Set(origtime=${EPOCH})
exten = s,n,Noop(${CHANNEL})
exten = s,n,Set(Agent11=${CUT(CHANNEL,@,1)})
exten = s,n,Set(Agent12=${CUT(Agent11,/,2)})
exten = s,n,Noop(${Agent11} , ${Agent12} )
exten = s,n,Set(fulltime=${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)})
exten = s,n,system(echo "There has been a call , Callers Details: ${CALLERID(number)} ,  ${CRM_SOURCE} , Date and Time: ${fulltime} ,  Agent: ${Agent12} ,Timestamp: ${origtime} , Queue Number: ${QUEUENUM} " | mail -s "failed recall at ${fulltime}" email@address.com)
same = n,Return()

If you think that you would like to be able to set this variable in the freepbx gui give it a vote https://issues.freepbx.org/browse/FREEPBX-22274

Categories
Knowledge Base Products and services

Aastra 6753i Transfer

Step By step instructions for call transfer when using the Aastra 6753i with firmware 3.x.x and above.

Phone Idle screen.

Once a call is answered their number will show and an icon of a ‘off hook phone’ will also show

To transfer the call press your ‘Transfer key’. Another ‘line’ will show numbered 2 with a ‘ > ’ next to it.

Enter the number you want to dial and press ‘>‘ dial if the call isn’t immediately dialed.

To ‘Blind’ transfer the call press the Transfer Button again or put the Handset down. NOTE if you do this you will not be able to get the call back.

After pressing dial the Phone Icon will show ‘ringing’

To get the call back while it is ringing press the ‘ < ‘ button shown on the display next to ‘Cancel’. Then L1 in this example will flash and ‘call held’ will show on the display as below, you need to get the call back by pressing the Flashing Line Key.

If the call goes to Voicemail or the caller answers the display will show the ‘off hook’ icon against 2

If the Caller wants the call then Press the ‘Transfer key’ the Red ‘Hangup key’ or put the handset down and the call will be transferred to them. Do not press the ‘>‘ Drop button.

If they don’t want the call or it goes to voicemail and you want to get the caller back, Press the ‘ > ‘ Drop Button and that call will be dropped and as before ‘call held’ will show on the screen and you press the L1 button to get the caller Back

Categories
Knowledge Base Technical

Asternic Stats and recording outgoing calls.

Asternic stats has the ability to record your outgoing calls in the stats database so they can be accessed from stats package.

But a customer noted two problems with this, firstly they wanted to set a different Music on Hold for outgoing calls and secondly “no answer” calls where the agent hungup before the callee answered.

Firstly we will deal with the Music on hold, Changing the MoH class caused calls not to be recorded in the database correctly. Code below is the reason for this as it causes the dial string to have 2 macros called, This is not possible.

extension_additional.conf:-
exten => s,n,ExecIf($["${MOHCLASS}"!="default" & "${MOHCLASS}"!="" & "${FORCE_CONFIRM}"="" ]?Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}))

extensions_custom_asternic_outbound_freepbx.conf:-
exten => _X.,n,Dial(${QDIALER_CHANNEL},300,gM(queuedial-answer^${UNIQUEID}^${GM}^${QDIALER_QUEUE}^${QDIALER_AGENT}^${ST}^${AMPUSER})${DIAL_TRUNK_OPTIONS})

The fix is very simple for this one and required just 2 changes. one line added to set MoH in the dialplan and another to use Trunk_options and not the the one created in extensions_additional.conf

exten => _X.,n,Set(CHANNEL(musicclass)=${MOHCLASS}) ; Added to set the Music on hold class for the outgoing call Fixes bug in normal code
exten => _X.,n,Dial(${QDIALER_CHANNEL},300,gM(queuedial-answer^${UNIQUEID}^${GM}^${QDIALER_QUEUE}^${QDIALER_AGENT}^${ST}^${AMPUSER})${TRUNK_OPTIONS}) ;Was ${DIAL_TRUNK_OPTIONS} changed to set the Music on hold class for the outgoing call Fixes bug in normal code

The second problem is also fairly straight forward but took a bit of creative thinking, The problem was when an agent hung up on an outbound call the dialstatus returned to the dialplan was “CANCEL” and this is not reported upon by the asternic stats package. SO as the call is for all intents abandoned we added a line that if the dialstatus was “CANCEL” we would change it to “ABANDON”.

exten => h,n,Set(DIALSTATUS=${IF($["${DIALSTATUS}"="CANCEL"]?ABANDON:${DIALSTATUS})}) ;Added By Ian Plain to fix cancelled calls not showing in Asternic stats

This is a simple fix and now means calls are recorded as ABANDONED and with the time the Agent waited before hanging up.

Below is our version of the file extensions_custom_asternic_outbound_freepbx.conf with all the changes.

[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(Test Track Outbound)
exten => s,n,Noop(Trunk is ${OUT_${DIAL_TRUNK}})
exten => s,n,Noop(Dialout number is ${OUTNUM})
exten => s,n,Noop(Dial options are ${DIAL_TRUNK_OPTIONS})
exten => s,n,Set(QDIALER_TRUNK_OPTIONS=${DIAL_TRUNK_OPTIONS})
exten => s,n,Set(QDIALER_AGENT=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,GotoIf($["${QDIALER_AGENT}" != ""]?nextcheck)
exten => s,n,Noop(NO AMPUSER, exit normally with no tracking outbound)
exten => s,n,MacroExit()
exten => s,n(nextcheck),GotoIf($["${CDR(accountcode)}" != ""]?bypass)
exten => s,n,Noop(NO ACCOUNTCODE, exit normally with no tracking outbound)
exten => s,n,MacroExit()
exten => s,n(bypass),Set(PREDIAL_HOOK_RET=BYPASS)
exten => s,n,Goto(queuedial,${OUTNUM},1)
exten => s,n,MacroExit()
;; Dialplan for storing OUTBOUND campaing in queue_log
;; Goto(queuedial,YYYXXXXXXXX,1) where YYY is the queue-campaign code
;; and XXXXXXXX is the number to dial.
;; The queuedial context has the outobound trunk hardcoded
[queuedial]
; this piece of dialplan is just a calling hook into the [qlog-queuedial] context that actually does the
; outbound dialing - replace as needed - just fill in the same variables.
exten => X.,1,Set(QDIALER_QUEUE=${CDR(accountcode)}) ;exten => _X.,n,Set(QDIALER_AGENT=Agent/${AMPUSER}) exten => _X.,n,Set(QDIALER_AGENT=${DB(AMPUSER/${AMPUSER}/cidname)}) ; custom trunk check exten => _X.,n,Set(custom=${CUT(OUT${DIAL_TRUNK},:,1)})
exten => X.,n,GotoIf($["${custom}" = "AMP"]?customtrunk) ; it is normal trunk, not custom exten => _X.,n,Set(QDIALER_CHANNEL=${OUT${DIAL_TRUNK}}/${EXTEN})
exten => X.,n,GotoIf($["${OUT${DIAL_TRUNK}SUFFIX}" == ""]?continuequeuedial) exten => _X.,n,Set(QDIALER_CHANNEL=${OUT${DIAL_TRUNK}}/${EXTEN}${OUT_${DIAL_TRUNK}SUFFIX}) exten => _X.,n,Goto(continuequeuedial) ; it is a custom trunk exten => _X.,n(customtrunk),Set(pre_num=${CUT(OUT${DIAL_TRUNK},$,1)})
exten => X.,n,Set(the_num=${CUT(OUT${DIAL_TRUNK},$,2)})
exten => X.,n,Set(post_num=${CUT(OUT${DIAL_TRUNK},$,3)})
exten => _X.,n,GotoIf($["${the_num}" = "OUTNUM"]?outnum:skipoutnum)
exten => _X.,n(outnum),Set(the_num=${OUTNUM})
exten => _X.,n(skipoutnum),Set(QDIALER_CHANNEL=${pre_num:4}${the_num}${post_num})
exten => _X.,n(continuequeuedial),Noop(Qdialer channel = ${QDIALER_CHANNEL})
exten => _X.,n,Set(QueueName=${QDIALER_QUEUE})
exten => _X.,n,Goto(qlog-queuedial,${EXTEN},1)
[qlog-queuedial]
; We use a global variable to pass values back from the answer-detect macro.
; STATUS = U unanswered
; = A answered (plus CAUSECOMPLETE=C when callee hung up)
; The 'g' dial parameter must be used in order to track callee disconnecting.
; Note that we'll be using the 'h' hook in any case to do the logging when channels go down.
;
exten => X.,1,NoOp(Outbound call -> A:${QDIALER_AGENT} N:${EXTEN} Q:${QDIALER_QUEUE} Ch:${QDIALER_CHANNEL} Dialoptions:${TRUNK_OPTIONS}) exten => _X.,n,Set(ST=${EPOCH}) ;exten => _X.,n,Set(GM=${QDIALER_AGENT}) exten => _X.,n,Set(GM=${REPLACE(QDIALER_AGENT, ,)})
exten => _X.,n,Set(GLOBAL(${GM})=U)
exten => _X.,n,Set(GLOBAL(${GM}ans)=0)
exten => _X.,n,Macro(queuelog,${ST},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},ENTERQUEUE,-,${EXTEN})
exten => _X.,n,Set(CHANNEL(musicclass)=${MOHCLASS}) ; Added to set the Music on hold class for the outgoing call Fixes bug in normal code
exten => _X.,n,Dial(${QDIALER_CHANNEL},300,gM(queuedial-answer^${UNIQUEID}^${GM}^${QDIALER_QUEUE}^${QDIALER_AGENT}^${ST}^${AMPUSER})${TRUNK_OPTIONS}) ;Was ${DIAL_TRUNK_OPTIONS} changed to set the Music on hold class for the outgoing call Fixes bug in normal code
exten => _X.,n,Set(CAUSECOMPLETE=${IF($["${DIALSTATUS}" = "ANSWER"]?C)})
; Trapping call termination here
exten => h,1,NoOp( "Call exiting: status ${GLOBAL(${GM})} answered at: ${GLOBAL(${GM}ans)} DS: ${DIALSTATUS}" )
exten => h,n,Set(DB(LASTDIAL/${QDIALER_AGENT})=${EPOCH})
exten => h,n,Goto(case-${GLOBAL(${GM})})
exten => h,n,Hangup()
; Call unanswered
exten => h,n(case-U),Set(WT=$[${EPOCH} - ${ST}])
exten => h,n,Noop(unanswered ${DIALSTATUS})) ;Added By Ian Plain to fix cancelled calls not showing in Asternic stats
exten => h,n,Set(DIALSTATUS=${IF($["${DIALSTATUS}"="CANCEL"]?ABANDON:${DIALSTATUS})}) ;Added By Ian Plain to fix cancelled calls not showing in Asternic stats
exten => h,n,Macro(queuelog,${EPOCH},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},${DIALSTATUS},1,1,${WT})
exten => h,n,UserEvent(AgentComplete,Queue: ${QDIALER_QUEUE},TalkTime: 0,Channel: ${CHANNEL})
exten => h,n,Hangup()
; call answered: agent/callee hung
exten => h,n(case-A),Set(COMPLETE=${IF($["${CAUSECOMPLETE}" = "C"]?COMPLETECALLER:COMPLETEAGENT)})
exten => h,n,Noop(answered ${DIALSTATUS})) ;Added By Ian Plain to fix cancelled calls not showing in Asternic stats
exten => h,n,Set(WT=$[${GLOBAL(${GM}ans)} - ${ST}])
exten => h,n,Set(CT=$[${EPOCH} - ${GLOBAL(${GM}ans)}])
exten => h,n,Macro(queuelog,${EPOCH},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},${COMPLETE},${WT},${CT})
exten => h,n,UserEvent(AgentComplete,Queue: ${QDIALER_QUEUE},TalkTime: ${CT},Channel: ${CHANNEL})
exten => h,n,Hangup()
[macro-queuedial-answer]
; Expecting $ARG1: uniqueid of the caller channel
; $ARG2: global variable to store the answer results
; $ARG3: queue name
; $ARG4: agent name
; $ARG5: enterqueue
;
exten => s,1,NoOp("Macro: queuedial-answer UID:${ARG1} GR:${ARG2} Q:${ARG3} A:${ARG4} E:${ARG5}")
exten => s,n,Set(QDIALER_QUEUE=${ARG3})
exten => s,n,Set(QDIALER_QUEUE=${REPLACE(QDIALER_QUEUE, ,_)})
exten => s,n,GotoIf($["${CUT(DB(AMPUSER/${ARG6}/recording),=,3)}" = "Always"]?mixmonitor)
exten => s,n,GotoIf($["${DB(AMPUSER/${ARG6}/recording/out/external)}" = "always"]?mixmonitor)
exten => s,n,Goto(continue)
exten => s,n(mixmonitor),MixMonitor(${MIXMON_DIR}${YEAR}/${MONTH}/${DAY}/out-${QDIALER_QUEUE}-${ARG1}.wav,b,/usr/local/parselog/update_mix_mixmonitor.pl ${ARG1} ${MIXMON_DIR}${YEAR}/${MONTH}/${DAY}/out-${QDIALER_QUEUE}-${ARG1}.wav)
exten => s,n,Set(AUDIOHOOK_INHERIT(MixMonitor)=yes)
exten => s,n(continue),Set(NOW=${EPOCH})
exten => s,n,Set(WD=$[${NOW} - ${ARG5}])
exten => s,n,Macro(queuelog,${NOW},${ARG1},${ARG3},${ARG4},CONNECT,${WD})
exten => s,n,Set(GLOBAL(${ARG2})=A)
exten => s,n,Set(GLOBAL(${ARG2}ans)=${NOW})
exten => s,n,NoOp("Macro queuedial-answer terminating" )
[macro-queuelog]
; The advantage of using this macro is that you can choose whether to use the Shell version
; (where you have complete control of what gets written) or the Application version (where you
; do not need a shellout, so it's way faster).
;
; Expecting $ARG1: Timestamp
; $ARG2: Call-id
; $ARG3: Queue
; $ARG4: Agent
; $ARG5: Verb
; $ARG6: Param1
; $ARG7: Param2
; $ARG8: Param3
;
;exten => s,1,System( echo "${ARG1},${ARG2},${ARG3,${ARG4},${ARG5},${ARG6},${ARG7},${ARG8}" >> /var/log/asterisk/queue_log )
exten => s,1,QueueLog(${ARG3},${ARG2},${ARG4},${ARG5},${ARG6}|${ARG7}|${ARG8})

Categories
Asterisk Support Covid-19 FreePBX Knowledge Base Remote Working

Disabling Router SIP ALG

With many companies asking their employees to work from home, a common problem when trying to use a sip phone on a home network is the SIP ‘helper’ or ALG, Here is some advice on how to disable it on the more common routers that you may encounter.

SIP ALG (Application Layer Gateway) modifies VoIP traffic with the aim of solving NAT and firewall related problems. SIP ALG does this by inspecting SIP packets and modifying SIP Header and SDP data.

Unfortunately, SIP ALG was poorly implemented in a lot of cases, which has lead to it causing more issues than it corrects and due to this, we believe that, in general, it is best disabled.

Note – Many routers will re-enable SIP ALG after being powered off and on, or sometimes after a firmware update, therefore if it has been disabled in the past, and you know that the router was recently updated and powered off and on again, then it is always a good idea to log in to the router and double check the setting.

Virgin SuperHub: SIP ALG cannot be disabled in the settings of SuperHubs. Please click here for advice troubleshooting issues with SuperHubs. 

BT: SIP ALG cannot be disabled in the settings of BT HomeHubs, but can be disable with BT Business Hub versions 3 and higher:

Disabling a BT Business Hub 5’s SIP ALG

Fritz!Box: SIP ALG can’t be disabled.

DrayTek routers: Log in to your DrayTek via Telnet using an SSH client such as Putty: http://www.putty.org/

Check if SIP ALG is Enabled or Disabled:

To check if SIP ALG is Enabled or Disabled enter this command: sys sip_alg ?

If SIP ALG is disabled a ” 0 ” result will be returned.  If SIP ALG is enabled the result will be ” 1 “.

Disabling SIP ALG:

To Disable SIP ALG enter the following:

sys sip_alg 0
sys commit
sys reboot

The router will restart and save your changes.

Click here for additional general information about DrayTek Firewall setup. 

TP-Link routers: How to Disable SIP ALG on TP-Link ADSL modem router

Linksys: Check for a ‘SIP ALG’ option, in the ‘Administration’ tab under ‘Advanced’. 

May also need to disable SPI Firewall. 

Microtik: Disable ‘SIP Helper‘. 

Netgear: Look for a ‘SIP ALG’ checkbox in the ‘WAN’ settings.

Port Scan and DoS Protection should also be disabled.

Disable STUN in VoIP phone’s settings. 

D-Link: In your router’s ‘Advanced’ settings –> ‘Application Level Gateway (ALG) Configuration’ uncheck the ‘SIP’ option. 

Huawei: Many routers support SIP ALG (usually found in the ‘Security’ menu). 

SonicWALL Firewall: Under the VoIP tab, the option ‘Enable Consistent NAT’ should be enabled and ‘Enable SIP Transformations’ unchecked.  

Thomson: How to Disable SIP ALG on a Thomson Router HERE

Test with STUN disabled in your VoIP phone’s settings.

Adtran Netvanta: Disable SIP ALG under ‘Firewall/ACLs’ –> ‘ALG Settings’.

For Technicolor TG588V routers see this document for step by step details

Even if there isn’t a SIP ALG option in your router’s settings, it may still be implemented. TelNet commands must be used to disable SIP ALG with TechnicolorThomsonSpeedTouch, some Draytek and some ZyXEL routers. 

Categories
Knowledge Base

Using FreePBX FollowMe

Follow Me allows you to redirect a call that is placed to one of your extension to another extension or external number.

You can program the system to ring your extension alone for a certain period of time, then ring some other destination(s), such as a mobile phone or another extension, then go to the original extension’s voicemail if the call is not answered.  

It can also be used to divert calls to another extension without ringing the ‘original’ extension, or ring both together in a ‘twinned’ manner. This is useful if you are regularly away from your desk

Your can modify certain Follow Me settings using the User Control Panel as well as disable and enable Follow Me using a feature code that is normally *21,

To use the UCP to change settings if you have had permissions enabled is done by clicking the COG icon on teh Follow me Widget and below is a short Video on the key settings

Categories
Knowledge Base

Setting Up your UCP

The UCP or user control panel is an integral part of freePBX, It lets users have control over their telephone experience.

Below is a short video for setting up the key components of the UCP including voicemail and the WebRTC softphone.

The UCP Phone or WebRTC Phone is an in-browser phone. The Administrator can enable the “WebRTC phone” and that is “attached” to a user’s extension, this phone will then receive phone calls at the same time as the users extension .

The UCP allows users to add multiple dashboards and resizable widgets, This functionality allows users to completely customize the look and feel of their User Control Panel.

The Voicemail widget allows you to view, listen and manage your voicemail settings. The voicemail widget also allows you to monitor and listen to other peoples mailboxes, This feature is invaluable for receptionists and PA’s as it allows them to monitor their Managers or teh main company mailbox. To monitor additional mailboxes contact your system administrator.

 The FreePBX User Management Module controls which mailboxes a user will be able to add as a widget in UCP as it is not just limited to the extensions own mailbox, This is useful for department managers or Receptionists.

The UCP also has a chat function built-in that allows remote users to chat between each other similar to any other webchat but with the added security of it being ‘siloed’ in your company.

For full details and instructions of all options please see the WIKI at Sangoma.com

Categories
Asterisk Support FreePBX Knowledge Base Support Technical

Backing up files in FreePBX 15

The first time you come to restore your FREEpbx 15 system you may find that not everything that you expected is there !

The new backup module backs up on a module by module base and not like before where is was DBs and Files.

Linked here is a repository that has the files to create a module that can be edited to backup directories.

https://bitbucket.org/cybercottage/filebackup

The file you need to edit is Backup.php

<?php

namespace FreePBX\modules\Filebackup;
use FreePBX\modules\Backup as Base;

class Backup extends Base\BackupBase
{
    public function runBackup($id, $transaction)
    {
        $this->addDirectories([
            '/etc/asterisk','/tftpboot',
        ]);
        $files = glob("/etc/asterisk/*conf");
        foreach ($files as $file) {
            $path = pathinfo($file, PATHINFO_DIRNAME);
            $this->addFile(basename($file), $path, '', "conf");
    }
    $files = glob("/tftpboot/*xml");
        foreach ($files as $file) {
            $path = pathinfo($file, PATHINFO_DIRNAME);
            $this->addFile(basename($file), $path, '', "conf");
        }
        return $this;
    }
}

As you see we are backing up /etc/asterisk and /tftpboot , But only *.conf files in /etc/asterisk and only *.xml files in /tftpboot

Details on the new backup system are here https://wiki.freepbx.org/display/FOP/Implementing+Backup

Thanks to James Finstrom for the original version of this, This version is not to replace his work but only to give an example of working with Multiple directories

The downloaded zip file needs to be added as a Local module via Module Admin and enabled, It will obviously give a signing error but this can be disabled in Advanced settings or ignored ;-)

Enjoy but don’t blame me if it doesn’t work. Ive tested it on my systems and all seems good by your experience may be different

Categories
Blog Knowledge Base

SSL, FOP2 and All that..

There are a few common questions and gotchas when using fop2 on a FreePBX server using ssl.

The symptom is simple you cant connect and at the bottom left if tels you that it cant connect over websockets to port 4445 and will finally time out saying Flash is required.. None of this is awfully helpful to be honest.

But the fix is simple and its a shame by default its not this .

In your fop2.cfg file local the lines below and edit them so they match .

It maybe that your certificate names aren’t as below, In that case substitute webserver.XXX with the correct file names.

; If you access fop2 via https, browsers will try to use wss (Secure 
; web sockets) and for that it requires a certificate file and key file,
; the same ones you have in your web server configuration. Be sure to
; specify the correct certificates, the defaults are the ones for a 
; regular Centos installation:
;

ssl_certificate_file=/etc/httpd/pki/webserver.crt
ssl_certificate_key_file=/etc/httpd/pki/webserver.key
;ssl_certificate_file=/etc/pki/tls/certs/localhost.crt
;ssl_certificate_key_file=/etc/pki/tls/private/localhost.key

Thats its. Fop2 will now work over HTTPS