Inbound Dial Plan for invalid numbers

Status
Not open for further replies.

alcoutop

New Member
May 1, 2019
26
5
3
34
Hi everyone,

Hope you guys are doing great.
I am trying to setup an inbound dial plan that can detect if the extension exists (on Extensions).
And if not, to route the call to a voicemail system.

That is for example in case an employee leaves the company. While the number still exists on the Sip provider (SignalWire), the extension in FusionPBX would be removed. And we want to make sure this call goes to the global voicemail or some sort of IVR.

For exampling purpose, below is what I tried to do.. (which I thought would be the easy way)
I created two dial plans with different order, and set the "inbound_calls" dial plan as TRUE to continue.

1577153389784.png

However, looks like go_to_voicemail dial plan is not being executed.

Below is my Go_to_voicemail dial plan:
1577153708657.png
PS: If I set Go_to_voicemail order <100, it works the way it should. (call goes to the voicemail). However, of course, all calls go to voicemail.

Any ideas?

Thanks and Merry Christmas!
Alan
 
Last edited:

ad5ou

Active Member
Jun 12, 2018
884
195
43
You didn’t post what is in the “inbound_calls” dial plan.
My guess is you have a condition that is matching the number dialed and a transfer action. Once it transfers to the pbx.domain.name context, the 105 ordered dial plan is never processed.
 
  • Like
Reactions: alcoutop

alcoutop

New Member
May 1, 2019
26
5
3
34
You didn’t post what is in the “inbound_calls” dial plan.
My guess is you have a condition that is matching the number dialed and a transfer action. Once it transfers to the pbx.domain.name context, the 105 ordered dial plan is never processed.
Great to hear you again @ad5ou .

Yes, Agreed that if inbound_calls is hit, no other dial plan will be hit.
However, since the number that I dialed is not registered in Extensions (but still coming from SignalWire), shouldn't it go to the next dial plan and hit the Go_to_voicemail?

Here is my inbound_calls dialplan:

1577164901622.png
Would you suggest combine both and make only 1 dialplan? Or can I still make 2 dialplans and make this work?

Thank you!
Alan
 

ad5ou

Active Member
Jun 12, 2018
884
195
43
I don’t think your setup will work as desired with how your inbound route is programmed. As is, all calls are going to your “internal” dial plan so any extra conditions/dial plans would need to be put there (under “dial plan manager”).

The cleaner way to accomplish the desired results would be to build an inbound route (or destination) for each number assigned for your system directing the call to whichever extension/ring group/conference/etc.
Then you can either route a specific unused number to a new destination when it is open or delete the number and then your go to voicemail dial plan could take over.

If you are on master branch you can import numbers from a cvs file if you have a large batch of numbers to deal with.
 

alcoutop

New Member
May 1, 2019
26
5
3
34
Thanks @ad5ou
That approach will be hard to implement.
I got some improvement though with some troubleshooting.

Instead of having multiple dial plans, I am trying the anti-action feature.
dialplan_new.png
I confirmed the anti-action worked. Why?

Calling an existent number goes to voicemail.
And If I delete the condition ${user_exists} the call goes through.
So I guess something is wrong with the condition ${user_exists}.

Although the logs say the following (when the call goes through):

EXECUTE [depth=0] sofia/external/+1415XXXXXXX@sip.signalwire.com set(user_exists=true)

Any idea is always appreciated.

Thanks!
Alan
 

alcoutop

New Member
May 1, 2019
26
5
3
34
Please ignore my last post. The anti-action did not actually work.

Here is some things I tried between yesterday and today..

First analysis: I made a call using the dial plan below which is the dial plan that the call successfully reaches a valid number, for example XXX-XXX-2528.
* Behavior Expected

an_1.jpg

Call to 2528 (existing extension): (successful call)

Code:
2020-01-07 12:13:25.547610 [INFO] mod_dialplan_xml.c:637 Processing +1415XXXXXXX <+1415XXXXXXX>->2528 in context default
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com parsing [default->user_exists] continue=true
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Regex (PASS) [user_exists] () =~ // break=on-false
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Action set(user_exists=${user_exists id ${destination_number} ${domain_name}}) INLINE
EXECUTE [depth=0] sofia/external/+1415XXXXXXX@sip.signalwire.com set(user_exists=true)
2020-01-07 12:13:25.547610 [DEBUG] mod_dptools.c:1672 SET sofia/external/+1415XXXXXXX@sip.signalwire.com [user_exists]=[true]
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Action set(from_user_exists=${user_exists id ${sip_from_user} ${sip_from_host}}) INLINE
EXECUTE [depth=0] sofia/external/+1415XXXXXXX@sip.signalwire.com set(from_user_exists=false)
2020-01-07 12:13:25.547610 [DEBUG] mod_dptools.c:1672 SET sofia/external/+1415XXXXXXX@sip.signalwire.com [from_user_exists]=[false]
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Regex (PASS) [user_exists] ${user_exists}(true) =~ /^true$/ break=on-false

