Parsing the Outbound Caller ID Number to use as your 7-digit bridge action

Status
Not open for further replies.

robert

Member
Mar 24, 2018
34
4
8
55
I have now found myself with a customer that has users in multiple area codes that need to be able to dial 7-digit in all of the area codes.
My intention would be to have an outbound extension for each area code on 1 phone. When the user selects that line for an outbound call I want it to recognize that area code to send based on ${outbound_caller_id_number} variable.

If the "Outbound Caller ID Number" is set to +15597779900, I would hope to be able to do something like this:
action bridge sofia/gateway/xxxx-xxx1/1${outbound_caller_id_number[digits3-5]}$1 0 85

Any advice will be appreciated.
 

agree

Member
Aug 26, 2018
135
24
18
Create a dialplan to set the area code
XML:
<extension name="set-area-code" continue="true">
    <condition field="${outbound_caller_id_number}" expression="^1?(\d{3})">
        <action application="set" data="area_code=$1" inline="true"/>
    </condition>
</extension>

In the 7 digit gateway, use
Code:
sofia/gateway/xxxx-xxx/1${area_code}$1
 
Last edited:

robert

Member
Mar 24, 2018
34
4
8
55
This appears to be EXACTLY what I am looking for. Thanks.

I am not familiar how to use an XML file with fusionpbx. I went to the XML editor and poked around a bit.

Would you mind either providing an example from the fusion dial plan manager or let me know how to create/execute the file?

I did use the xml editor to create the file. I then rebooted that server... but do not see it . ( see attached )

Thanks in advance.
 

Attachments

  • areacode.jpg
    areacode.jpg
    61.9 KB · Views: 16
  • areacode2.jpg
    areacode2.jpg
    92.6 KB · Views: 16

robert

Member
Mar 24, 2018
34
4
8
55
It has been a few weeks and I have a sketchy memory as to exactly how I got to a resolution, but attached is a screenshot of the dialplan and Outbound Route. I hope this helps.
 

Attachments

  • set-area-code.jpg
    set-area-code.jpg
    216 KB · Views: 16

michaelcrapse

New Member
Dec 18, 2019
3
0
1
32
It has been a few weeks and I have a sketchy memory as to exactly how I got to a resolution, but attached is a screenshot of the dialplan and Outbound Route. I hope this helps.
Thank you for this, i wanted to also ensure future googlers can see the actual resolution ;)(everyone hates seeing, i got it resolved after asking a tough question.) But you also taught me that i can add a ${domain_name} into the context to make it universal!
However, i would change your regex to be ^\+?1?(\d{3})\d{7}$ or something similar, because you're capturing 4 digits(and maybe a +) but we tend to put our outbound caller id as 10 digits with no leading 1, and your regex would fail in that scenario. This means you'll need to add the 1 where you add the + though.
 
Status
Not open for further replies.