[Freeswitch-users] Condition on if user exists.

Michael Nielsen mic.niel84 at gmail.com
Tue Sep 8 13:19:47 MSD 2015


This is my dialplan so far, where I want to add this functionality (
http://pastebin.com/k1hffPBp):

    <condition field="destination_number" expression="^(\+\d{3,20})$">
      <action application="set" data="dialed_number=$1" inline="true"/>
      <action application="export" data="dialed_number=$1" inline="true"/>
    </condition>
    <condition field="destination_number" expression="^(\d{3,20})$">
      <action application="set" data="dialed_number=${country_code}$1"
inline="true"/>
      <action application="export" data="dialed_number=${country_code}$1"
inline="true"/>
    </condition>
    <condition field="${dialed_number}" IF-USER-EXISTS>
      <action application="set" data="call_timeout=20"/>
      <action application="set" data="hangup_after_bridge=true"/>
      <action application="set" data="continue_on_fail=true"/>
      <action application="bridge" data="user/${dialed_number}@
${domain_name}"/>
      <action application="answer"/>
      <action application="sleep" data="1000"/>
      <action application="bridge" data="loopback/app=voicemail:default
${domain_name} ${dialed_number}"/>
    </condition>
    <condition field="${dialed_number}" IF-USER-DO-NOT-EXISTS>
      <action application="set"
data="effective_caller_id_number=${effective_caller_id_number}"/>
      <action application="set"
data="effective_caller_id_name=${effective_caller_id_number}"/>
      <action application="bridge"
data="sofia/gateway/pstn-outbound/${dialed_number}"/>
    </condition>


On Tue, Sep 8, 2015 at 9:52 AM, Michael Nielsen <mic.niel84 at gmail.com>
wrote:

> I would like to the following:
>
> <condition IF-USER-EXISTS>
> </condition>
> <condition IF-USER-DO-NOT-EXISTS>
> </condition>
>
> I'm not able to check on regexp, as my user ID's match +44-12345678...
> And I would like to do one thing if the user exists and otherwise route to
> my PSTN gateway.
>
> I've tried to just use bridge with both local routing and PSTN calls, but
> then I try to call my PSTN everytime I call local users.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150908/ab3d43ac/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list