Call to 2525 (nonexistent extension): (unsuccessful call)

Code:
2020-01-07 12:11:52.267680 [INFO] mod_dialplan_xml.c:637 Processing +1415XXXXXXX <+1415XXXXXXX>->2525 in context default
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com parsing [default->user_exists] continue=true
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Regex (PASS) [user_exists] () =~ // break=on-false
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Action set(user_exists=${user_exists id ${destination_number} ${domain_name}}) INLINE
EXECUTE [depth=0] sofia/external/+1415XXXXXXX@sip.signalwire.com set(user_exists=false)
2020-01-07 12:11:52.287614 [DEBUG] mod_dptools.c:1672 SET sofia/external/+1415XXXXXXX@sip.signalwire.com [user_exists]=[false]
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Action set(from_user_exists=${user_exists id ${sip_from_user} ${sip_from_host}}) INLINE
EXECUTE [depth=0] sofia/external/+1415XXXXXXX@sip.signalwire.com set(from_user_exists=false)
2020-01-07 12:11:52.287614 [DEBUG] mod_dptools.c:1672 SET sofia/external/+1415XXXXXXX@sip.signalwire.com [from_user_exists]=[false]
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Regex (FAIL) [user_exists] ${user_exists}(false) =~ /^true$/ break=on-false

Second analysis: I changed the dial plan and added the condition user exists. Here is the dial plan:
*Behavior not expected.

an_2.jpg
Here is how the XML looks like: .

Code:
<extension name="inbound_calls" continue="true" uuid="5c82437b-28e9-44a0-a3ab-b4ab2679dd1c">
            <condition field="destination_number" expression="^\+?1?\d{6}(\d{4})$"/>
            <condition field="${user_exists}" expression="true">
                        <action application="export" data="call_direction=inbound" inline="true"/>
                        <action application="set" data="domain_uuid=be0da0a4-9339-4cef-8d90-48865f70bfd4" inline="true"/>
                        <action application="set" data="domain_name=pbx.ifactor.com" inline="true"/>
                        <action application="set" data="continue_on_fail=true"/>
                        <action application="transfer" data="$1 XML default"/>
                        <anti-action application="transfer" data="*992528 XML default"/>
            </condition>
</extension>

Call to 2525/2528:

Code:
2020-01-09 12:03:04.987629 [INFO] mod_dialplan_xml.c:637 Processing +1415XXXXXXX <+1415XXXXXXX>->*992528 in context default
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com parsing [default->user_exists] continue=true
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Regex (PASS) [user_exists] () =~ // break=on-false
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Action set(user_exists=${user_exists id ${destination_number} ${domain_name}}) INLINE
EXECUTE [depth=0] sofia/external/+1415XXXXXXX@sip.signalwire.com set(user_exists=false)
2020-01-09 12:03:04.987629 [DEBUG] mod_dptools.c:1672 SET sofia/external/+1415XXXXXXX@sip.signalwire.com [user_exists]=[false]
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Action set(from_user_exists=${user_exists id ${sip_from_user} ${sip_from_host}}) INLINE
EXECUTE [depth=0] sofia/external/+1415XXXXXXX@sip.signalwire.com set(from_user_exists=false)
2020-01-09 12:03:05.007600 [DEBUG] mod_dptools.c:1672 SET sofia/external/+1415XXXXXXX@sip.signalwire.com [from_user_exists]=[false]
Dialplan: sofia/external/+1415XXXXXXX@sip.signalwire.com Regex (FAIL) [user_exists] ${user_exists}(false) =~ /^true$/ break=on-false

The new dial plan also brings a new error:

Code:
EXECUTE [depth=0] sofia/external/+1415XXXXXXX@sip.signalwire.com lua(app.lua voicemail)
2020-01-09 12:45:42.995019 [ERR] mod_lua.cpp:202 /usr/share/freeswitch/scripts/app/voicemail/index.lua:154: attempt to concatenate global 'domain_name' (a nil value)
stack traceback:
        /usr/share/freeswitch/scripts/app/voicemail/index.lua:154: in main chunk
        /usr/share/freeswitch/scripts/app.lua:48: in main chunk

Any idea/suggestion is appreciated.

Thanks!
Alan
 
Status
Not open for further replies.