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).

[macro-user-callerid]
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 .


9 comments:

  1. Now you can win free stuff online, enter yourself into giveaways daily and win the latest products instantly. You can win free cash as a free giveaway every time we run a giveaway. https://isocialhub.net/

    ReplyDelete

  2. شكرا معلومات مفيدة يمكنك زيارة ايضا لمعلومات قيمة اخرى قم بزيارة :

    شركة غسيل خزانات بالمدينة المنورة
    افضل شركة تنظيف

    ReplyDelete

  3. Thank you very much for your information.
    Australia ETA/eVisitor Visa
    is quiet easy to apply online from Singapore,
    Malaysia, United Kingdom, United States, Canada, France and including all others ETA Eligible Countries from our website.

    ReplyDelete
  4. You are not sure on how to get your first ecommerce website development then visit best website designing company in kanpur we also help you to promot your business with the email marketing and message marketing.

    ReplyDelete
  5. I am glad reading your article. But should remark on few
    general things, The web site style is great, the articles is really nice
    If you want to know about the Desert tour and rates,For any query click the below link. Musandam tour,Desert safari tour,hatta tour

    ReplyDelete
  6. Very good article and I like it. Thank you for giving me information

    Please Visit to mboplay888.com Slot gambling agent, ball, live casino Indonesia

    Nikmati bonus menarik dari MBOPLAY :

    Welcome Bonus New Member 20% ALL GAMES [ BOLA, POKER, LIVE CASINO, SLOT, IDN LIVE ]

    Promo Cashback Mingguan BOLA UP TO 7.5%
    Promo Cashback Mingguan BOLA UP TO SLOT 1%
    Promo Cashback Mingguan BOLA UP TO LIVE CASINO 1%
    Bonus Next Deposit 5% [ BOLA, LIVE CASINO, SLOT, IDN LIVE ]
    Komisi IDNPOKER 0.5%

    MBOPLAY
    SPBO BOLA
    AGEN SBOBET
    BANDAR JUDI
    AGEN IDN SPORTS
    BURSA TARUHAN BOLA
    JUDI BOLA TERPERCAYA
    BANDAR SPORTS ONLINE TERPERCAYA

    Contact us MBOPLAY.COM :
    Livechat : https://mboplay88b.com/?ref=daftar
    Whatsapp : +6282117858228

    Link Alternatif MBOPLAY :

    https://mboplay88b.com/?ref=daftar
    https://mboplay88c.com/?ref=daftar
    https://mboplay888.com/?ref=daftar

    ReplyDelete
  7. The subject of the article is explained to the creator as beautiful in the content. We read this article with pleasure. Thank you very much.
    hasta yatağı

    ReplyDelete