[Freeswitch-users] how to get the content of sip header ?

Samira Mh saami_mh at ymail.com
Tue Jul 3 14:16:05 MSD 2012


for example i want to read the  value of  sip-header ' CSeq'   in lua(that is configure for mod_xml in /usr/loca/freeswitch/conf/autoload/lia.xml.conf), must to issue as follow:
local var = session:getVariable("sip_CSeq")

but the error occure:
 attempt to index global 'session' (a nil value)





 REGISTER sip:192.168.10.89 SIP/2.0
   Via: SIP/2.0/UDP 192.168.18.120:33648;branch=z9hG4bK-d8754z-7e634b5c7a239f6b-1---d8754z-;rport
   Max-Forwards: 70
   Contact: <sip:1000 at 192.168.18.120:33648;rinstance=313a890c6a269acd>
   To: <sip:1000 at 192.168.10.89>
   From: <sip:1000 at 192.168.10.89>;tag=695adb0d
   Call-ID: MGUzNTFkZWVlOTcwODBmOWViNGY4MjM3MzE2NTQzMTM.
   CSeq: 1 REGISTER
   Expires: 5454
   Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
   Supported: timer
   User-Agent: eyeBeam release 1102q stamp 51814
   Content-Length: 0



________________________________
 From: Peter Olsson <peter.olsson at visionutveckling.se>
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org> 
Sent: Sunday, July 1, 2012 11:33 AM
Subject: Re: [Freeswitch-users] how to get the content of sip header ?
 
Use session:getVariable("var") to read whatever channel variable you need. As Michael said, the SIP headers are stored like sip_header_name. For instance, to read the header Diversion:, use the variable sip_diversion.

Michael also mentions the info app, which is a good way to dump all channel variables for a channel, so you know exactly what you have available. To use this, just execute the app info in the dialplan.

/Peter

1 jul 2012 kl. 05:47 skrev "Samira Mh" <saami_mh at ymail.com<mailto:saami_mh at ymail.com>>:

is it possible to explain in details? ,i have review the wiki on subject but don't understand clearly, i am new on freeswitch, thanks ...

________________________________
From: Michael Collins <msc at freeswitch.org<mailto:msc at freeswitch.org>>
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org<mailto:freeswitch-users at lists.freeswitch.org>>
Sent: Sunday, July 1, 2012 1:33 AM
Subject: Re: [Freeswitch-users] how to get the content of sip header ?

See if you have a bunch of sip_xxx channel variables. Send the call to the info app and see what you've got.
-MC

On Sat, Jun 30, 2012 at 5:57 AM, Samira Mh <saami_mh at ymail.com<mailto:saami_mh at ymail.com>> wrote:
hi,
how to get the content of sip header  in lua?



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com<http://www.freeswitchsolutions.com/>


</>

Official FreeSWITCH Sites
http://www.freeswitch.org<http://www.freeswitch.org/>
http://wiki.freeswitch.org<http://wiki.freeswitch.org/>
http://www.cluecon.com<http://www.cluecon.com/>

Join Us At ClueCon - Aug 7-9, 2012

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto: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<http://www.freeswitch.org/>


!DSPAM:4fefc4ee32761372387519!
_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org<mailto:consulting at freeswitch.org>
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

Join Us At ClueCon - Aug 7-9, 2012

FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org<mailto: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


!DSPAM:4fefc4ee32761372387519!

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

Join Us At ClueCon - Aug 7-9, 2012

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/20120703/7c0ea16f/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list