Skip to main content

Multi-line rollover

About

Emulate shared call appearance on 2-line phones.Emulate a phone system where each phone has 2 extension numbers. When the first line is called, if it is busy the call rolls over to the second line for that phone. If the second line is busy, the call rolls over into voicemail.

Click here to expand Table of Contents

Goal

Emulate a phone system where each phone has 2 extension numbers. When the first line is called, if it is busy the call rolls over to the second line for that phone. If the second line is busy, the call rolls over into voicemail. An advantage to this setup as opposed to having just one extension per person is that if someone monitors that person's two lines, they can see that the person is already on a call when the second one comes in - because the monitor light for the first extension will be solid and the monitor light for the second extension will be blinking. Perfect for a professional with assistant that has to pick up calls if their boss is already on the phone.

In addition to the Local_Extensions section of the conf/dialplan/default.xml being modified, each user's xml file will contain variables stating how many calls are allowed per extension (max_calls), a custom ringback (cringback) and which voicemail box to rollover into (fail_over).

In this example, the phone is registered with two identities - 315 and 415. When a call comes into 315, if it isn't already in use with 1 call, FreeSWITCH will transfer the call to 315. If 315 is already in an active call, FreeSWITCH will transfer the call to the user's second line ( 415 ). I have set the ringback to the uk-ring for the second line which means the caller will hear a distinctive ring ( as opposed to the us-ring on the first line ) and be able to tell that the user is already on a call. If 315 and 415 are both in use then the call is transferred to voicemail:315 ( the user's voicemailbox ).

SIP Profile

conf/sip_profiles/default.xml

You need to enable multiple registrations if you have users with more than one phone and you want them all to log in with the same extensions. If you have the assistant login with the professional's extension in addition to his/her own, their phone will ring and show the call info when the professional's extensions are called allowing her to pickup the call easily.

sip_profiles/default.xml

  <param name="multiple-registrations" value="true"/>

Dialplan

Outbound Calls

conf/dialplan/default.xml (tracking outbound calls)

In order for the rollover to take effect if the extension is making an outbound call also, add the following to your outbound extension condition. In my case, it is put in the extension that matches "9^(\d+)$" where calls go out my gateway.

dialplan/default.xml

<action application="limit" data="$${domain} ${caller_id_number} 10"/> 

Inbound

conf/dialplan/default.xml (Local_Extension example)

    <extension name="Local_Extension">
<condition field="destination_number" expression="^([34][01][0-9])$">
<action application="set" data="dialed_ext=$1"/>
<action application="export" data="dialed_ext=$1"/>
<action application="set_user" data="${dialed_ext}@${domain}"/>
<action application="limit" data="$${domain} ${dialed_ext} ${max_calls} ${fail_over}"/>
<action application="bind_meta_app" data="1 a a execute_extension::dx XML features"/>
<action application="bind_meta_app" data="2 a a record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
<action application="bind_meta_app" data="3 a a execute_extension::cf XML features"/>
<action application="set" data="transfer_ringback=${us-ring}"/>
<action application="set" data="ringback=${${cringback}}"/>
<action application="set" data="call_timeout=30"/>
<action application="set" data="hangup_after_bridge=true"/>
<action application="set" data="continue_on_fail=true"/>
<action application="db" data="insert/call_return/${dialed_ext}/${caller_id_number}"/>
<action application="db" data="insert/last_dial_ext/${dialed_ext}/${uuid}"/>
<action application="bridge" data="${sofia_contact($${domain}/${dialed_ext}@$${domain})}"/>
<action application="answer"/>
<action application="send_display" data="Voicemail for ${vm_extension}"/>
<action application="sleep" data="1000"/>
<action application="voicemail" data="default $${domain} ${vm_extension}"/>
</condition>
</extension>
<extension name="voicemail">
<condition field="destination_number" expression="^voicemail:(.*)$">
<action application="sleep" data="1000"/>
<action application="voicemail" data="default $${domain} $1"/>
</condition>
</extension>

User Directory

Line 1

conf/directory/default/user1-ext1.xml example

default/user1-ext1.xml

<include>
<user id="315" mailbox="315">
<params>
<param name="password" value="1234"/>
<param name="vm-password" value="0000"/>
</params>
<variables>
<variable name="accountcode" value="315"/>
<variable name="user_context" value="default"/>
<variable name="vm_extension" value="315"/>
<variable name="max_calls" value="1"/>
<variable name="fail_over" value="415"/>
<variable name="cringback" value="us-ring"/>
</variables>
</user>
</include> 

Line 2

conf/directory/default/user1-ext2.xml example

default/user1-ext2.xml

<include>
<user id="415">
<params>
<param name="password" value="1234"/>
<param name="vm-password" value="0000"/>
</params>
<variables>
<variable name="accountcode" value="315"/>
<variable name="user_context" value="default"/>
<variable name="vm_extension" value="315"/>
<variable name="max_calls" value="1"/>
<variable name="fail_over" value="voicemail:315"/>
<variable name="cringback" value="uk-ring"/>
</variables>
</user>
</include>