Wednesday, December 11, 2013

How to setup virtual presence in Hong Kong

Hong Kong is the Asia hub providing numerous opportunities for you to develop business in the most promising economy sectors.

A Hong Kong local phone number would be very useful to kick off your business here and in fact, you could establish your virtual presence conveniently by subscribing to a licensed HK DID SIP trunk service provider .   

The DID stands for direct inward dialing and describes the functionality to receive call.  SIP is the industry standard for handling calls over internet.  In essence, the provider is using SIP technology to let you receive and send calls using a HK number even you are not physically in HK.

They will give you a local HK number and route all incoming calls to this HK number via internet to your overseas office or call center.  In the simplest way, you just need a IP phone in order to receive calls from and dial out via the HK number.

When you have multiple HK DID numbers or a team of agents to answer calls, you need a SIP-based telephone system for distributing and logging the calls.  These systems usually provide other value-added features like IVRS, conversation recording and follow-me.  Sophisticated ones could even allow you to monitor your agents on-the-fly and gather useful performance statistics.
There are a variety of such systems in the market, such as Asterisk, Elastix or FreePBX.   

Monday, December 02, 2013

Elastix : How to automatically add '9' to all incoming calls

You have setup an Elastix with T1 connectivity to PSTN.  You can also dial '9' to pickup the T1 trunk and dial out.  However, you soon find that it is inconvenient to dial a missed call on your phone simply because the caller number just does not have a '9' in front of it.

Here shows how to automatically add a '9' to all incoming calls in Elastix.

  • Edit /etc/asterisk/extensions_override_elastix.conf

  • Append below lines.  These codes add '9' in front of the caller number if it looks like a local one (8 digits in our case).

include => macro-user-callerid-custom
exten => s,1,Set(AMPUSER=${IF($["foo${AMPUSER}" = "foo"]?${CALLERID(number)}:${AMPUSER})})
exten => s,n,GotoIf($["${CHANNEL:0:5}" = "Local"]?report)
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = ""]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,GotoIf($["x${AMPUSERCIDNAME:1:2}" = "x"]?report)
exten => s,n,Set(AMPUSERCID=${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}" = "1"]?${DB_RESULT}:${AMPUSER})})
exten => s,n,Set(CALLERID(all)="${AMPUSERCIDNAME}" <${AMPUSERCID}>)
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/language)}" != ""]?Set(CHANNEL(language)=${DB(AMPUSER/${AMPUSER}/language)}))
exten => s,n(report),GotoIf($[ "${ARG1}" = "SKIPTTL" ]?continue)
exten => s,n(report2),Set(__TTL=${IF($["foo${TTL}" = "foo"]?64:$[ ${TTL} - 1 ])})
exten => s,n,GotoIf($[ ${TTL} > 0 ]?continue)
exten => s,n,Wait(${RINGTIMER})
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(im-sorry&an-error-has-occured&with&call-forwarding)
exten => s,n,Macro(hangupcall,)
exten => s,n,Congestion(20)
exten => s,n(continue),Noop(Original Using CallerID ${CALLERID(all)})
exten => s,n,Set(CALLERID(number)=${CALLERID(number):0:40})
exten => s,n,Set(CALLERID(name)=${CALLERID(name):0:40})
exten => s,n,ExecIf($[ LEN(${CALLERID(number)}) = 8 ]?Set(CALLERID(number)=9${CALLERID(number)}))
exten => s,n,Noop(Using CallerID ${CALLERID(all)})
exten => h,1,Macro(hangupcall,)

; end of [macro-user-callerid]

  • This approach basically supercedes the original  [macro-user-callerid] of Elastix and you have control on how the caller id would be presented to your extensions.  However, if you upgrade Elastix later, you need to check if these customization align with the upgraded Elastix source code .