I have this in my dial plan:

 

    <action application="set" data="api_hangup_hook=lua hook.lua"/>

 

And hook.lua has this:

 

dat = env:serialize()

freeswitch.consoleLog("INFO","hangup hook env:\n" .. dat .. "\n")

 

This dumps everything, and I don’t see the X- variables I’m looking for.  I’m assuming this means I would actually need to use the event socket if I want to see them.

 

-----------------------

Eric Z. Beard, CTO

Loop LLC

w (877) 850-2010 x9249

m (727) 776-2768

eric@loopfx.com

 

From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Michael Collins
Sent: Monday, May 23, 2011 5:34 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Read SIP Response Headers from Dialplan or Lua

 

I would turn on mod_xml_cdr and look at a failed call's XML output. Look in the <variables> section and see if any of those have the data you're looking for.

 

-MC

On Mon, May 23, 2011 at 1:58 PM, Eric Beard <eric@loopfx.com> wrote:

Hello,

 

I’m wondering if it’s possible to read SIP response headers from the dial plan, or from Lua.

 

One of my gateways returns a generic 500 for all kinds of different error conditions, and expects me to read variables in the sip response.

 

e.g.

 

SIP/2.0 500 Service Unavailable

Via:..

From:…

Etc:

X-Custom-Var:val

 

The value in the custom variable might be “busy”, “bad number”, etc.

 

If I add something to the INVITE, I know that I can read it with channel variables “sip_h_X-Name”, but I don’t get the same thing for the response.

 

Thanks,

 

-----------------------

Eric Z. Beard, CTO

Loop LLC

w (877) 850-2010 x9249

m (727) 776-2768

eric@loopfx.com

 


_______________________________________________
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