Play a file based on SIP error code
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.
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@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Thanks Steven. I found this useful and found also this page on wiki: http://wiki.freeswitch.org/wiki/Variable_bridge_hangup_cause I will give it a try. regards, rod Le 2 mars 2011 à 20:22, Steven Ayre a écrit :
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@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
kawarod
-
Steven Ayre