[Freeswitch-users] Condition on if user exists.

Avi Marcus avi at avimarcus.net
Wed Sep 9 09:04:14 MSD 2015


Sounds like you want to check this result for truthiness:
https://wiki.freeswitch.org/wiki/Mod_commands#user_exists

BTW export by default sets on both channels, so you don't need a SET and an
EXPORT.

-Avi Marcus
BestFone

On Tue, Sep 8, 2015 at 12:19 PM, Michael Nielsen <mic.niel84 at gmail.com>
wrote:

> 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.
>>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150909/b53957de/attachment-0001.html 


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