Misc. Dialplan Tools respond

From FreeSWITCH Wiki
Jump to: navigation, search

Contents

Description

Send SIP session respond code to the SIP device.

Usage

application="respond" data="reponse_info"

Example

Respond can be used to do (probably amongst other things) authentication in the dialplan. For example if you want some of the extensions in your dialplan to be public and others to require auth you could do something like the following:

<extension name="hold_music">
    <condition field="destination_number" expression="^9999$">
        <action application="answer"/>
        <action application="playback" data="$${hold_music}"/>
    </condition>
</extension>

                                                                                                                                                                
<extension name="check_auth" continue="true">                                                                                                               
      <condition field="${sip_authorized}" expression="^true$" break="never">                                                                                   
        <anti-action application="respond" data="407"/>                                                                                                         
      </condition>                                                                                                                                                  
</extension>  

<extension name="echo">
    <condition field="destination_number" expression="^9996$">
        <action application="answer"/>
        <action application="echo"/>
    </condition>
</extension>

In this example anyone would be able to call the hold_music extension but only authorized users would be able to call the echo extension.

The standard config uses the public.xml dialplan to expose some extensions by transferring them into the default context. This is another way of achieving the same thing.

It is possible to specify the domain used in the realm part of the challenge using:

<anti-action application="respond" data="407 ${sip_from_host}"/>

You can also send you own Status Text:

<action application="respond" data="480 Try again later"/>

TESTED AND WORKS

Warnings

If you disable authentication in a Sofia profile and use respond in the dialplan to do the authentication any ACLs defined in the profile will be useless. They simply don't work if authentication is disabled in the Sofia profile

With previous versions of FreeSWITCH, it was possible to send "180 Ringing" with application respond. Not anymore. If you need to send "180 Ringing" use application ring_ready instead.

See Also