[Freeswitch-users] How to check user in directory

Steven Ayre steveayre at gmail.com
Fri Sep 10 01:07:43 PDT 2010

Does user exist in user directory?

Is the user registered?

Quick example (untested but would probably work):

<!-- If the user doesn't exist, reject the call -->
<extension name="user_not_found">
  <condition field="${user_exists(id ${destination_number} $${domain})}"
    <action application="hangup" data="*UNALLOCATED_NUMBER*" />
<!-- If the user is registered, forward the call to them -->
<extension name="user_registered">
  <condition field="${sofia_contact(profile/${destination_number}@$${domain})}"
    <action application="set" data="hangup_on_bridge=true" />
    <action application="bridge" data="$1" />
<!-- If the bridge fails, or the user wasn't registered, fall back to
voicemail -->
<extension name="voicemail">
  <condition field="destination_number" expression=".*">
    <action application="voicemail" data="profile $${domain}
${destination_number}" />


On 10 September 2010 05:20, Boris Kovalenko <boris at tagnet.ru> wrote:

>  Hello!
>     I have a set of local users registered to freeswitch. So, when user
> is not registered with switch I get USER_NOT_REGISTERED when route call
> to it. But is there a way to know is user present in directory and not
> registered, or even isn't in directory? I want to call voicemail in
> first case and play 'invalid number' message in second. Is this possible?
> --
> Regards,
> Boris
> _______________________________________________
> 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/20100910/8da25f6e/attachment-0001.html 

More information about the FreeSWITCH-users mailing list