Month: February 2015

Link: Copy the Current Path from Terminal to the Clipboard in Mac OS X

While it’s fairly easy to copy a folder path from the Mac GUI and Finder, or even to copy the path into the Terminal with a drag & drop trick, going the other direction and getting the current path from the command line and then having it accessible to the broader OS X clipboard is a little trickier… well, at least until you know this handy little tip.

Full article here:
Copy the Current Path from Terminal to the Clipboard in Mac OS X (OS X Daily)

Link: Securing Your Asterisk VoIP Server with IPTables

Now that you have set up your personal Asterisk® server (see Tutorial), it’s time to secure it. I can’t overstate the importance of this step. Without it, you could be leaving your server’s VoIP ports open for anyone on the Internet, which may cost you a lot of money.

Full article here:
Securing Your Asterisk VoIP Server with IPTables (Lin’s Tech Blog)

Link: Add tack e x on your bash shebang | #!/bin/bash -ex

Bash scripts can use various options on the shebang (#!/bin/bash). A more common one is: ‘#!/bin/bash -ex’ Here is the scoop!

Full article here:
Add tack e x on your bash shebang | #!/bin/bash -ex (scottlinux.com)

Link: Prepare Your Pi To Send Mail Through Gmail

Suppose you have set up your Raspberry Pi to do some stand alone work. It would be nice if it could email you occasionally, for instance if there’s something wrong. Or it may send you status updates on the work it’s doing. For this you could use the SMTP server of your ISP. However, if your Pi isn’t stationary and roams around on multiple networks, this is not an ideal situation. If you connect your Pi to a different network, operated by a different ISP, chances are that you can’t send any messages.
A better solution would be to use a Gmail account for that. In this description I presume you already have a Gmail account. If not, you can get one for free at www.gmail.com. You may also decide to create a new one for your Raspberry Pi. The same account can even be shared among multiple Raspberry Pies. Rumour has it though that Gmail will only allow 100 mails sent per account per day. So if you share your account among too many machines you may start hitting the ceiling soon.

Full article here:
Prepare Your Pi To Send Mail Through Gmail (SB-Projects On Line)

How to receive incoming Callcentric calls in FreePBX without creating multiple trunks

Just some notes on how to set up a Callcentric trunk in FreePBX and receive incoming calls without the need to create multiple trunks. This overcomes a limitation in Asterisk that is discussed in several other places (use a search engine if you really want to know).

Trunk settings:

When setting up the trunk use the following in the PEER details (change the highlighted parts):

type=peer
secret=password
qualify=yes
insecure=port,invite
host=callcentric.com
fromuser=1777XXXXXXX
fromdomain=callcentric.com
disallowed_methods=UPDATE
disallow=all
directmedia=no
defaultuser=1777XXXXXXX
videosupport=no
context=custom-from-callcentric
allow=ulaw

And don’t forget to use a Register String (replace YYYYYYYYYY with your DID):

1777XXXXXXX:password@callcentric.com/YYYYYYYYYY

EDIT: Instead of using custom-from-callcentric as the context, in recent versions of FreePBX you can use from-pstn-toheader instead, and then skip the next step (the addition of the custom-from-callcentric context to extensions_custom.conf) entirely!

Add context to etc/asterisk/extensions_custom.conf:

In etc/asterisk/extensions_custom.conf add this context:

[custom-from-callcentric]
exten => _X!,1,Noop(Incoming Callcentric call)
exten => _X!,n,Set(CCDID=${CUT(CUT(SIP_HEADER(To),@,1),:,2)})
exten => _X!,n,Set(CDR(did)=${CCDID:1})
exten => _X!,n,Goto(from-pstn,${CCDID:1},1)
exten => h,1,Macro(hangupcall,)

Copy context to extensions_override_freepbx.conf and modify it:

Open etc/asterisk/extensions.conf in a text editor such as nano, and find the [from-sip-external] context. It will probably look like this, or something very close:

;-------------------------------------------------------------------------------
; from-sip-external
;
; This context is the default SIP context unless otherwise changed in the SIP
; Settings module or other sip configuration locations. This context is hit by
; either anonymous SIP calls or mis-configured SIP trunks when the incoming call
; can not be matched with a SIP section.
;
[from-sip-external]
exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
exten => _.,n,Goto(s,1)
exten => s,1,GotoIf($["${SIPLANG}"!=""]?setlanguage:checkanon)
exten => s,n(setlanguage),Set(CHANNEL(language)=${SIPLANG})
exten => s,n(checkanon),GotoIf($["${ALLOW_SIP_ANON}"!="yes"]?noanonymous)
exten => s,n,Goto(from-trunk,${DID},1)
exten => s,n(noanonymous),Set(TIMEOUT(absolute)=15)
exten => s,n,Log(WARNING,"Rejecting unknown SIP connection from ${CHANNEL(recvip)}")
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,Playtones(congestion)
exten => s,n,Congestion(5)
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup
;-------------------------------------------------------------------------------

Copy the entire context into etc/asterisk/extensions_override_freepbx.conf (without changing any other contexts that may already be there) and make the highlighted changes shown below. Don’t forget to replace the line number in the line that ends with “?checklang:noanonymous)” or things may break. EDIT: Replace custom-from-callcentric with from-pstn-toheader if you did not create the custom-from-callcentric context above:

;-------------------------------------------------------------------------------
; from-sip-external
;
; This context is the default SIP context unless otherwise changed in the SIP
; Settings module or other sip configuration locations. This context is hit by
; either anonymous SIP calls or mis-configured SIP trunks when the incoming call
; can not be matched with a SIP section.
;
[from-sip-external]
exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
exten => _.,n,Goto(s,1)
; Next 2 lines required to avoid adding 20 or so additional trunks just to receive CallCentric calls
exten => s,1,Set(FROM_DOMAIN=${CUT(CUT(SIP_HEADER(TO),@,2),>,1)})
exten => s,n,GotoIf($[${FROM_DOMAIN}=ss.callcentric.com]?custom-from-callcentric,${DID},1)
exten => s,n,GotoIf($["${SIPLANG}"!=""]?setlanguage:checkanon)
exten => s,n(setlanguage),Set(CHANNEL(language)=${SIPLANG})
exten => s,n(checkanon),GotoIf($["${ALLOW_SIP_ANON}"!="yes"]?noanonymous)
exten => s,n,Goto(from-trunk,${DID},1)
exten => s,n(noanonymous),Set(TIMEOUT(absolute)=15)
exten => s,n,Log(WARNING,"Rejecting unknown SIP connection from ${CHANNEL(recvip)}")
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,Playtones(congestion)
exten => s,n,Congestion(5)
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup
;-------------------------------------------------------------------------------

Note that every time you do a FreePBX upgrade you should open etc/asterisk/extensions.conf and make sure that the [from-sip-external] context has not been changed by the FreePBX upgrade. If it has, then you should make sure those changes get copied into the replacement context in etc/asterisk/extensions_override_freepbx.conf.

We’ve seen similar instructions that are more complicated than this (with regard to the added lines in the [from-sip-external] context) but we’ve been using this for a while and have found that it’s all you need – we’ve not seen any incoming Callcentric calls that have failed to be handled properly since we started using this.

Recent Posts

Recent Comments

Archives

Categories

Meta

GiottoPress by Enrique Chavez