[Freeswitch-users] Play a file based on SIP error code
Steven Ayre
steveayre at gmail.com
Wed Mar 2 19:22:53 MSK 2011
To sketch our how to do it...
In dialplan:
<action application="set" data="hangup_on_bridge=true"/>
<action application="set" data="continue_on_fail=true"/>
<action application="bridge" data="..."/>
<action application="lua" data="playerror.lua"/>
That'll run the lua script after the bridge (it'll only get there if
the bridge fails)
In the lua script:
cause = session:getVariable("proto_specific_hangup_cause")
if (cause == "sip:486") then
session:streamFile("/path/to/busy.wav");
elseif (cause == "sip:404") then
session:streamFile("/path/to/unknown_user.wav");
elseif (cause == "sip:480") then
session:streamFile("/path/to/unavailable.wav");
else
session:streamFile("/path/to/unknown_error.wav");
end
You can also use the ISDN clearing cause from session:hangupCause() if you wish.
-Steve
On 2 March 2011 16:07, kawarod <kawarod at laposte.net> wrote:
> Hi List,
>
> I'd like to know how I can play a file based on the SIP error code returned by a peer.
>
> For example, I'd like to play the following announce if I receive a SIP 404:
> " The number you dialed is unreachable"
>
> Thanks for your help.
>
> rod.
>
>
> _______________________________________________
> 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
>
More information about the FreeSWITCH-users
mailing list