Inbound Routes

From FusionPBX
Jump to: navigation, search

Menu: (Dialplan-Inbound Routes)

Directs public inbound calls to an internal destination on the system.
Note that the only difference between the inbound route dial plan and the normal dial plan is that the inbound route dial plan works on all calls that are in the public context whereas the normal dial plan works on the default context.

  • Inbound Call Routing is used to route incoming calls to destinations based on one or more conditions and context. It can send incoming calls to an auto attendant, huntgroup, extension, external number, or a script. Order is important when an anti-action is used or when there are multiple conditions that match.

ADD inbound route

Name: 	
Condition 1: 	Field: 		  Expression: 	
Condition 2: 	Field: 		  Expression: 	
Action 1:
Action 2: 	
Order: 	
Enabled: 	
Description:

Modifying CID on Inbound Routes

You can use this to perpend data onto caller ID. For example: A company has multiple numbers but wants to be able to tell the difference between an emergency call and a regular call.

Setting up in FusionPBX - keep in mind this will probably have to go after the context and before the transfer.

Name: Priority Inbound
Condition 1 - Field: destination_number   Expression: ^12345551234$
           Action 1: set                        Data:  effective_caller_id=EMERGENCY ${caller_id_name}

The XML is as follows:

<action application="set" data="effective_caller_id_name=EMERGENCY ${caller_id_name}"/>

So, if John Smith calls into the number 12345551234 with a huge emergency, the caller ID would show up as

EMERGENCY John Smith
  • Some phones truncate CID names after a certain character limit.

Creating a catch all inbound route

To create a catch all inbound route, remove the destination_number condition. Then there is one condition remaining and that is the one that makes sure its the public context - this is a condition included for all inbound routes (you don't ever see this condition). To use your new catch all rule, make sure it has the highest order number so it is the last to process - this will allow you to have specific rules processed before it and this will then truly function as a catch all - only processing calls that don't match any of the earlier rules

Advanced Examples

Play a greeting then Transfer

Here's some example XML for an inbound dialplan entry.

<extension name="1235555555 Play Greet then XFER" >
  <condition field="context" expression="public"/>
  <condition field="destination_number" expression="^(1235555555)$">
      <action application="answer"/>
      <action application="sleep" data="1000"/>
      <action application="playback" data="/usr/local/freeswitch/recordings/greeting.wav"/>
      <action application="transfer" data="1000 XML Default"/>
  </condition>
</extension>


Route based on CallerID Name or Number

I use this to send unwanted callers (telemarketers that won't stop) away.

vim /usr/local/freeswitch/conf/dialplan/public/0000000GOTOLENNY.xml

then adjust as required:

<extension name="gotolennyCIDnumber" >
  <condition field="context" expression="public"/>
  <condition field="caller_id_number" expression="^1235554321$|^1235551234$">
     <action application="answer"/>
     <action application="bridge" data="sofia/${use_profile}/lenny@sip.itslenny.com:5060"/>
  </condition>
</extension>

<extension name="gotolennyCIDname" >
  <condition field="context" expression="public"/>
   <condition field="caller_id_name" expression="^.*THE.*ANNOYING.*COMPANY.*$|^.*OTHER.*ANNOYING.*CALLER.*$">
       <action application="answer"/>
       <action application="bridge" data="sofia/${use_profile}/lenny@sip.itslenny.com:5060"/>
   </condition>
</extension>

Go to an IVR then auto-transfer

This is useful for the case where you don't really want a full blown IVR, but you would like to provide the caller the opportunity to enter an extension number (or a conference, disa, etc), and then automatically transfer them if they don't know it.

Here's the inbound dialplan XML:

<extension name="1235551234-go-ivr-then-transfer" >
  <condition field="context" expression="public"/>
  <condition field="destination_number" expression="^(1235551234)$">
      <action application="answer"/>
      <action application="sleep" data="1000"/>
      <action application="set" data="hangup_after_bridge=true"/>
      <action application="ivr" data="your_ivr"/>
      <action application="answer"/>
      <action application="sleep" data="500"/>
      <action application="transfer" data="1000 XML Default"/>
  </condition>
</extension>

Here is the IVR XML:

<include>
       <menu name="your_ivr"
               greet-long="/usr/local/freeswitch/recordings/greeting.wav"
               greet-short="/usr/local/freeswitch/recordings/greeting.wav"
               invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
               exit-sound="ivr/ivr-call_being_transferred.wav"
               confirm-macro=""
               confirm-key=""
               tts-engine="flite"
               tts-voice="rms"
               confirm-attempts="3"
               timeout="3000"
               inter-digit-timeout="2000"
               max-failures="1"
               max-timeouts="1"
               digit-len="5">
               <entry action="menu-exec-app" digits="2222" param="conference Conference@default+123"/>      
               <entry action="menu-exec-app" digits="/^(10[01][0-9])$/" param="transfer $1 XML default"/>
       </menu>
</include>

If you want to have the extension part hidden, you could also play a ring tone here. For greet-long, use:

tone_stream://L=1%(2000, 4000, 440.0, 480.0)