Forward incoming to external number

willy Lafort

Member
Mar 5, 2017
37
1
8
66
Hello;
I've trying to forward incoming call to external pstn line if no one answers the extension.. I see that fspbx is parsing the incoming caller ID, and I'm reading that is not allow by several voip providers, because of CID spoofing and because if a number is forwarded to some bad, questionable number that wont be good.
Can fspbx use the called DID to forward the call to a lan line?
 
We do just this.

Create an extension that the DID send the call to. In the Call forward, choose "External Number", in the number field, put something like this 990015551234567. "9900" is a prefix of your choosing "15551234567" is the outside number to be called. Make sure to set the Dialplan order number pretty low, so it gets run before other outbound dial plans.

What this does is it looks at the external number being called and if the 1st 4 digits match then it removes them and makes the outbound CallerID the DID.

The 9900 is just a number to be used for a outbound dial plan.
Create a outbound dial plant and set it as the following.
In the [When] section add the below condition

[Type] = "Condition"
[Field] = "destination_number"
[Pattern] = ^9900(\d{11})$

In the [Then] section add each 'Action application" line from below. Your XML will look like the below xml.

Code:
<extension name="Telnyx.9800d11" continue="false" uuid="#########">
    <condition field="${user_exists}" expression="false"/>
    <condition field="destination_number" expression="^9800(\d{11})$">
        <action application="set" data="sip_h_accountcode=${accountcode}"/>
        <action application="set" data="sip_cid_type=none"/>
        <action application="unset" data="sip_h_Privacy"/>
        <action application="privacy" data="no"/>
        <action application="export" data="call_direction=outbound" inline="true"/>
        <action application="unset" data="call_timeout"/>
        <action application="set" data="hangup_after_bridge=true"/>
        <action application="set" data="effective_caller_id_name=15551234567"/>
        <action application="set" data="effective_caller_id_number=15551234567"/>
        <action application="set" data="inherit_codec=true"/>
        <action application="set" data="ignore_display_updates=true"/>
        <action application="set" data="callee_id_number=$1"/>
        <action application="set" data="continue_on_fail=1,2,3,6,18,21,27,28,31,34,38,41,42,44,58,88,111,403,501,602,607,809"/>
        <action application="set" data="outbound_prefix=9803"/>
        <action application="bridge" data="sofia/gateway/########/$1"/>
    </condition>
</extension>